Skip to content

Commit

Permalink
v2.5.3 (#1058)
Browse files Browse the repository at this point in the history
* Format SD Card from command #1053

* missing arm base image

* Update Dockerfile.multiarch

* update workflow

* Update Dockerfile.multiarch

* Update docker-image.yml

* Revert changes to the arm32v7 base image

This reverts commit b7b0eea.

* use static bulma #1054

* MQTT_RETRIES on exception #1047

* Update README.md

* Changelog
  • Loading branch information
mrlt8 authored Dec 4, 2023
1 parent d21641e commit d5e4a28
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 39 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
echo "arch=${{ matrix.dockerfile == 'multiarch' && 'amd64,armhf,aarch64' || 'amd64' }}" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3
with:
platforms: ${{ steps.image_type.outputs.platforms }}

Expand All @@ -57,7 +57,7 @@ jobs:

- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
Expand All @@ -72,7 +72,7 @@ jobs:

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: |
${{ github.repository_owner }}/wyze-bridge
Expand All @@ -98,7 +98,7 @@ jobs:
fi
- name: Build and push a Docker image
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
builder: ${{ steps.buildx.outputs.name }}
context: ./app/
Expand Down
58 changes: 33 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,28 @@ Streams direct from camera without additional bandwidth or subscriptions.

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).


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!

## API Changes

As of July 2023, you will need to update your bridge to v2.3.x or newer for compatibility with the latest changes to the Wyze API.
> [!IMPORTANT]
> As of July 2023, you will need to **update your bridge to v2.3.x or newer** for compatibility with the latest changes to the Wyze API.
![Wyze Cam V1](https://img.shields.io/badge/wyze_v1-yes-success.svg)
![Wyze Cam V2](https://img.shields.io/badge/wyze_v2-yes-success.svg)
![Wyze Cam V3](https://img.shields.io/badge/wyze_v3-yes-success.svg)
![Wyze Cam V3 Pro](https://img.shields.io/badge/wyze_v3_pro-yes-success.svg)
![Wyze Cam Floodlight](https://img.shields.io/badge/wyze_floodlight-yes-success.svg)
![Wyze Cam Pan](https://img.shields.io/badge/wyze_pan-yes-success.svg)
![Wyze Cam Pan V2](https://img.shields.io/badge/wyze_pan_v2-yes-success.svg)
![Wyze Cam Pan V3](https://img.shields.io/badge/wyze_pan_v3-yes-success.svg)
![Wyze Cam Pan Pro](https://img.shields.io/badge/wyze_pan_pro-yes-success.svg)
![Wyze Cam Outdoor](https://img.shields.io/badge/wyze_outdoor-yes-success.svg)
![Wyze Cam Outdoor V2](https://img.shields.io/badge/wyze_outdoor_v2-yes-success.svg)
![Wyze Cam Doorbell](https://img.shields.io/badge/wyze_doorbell-yes-success.svg)
![Wyze Cam Doorbell V2](https://img.shields.io/badge/wyze_doorbell_v2-yes-success.svg)

See the [supported cameras](#supported-cameras) section for additional information.


## Quick Start

Expand All @@ -37,6 +53,12 @@ You can then use the web interface at `http://localhost:5000` where localhost is

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.

## What's Changed in v2.5.3

* FIXED: use static bulma for Pi-Hole compatibility Thanks @MetalliMyers! #1054
* NEW: MQTT/API - Format SD Card using the topic/endpoint `format_sd` Thanks @iferlive! #1053
* NEW: `MQTT_RETRIES` to adjust the number of retires on exception. Defaults to 3 before disabling MQTT. Thanks @rmaes4! #1047

## What's Changed in v2.5.2

* FIX: MQTT Naming Warning in Home Assistant #1046 Thanks @ejpenney!
Expand Down Expand Up @@ -64,25 +86,6 @@ See [basic usage](#basic-usage) for additional information or visit the [wiki pa

## Supported Cameras

![Wyze Cam V1](https://img.shields.io/badge/wyze_v1-yes-success.svg)
![Wyze Cam V2](https://img.shields.io/badge/wyze_v2-yes-success.svg)
![Wyze Cam V3](https://img.shields.io/badge/wyze_v3-yes-success.svg)
![Wyze Cam V3 Pro](https://img.shields.io/badge/wyze_v3_pro-yes-success.svg)
![Wyze Cam Floodlight](https://img.shields.io/badge/wyze_floodlight-yes-success.svg)
![Wyze Cam Pan](https://img.shields.io/badge/wyze_pan-yes-success.svg)
![Wyze Cam Pan V2](https://img.shields.io/badge/wyze_pan_v2-yes-success.svg)
![Wyze Cam Pan V3](https://img.shields.io/badge/wyze_pan_v3-yes-success.svg)
![Wyze Cam Pan Pro](https://img.shields.io/badge/wyze_pan_pro-yes-success.svg)
![Wyze Cam Outdoor](https://img.shields.io/badge/wyze_outdoor-yes-success.svg)
![Wyze Cam Outdoor V2](https://img.shields.io/badge/wyze_outdoor_v2-yes-success.svg)
![Wyze Cam Doorbell](https://img.shields.io/badge/wyze_doorbell-yes-success.svg)
![Wyze Cam Doorbell V2](https://img.shields.io/badge/wyze_doorbell_v2-yes-success.svg)

Cameras from [Gwell Times](http://cloud.gwell.cc) are currently not supported:

![Wyze Cam Doorbell Pro](https://img.shields.io/badge/wyze_doorbell_pro-no-inactive.svg)
![Wyze Cam OG](https://img.shields.io/badge/wyze_og-no-inactive.svg)
![Wyze Cam OG 3x](https://img.shields.io/badge/wyze_og_3x-no-inactive.svg)

| Camera | Model | Tutk Support | Latest FW |
| ----------------------------- | -------------- | ------------------------------------------------------------ | --------- |
Expand Down Expand Up @@ -128,22 +131,27 @@ The container can be run on its own, in [Portainer](https://github.com/mrlt8/doc

### Ubiquiti Unifi

Some network adjustments may be needed - see [this discussion](https://github.com/mrlt8/docker-wyze-bridge/discussions/891) for more information.
> [!NOTE]
> Some network adjustments may be needed - see [this discussion](https://github.com/mrlt8/docker-wyze-bridge/discussions/891) for more information.
## Basic Usage

### docker-compose (recommended)

This is similar to the docker run command, but will save all your options in a yaml file.
(If your credentials have special characters, you must escape them)

1. Install [Docker Compose](https://docs.docker.com/compose/install/).
2. Use the [sample](https://raw.githubusercontent.com/mrlt8/docker-wyze-bridge/main/docker-compose.sample.yml) as a guide to create a `docker-compose.yml` file with your wyze credentials.
3. Run `docker-compose up`.

Once you're happy with your config you can use `docker-compose up -d` to run it in detached mode.

NOTE: You may need to [update the WebUI links](https://github.com/mrlt8/docker-wyze-bridge/wiki/WebUI#custom-ports) if you're changing the ports or using a reverse proxy.
> [!CAUTION]
> If your credentials have special characters, you must escape them or leave your credentials blank and use the webUI to login.
> [!NOTE]
> You may need to [update the WebUI links](https://github.com/mrlt8/docker-wyze-bridge/wiki/WebUI#custom-ports) if you're changing the ports or using a reverse proxy.

#### Updating your container

Expand Down
6 changes: 6 additions & 0 deletions app/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## What's Changed in v2.5.3

* FIXED: use static bulma for Pi-Hole compatibility Thanks @MetalliMyers! #1054
* NEW: MQTT/API - Format SD Card using the topic/endpoint `format_sd` Thanks @iferlive! #1053
* NEW: `MQTT_RETRIES` to adjust the number of retires on exception. Defaults to 3 before disabling MQTT. Thanks @rmaes4! #1047

## What's Changed in v2.5.2

* FIX: MQTT Naming Warning in Home Assistant #1046 Thanks @ejpenney!
Expand Down
6 changes: 6 additions & 0 deletions app/static/bulma-toast.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/static/bulma.css

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions app/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Wyze-Bridge</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/css/bulma.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css" />
<link rel="stylesheet" href="{{ 'static/bulma.css' if hass else url_for('static',filename='bulma.css') }}" />
<link rel="stylesheet" href="{{ 'static/site.css' if hass else url_for('static',filename='site.css') }}" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css" />
{% block stylesheet %}
{% endblock %}
</head>
Expand All @@ -32,7 +32,7 @@
</p>
</div>
</footer>
<script src="https://cdn.jsdelivr.net/npm/bulma-toast@2.4.2/dist/bulma-toast.min.js"></script>
<script src="{{ 'static/bulma-toast.js' if hass else url_for('static',filename='bulma-toast.js') }}"></script>
{% block javascript %}
{% endblock %}
</body>
Expand Down
21 changes: 14 additions & 7 deletions app/wyzebridge/mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from functools import wraps
from os import getenv
from socket import gaierror
from time import sleep
from typing import Optional

import paho.mqtt.client
Expand All @@ -16,6 +17,7 @@
MQTT_ENABLED = bool(env_bool("MQTT_HOST"))
MQTT_USER, _, MQTT_PASS = getenv("MQTT_AUTH", ":").partition(":")
MQTT_HOST, _, MQTT_PORT = getenv("MQTT_HOST", ":").partition(":")
RETRIES = int(getenv("MQTT_RETRIES", "3"))


def mqtt_enabled(func):
Expand All @@ -24,13 +26,18 @@ def wrapper(*args, **kwargs):
global MQTT_ENABLED
if not MQTT_ENABLED:
return
try:
return func(*args, **kwargs)
except (ConnectionRefusedError, TimeoutError, gaierror) as ex:
logger.error(f"[MQTT] {ex}. Disabling MQTT.")
MQTT_ENABLED = False
except Exception as ex:
logger.error(f"[MQTT] {ex}")

for retry in range(1, RETRIES + 1):
try:
return func(*args, **kwargs)
except (ConnectionRefusedError, TimeoutError, gaierror) as ex:
logger.error(f"[MQTT] {ex}. Retrying {retry}/{RETRIES}...")
except Exception as ex:
logger.error(f"[MQTT] {ex}")
sleep(1)

logger.error(f"[MQTT] {RETRIES}/{RETRIES} retries failed. Disabling MQTT.")
MQTT_ENABLED = False

return wrapper

Expand Down
1 change: 1 addition & 0 deletions app/wyzebridge/wyze_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"quick_response": "K11635ResponseQuickMessage",
"spotlight": "K10646SetSpotlightStatus",
"floodlight": "K12060SetFloodLightSwitch",
"format_sd" : "K10242FormatSDCard",
}

CMD_VALUES = {
Expand Down
12 changes: 12 additions & 0 deletions app/wyzecam/tutk/tutk_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -838,6 +838,18 @@ def __init__(self):

def encode(self) -> bytes:
return encode(self.code, bytes([0, 1, 0, 0, 0]))

class K10242FormatSDCard(TutkWyzeProtocolMessage):
"""
Format SD Card.
Parameters:
- value (int): 1 to confirm format.
"""

def __init__(self, value: int = 0):
super().__init__(10242)
assert value == 1, "value must be 1 to confirm format!"


class K10444SetDeviceState(TutkWyzeProtocolMessage):
Expand Down

0 comments on commit d5e4a28

Please sign in to comment.