From 56d59ca2264261ca8e059e4b0d00084b0a3feb23 Mon Sep 17 00:00:00 2001 From: mrlt8 <67088095+mrlt8@users.noreply.github.com> Date: Wed, 29 Mar 2023 20:17:40 -0700 Subject: [PATCH] v2.0.2 (#754) * Media Controls * Refresh preview if cam enabled #750 * Show battery icon if cam is battery powered * Use last modified date for API thumbnails * Remove broken PTZ and add motion tagging commands * update docs --- README.md | 12 ++++++++++++ app/CHANGELOG.md | 12 ++++++++++++ app/config.json | 2 +- app/static/site.js | 17 +++++++++++------ app/templates/index.html | 8 +++++++- app/wyzebridge/wyze_api.py | 7 ++++++- app/wyzebridge/wyze_control.py | 9 +++------ app/wyzecam/tutk/tutk_protocol.py | 23 ++++++++++++++++------- 8 files changed, 68 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index a905bbb5..6c2ab8cb 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,18 @@ You can then use the web interface at `http://localhost:5000` where localhost is See [basic usage](#basic-usage) for additional information. +## What's Changed in v2.0.2 + +* Camera Control: Don't wait for a response when sending `set_rotary_` commands. #746 +* Camera Control: Add commands for motion tagging (potentially useful if using waitmotion in mini hacks): + * `get_motion_tagging` current status: `1`=ON, `2`=OFF. + * `set_motion_tagging_on` turn on motion tagging. + * `set_motion_tagging_off` turn off motion tagging +* WebUI: Refresh image previews even if camera is not connected but enabled. (will still ignore battery cameras) #750 +* WebUI: Add battery icon to cameras with a battery. +* WebUI: Use Last-Modified date to calculate the age of the thumbnails from the wyze API. +* Update documentation for K10010ControlChannel media controls for potential on-demand control of video/audio. + ## What's Changed in v2.0.1 * Fixed a bug where the WebUI would not start if 2FA was required. #741 diff --git a/app/CHANGELOG.md b/app/CHANGELOG.md index 71237b08..23166e07 100644 --- a/app/CHANGELOG.md +++ b/app/CHANGELOG.md @@ -1,3 +1,15 @@ +## What's Changed in v2.0.2 + +* Camera Control: Don't wait for a response when sending `set_rotary_` commands. #746 +* Camera Control: Add commands for motion tagging (potentially useful if using waitmotion in mini hacks): + * `get_motion_tagging` current status: `1`=ON, `2`=OFF. + * `set_motion_tagging_on` turn on motion tagging. + * `set_motion_tagging_off` turn off motion tagging +* WebUI: Refresh image previews even if camera is not connected but enabled. (will still ignore battery cameras) #750 +* WebUI: Add battery icon to cameras with a battery. +* WebUI: Use Last-Modified date to calculate the age of the thumbnails from the wyze API. +* Update documentation for K10010ControlChannel media controls for potential on-demand control of video/audio. + ## What's Changed in v2.0.1 * Fixed a bug where the WebUI would not start if 2FA was required. #741 diff --git a/app/config.json b/app/config.json index 9a11cd85..d6bb585e 100644 --- a/app/config.json +++ b/app/config.json @@ -4,7 +4,7 @@ "slug": "docker-wyze-bridge", "url": "https://github.com/mrlt8/docker-wyze-bridge", "image": "mrlt8/wyze-bridge", - "version": "2.0.1", + "version": "2.0.2", "arch": [ "armv7", "aarch64", diff --git a/app/static/site.js b/app/static/site.js index f7e4a1f3..53965cb8 100644 --- a/app/static/site.js +++ b/app/static/site.js @@ -240,8 +240,11 @@ function refresh_imgs() { console.debug("refresh_imgs " + Date.now()); document.querySelectorAll(".refresh_img").forEach(async function (image) { let url = image.getAttribute("src"); - // Skip if not connected - await update_img(url, !image.classList.contains("connected")); + // Skip if not enabled or battery + let CameraBattery = document.getElementById(image.dataset.cam).dataset.battery?.toLowerCase() == "true"; + let CameraConnected = image.classList.contains("connected"); + let CameraEnabled = image.classList.contains("enabled"); + await update_img(url, !(CameraEnabled && (!CameraBattery || CameraConnected))); }); } @@ -319,7 +322,7 @@ document.addEventListener("DOMContentLoaded", () => { oldUrl = `snapshot/${cam}.jpg`; } try { - let newUrl = await update_img(oldUrl, (getCookie("refresh_period") <= 10 || !img.classList.contains("connected"))); + let newUrl = await update_img(oldUrl, (getCookie("refresh_period") <= 10 || !img.classList.contains("enabled"))); let newVal = newUrl; img.parentElement.querySelectorAll("[src$=loading\\.svg],[style*=loading\\.svg],[poster$=loading\\.svg]") .forEach((e) => { @@ -387,7 +390,7 @@ document.addEventListener("DOMContentLoaded", () => { clearInterval(refresh_interval); document.getElementById("connection-lost").style.display = "block"; autoplay("stop"); - document.querySelectorAll("img.connected").forEach((i) => { i.classList.remove("connected") }) + document.querySelectorAll("img.refresh_img,video[data-cam='${cam}']").forEach((i) => { i.classList.remove("connected", "enabled") }) document.querySelectorAll(".cam-overlay").forEach((i) => { i.getElementsByClassName("fas")[0].classList.remove("fa-spin"); }) @@ -439,13 +442,15 @@ document.addEventListener("DOMContentLoaded", () => { card.dataset.connected = false; statusIcon.setAttribute("class", "fas") statusIcon.parentElement.title = "" - if (preview) { preview.classList.remove("connected") } + if (preview) { + if (status == "connected") { preview.classList.add("connected") } else { preview.classList.remove("connected") } + if (status == "disabled") { preview.classList.remove("enabled") } else { preview.classList.add("enabled") } + } if (status == "connected") { if (!connected) { sendNotification('Connected', `Connected to ${cam}`, "success"); } card.dataset.connected = true; statusIcon.classList.add("fa-circle-play", "has-text-success"); statusIcon.parentElement.title = "Click/tap to pause"; - if (preview) { preview.classList.add("connected") } autoplay(); let noPreview = card.querySelector('.no-preview') if (noPreview) { diff --git a/app/templates/index.html b/app/templates/index.html index ecc3034b..88eebc14 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -111,7 +111,8 @@ {% if cam_data.cameras %} {% for cam_uri,camera in cam_data.cameras.items() %}
+ data-enabled="{{camera.enabled}}" data-connected="{{camera.connected}}" + data-battery="{{camera.is_battery}}">
@@ -149,6 +150,11 @@ {% endif %} {% endif %} + {% if camera.is_battery %} + + + + {% endif %}