Skip to content

Commit 611c5d4

Browse files
authored
v2.10.2 - V4 FPS fix (#1329)
* Use copyts and copytb #1287 Thanks @cdoolin! * add custom_string to run_action for restart #1287 * Update battery level in WebUI * Update site.js * mono audio * changelog
1 parent 1b40e49 commit 611c5d4

File tree

7 files changed

+58
-15
lines changed

7 files changed

+58
-15
lines changed

README.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ It just works!
1616

1717
Streams direct from camera without additional bandwidth or subscriptions.
1818

19-
Based on [@noelhibbard's script](https://gist.github.com/noelhibbard/03703f551298c6460f2fd0bfdbc328bd#file-readme-md) with [kroo/wyzecam](https://github.com/kroo/wyzecam) and [bluenviron/mediamtx](https://github.com/bluenviron/mediamtx).
20-
2119
Please consider ⭐️ starring or [☕️ sponsoring](https://ko-fi.com/mrlt8) this project if you found it useful, or use the [affiliate link](https://amzn.to/3NLnbvt) when shopping on amazon!
2220

2321

@@ -52,20 +50,18 @@ See the [supported cameras](#supported-cameras) section for additional informati
5250
Install [docker](https://docs.docker.com/get-docker/) and run:
5351

5452
```bash
55-
docker run -p 8554:8554 -p 8888:8888 -p 5000:5000 mrlt8/wyze-bridge
53+
docker run -p 8554:8554 -p 8888:8888 -p 5050:5000 -e WB_AUTH=false mrlt8/wyze-bridge
5654
```
5755

58-
You can then use the web interface at `http://localhost:5000` where localhost is the hostname or ip of the machine running the bridge.
59-
60-
The default login for the WebUI will be:
61-
```
62-
username: wbadmin
63-
password: <username portion of your wyze email>
64-
```
65-
Example: For the wyze email `[email protected]`, the default password would be `myEmail123`.
56+
You can then use the web interface at `http://localhost:5050` where `localhost` is the hostname or ip of the machine running the bridge.
6657

6758
See [basic usage](#basic-usage) for additional information or visit the [wiki page](https://github.com/mrlt8/docker-wyze-bridge/wiki/Home-Assistant) for additional information on using the bridge as a Home Assistant Add-on.
6859

60+
## What's Changed in v2.10.2
61+
62+
- FIX: day/night FPS slowdown for V4 cameras (#1287) Thanks @cdoolin and @Answer-1!
63+
- NEW: Update battery level in WebUI
64+
6965
## What's Changed in v2.10.0/v2.10.1
7066

7167
FIXED: Could not disable `WB_AUTH` if `WB_API` is set. (#1304)
@@ -284,6 +280,11 @@ All environment variables are optional.
284280

285281
## Other Wyze Projects
286282

283+
Honorable Mentions:
284+
285+
* [@noelhibbard's script](https://gist.github.com/noelhibbard/03703f551298c6460f2fd0bfdbc328bd#file-readme-md) - Original script that the bridge is bassd on.
286+
* [kroo/wyzecam](https://github.com/kroo/wyzecam) - Original library that the bridge is based on.
287+
287288
Video Streaming:
288289

289290
* [gtxaspec/wz_mini_hacks](https://github.com/gtxaspec/wz_mini_hacks) - Firmware level modification for Ingenic based cameras with an RTSP server and [self-hosted mode](https://github.com/gtxaspec/wz_mini_hacks/wiki/Configuration-File#self-hosted--isolated-mode) to use the cameras without the wyze services.

app/static/site.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ video {
142142
.status .fa-circle-play,
143143
.status .fa-circle-pause,
144144
.status .fa-satellite-dish,
145-
.fa-arrows-rotate {
145+
.fa-arrows-rotate,
146+
.card-header-title .icon.battery {
146147
cursor: pointer;
147148
}
148149

app/static/site.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,7 @@ document.addEventListener("DOMContentLoaded", () => {
404404
const preview = card.querySelector(`img.refresh_img, video[data-cam='${cam}']`);
405405
const motionIcon = card.querySelector(".icon.motion");
406406
const connected = card.dataset.connected.toLowerCase() === "true";
407+
updateBatteryLevel(card);
407408

408409
card.dataset.connected = false;
409410
statusIcon.className = "fas";
@@ -752,4 +753,38 @@ document.addEventListener("DOMContentLoaded", () => {
752753
bulmaToast.toast({ message: `<strong>${title}</strong> - ${message}`, type: `is-${type}`, pauseOnHover: true, duration: 10000 })
753754
}
754755
}
756+
function updateBatteryLevel(card) {
757+
if (card.dataset.battery?.toLowerCase() !== "true") { return; }
758+
const iconElement = card.querySelector(".icon.battery i");
759+
fetch(`api/${card.id}/battery`)
760+
.then((resp) => resp.json())
761+
.then((data) => {
762+
if (data.status != "success" || !data.value) { return; }
763+
const batteryLevel = parseInt(data.value);
764+
let batteryIcon;
765+
iconElement.classList.remove("has-text-danger");
766+
iconElement.classList.forEach(cls => {
767+
if (cls.startsWith('fa-battery-')) {
768+
iconElement.classList.remove(cls);
769+
}
770+
});
771+
if (batteryLevel > 90) {
772+
batteryIcon = "full";
773+
} else if (batteryLevel > 75) {
774+
batteryIcon = "three-quarters";
775+
} else if (batteryLevel > 50) {
776+
batteryIcon = "half";
777+
} else if (batteryLevel > 10) {
778+
batteryIcon = "quarter";
779+
} else {
780+
batteryIcon = "empty";
781+
iconElement.classList.add("has-text-danger");
782+
}
783+
iconElement.classList.add(`fa-battery-${batteryIcon}`);
784+
iconElement.parentElement.title = `Battery Level: ${batteryLevel}%`;
785+
})
786+
}
787+
document.querySelectorAll('div.camera[data-battery="True"]').forEach((card) => {
788+
card.querySelector(".icon.battery").addEventListener("click", () => updateBatteryLevel(card));
789+
});
755790
});

app/templates/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@
144144
{% endif %}
145145
{% endif %}
146146
{% if camera.is_battery %}
147-
<span class="icon" title="Battery">
147+
<span class="icon battery">
148148
<i class="fas fa-battery-empty" aria-hidden="true"></i>
149149
</span>
150150
{% endif %}

app/wyzebridge/ffmpeg.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def get_ffmpeg_cmd(
3535
thread_queue = "-thread_queue_size 8 -analyzeduration 32 -probesize 32"
3636
if audio and "codec" in audio:
3737
# `Option sample_rate not found.` if we try to specify -ar for aac:
38-
rate = "" if audio["codec"] == "aac" else f" -ar {audio['rate']}"
38+
rate = "" if audio["codec"] == "aac" else f" -ar {audio['rate']} -ac 1"
3939
audio_in = f"{thread_queue} -f {audio['codec']}{rate} -i /tmp/{uri}_audio.pipe"
4040
audio_out = audio["codec_out"] or "copy"
4141
a_filter = env_bool("AUDIO_FILTER", "volume=5") + ",adelay=0|0"
@@ -66,7 +66,7 @@ def get_ffmpeg_cmd(
6666
+ (["-map", "1:a", "-c:a", audio_out] if audio_in else [])
6767
+ (a_options if audio and audio_out != "copy" else [])
6868
+ ["-fps_mode", "passthrough", "-flush_packets", "1"]
69-
+ ["-rtbufsize", "1"]
69+
+ ["-rtbufsize", "1", "-copyts", "-copytb", "1"]
7070
+ ["-f", "tee"]
7171
+ [rtsp_ss + livestream]
7272
)

app/wyzecam/api.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ def run_action(auth_info: WyzeCredential, camera: WyzeCamera, action: str):
225225
action_key=action,
226226
instance_id=camera.mac,
227227
provider_key=camera.product_model,
228+
custom_string="",
228229
)
229230
resp = post(f"{WYZE_API}/v2/auto/run_action", json=payload, headers=_headers())
230231

home_assistant/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## What's Changed in v2.10.2
2+
3+
- FIX: day/night FPS slowdown for V4 cameras (#1287) Thanks @cdoolin and @Answer-1!
4+
- NEW: Update battery level in WebUI
5+
16
## What's Changed in v2.10.0/v2.10.1
27

38
FIXED: Could not disable `WB_AUTH` if `WB_API` is set. Thanks @bengthu! (#1304)

0 commit comments

Comments
 (0)