Giter VIP home page Giter VIP logo

wz_mini_hacks-mqtt's Introduction

Adding MQTT Status and Control Integration to a wz_mini_hack Installed Camera

This project adds Home Assistant integration via MQTT to Wyze Cam V3.

Wyze Cam V3

The Wyze Cam V3 is an inexpensive and pretty capable little IP camera. Of course Wyze would have you sign up for a monthly subscription in order to be able to fully utilitize the camera. However, with the wz_mini_hacks project, you are able to add RTSP video streaming capabilities that can be constrained to your local network. Using a free network video recorder such as Frigate, you can record as much video has you have storage space. While the Wyze Cam V3 has motion and basic object detection capabilities, once you have local RTSP streaming enabled, you can essentially disable those device features, and leverage the more powerful equivalents through Frigate.

The Xiaomi-Dafang-Hacks project added a comprehensive set of new capabilities via a firmware replacement for the older Wyze Cam V2 (Ingenic T20) models. What was great about this project was the Home Assistant integration via MQTT it provided. Unfortunately the Dafang-Hacks isn't compatible with the new Ingenic T31 based cameras such as the Wyze Cam V3. This project aims to provide the same Home Assistant MQTT integration to the V3 using the Dafang-Hacks project as inspiration.

Home Assistant device Controls Home Assistant device Diagnostic

Prerequisites

  1. wz_mini_hacks project installed to a Wyze Cam V3 and completely setup so that it has wireless networking configured so you can ssh to the device.
  2. Make sure you have defined CUSTOM_HOMENAME in /opt/wz_mini/wz_mini.conf (on camera)

Steps

  1. Determine the IP of the camera and verify that you can open a secure shell (ssh). Generally a good idea to ensure that this IP remains stable (either statically assigned or permanent DHCP lease)
  2. Download this project and make your personal modifications to mosquitto.conf
  3. Run install.sh <camera-ip>. This script will upload the MQTT client and custom Home Assistant integration scripts and binaries to the camera and run a camera-local setup script. The camera will automatically reboot when complete.
  4. Verify you can see new MQTT messages on the broker.
  5. Verify you can see a new camera device in Home Assistant. During the boot process, the camera will send Home Assistant compatible MQTT auto-discovery messages so that the camera should appear immediately in Home Assistant (under Settings > Devices).

Usage

The base topic name is:

(mosquitto.conf:MQTT_HA_TOPIC_BASE)/camera/(wz_mini.conf:CUSTOM_HOSTNAME)/(see below)

For example:

homeassistant/camera/wyzec3_838c

Simply, to read state (MQTT subscribe):

[base topic]/some-feature/optional-sub-feature

To write state update (MQTT publish):

[base topic]/some-feature/optional-sub-feature/set

Reading camera configuration supported features:

    /osd_time -> ON|OFF
    /leds/indicator -> ON|OFF
    /night_mode  -> ON|OFF
    /night_mode/auto -> ON|OFF
    /night_mode/early_activation -> ON|OFF
    /leds/ir_near -> ON|OFF
    /leds/ir_far -> ON|OFF
    /flip_vert -> ON|OFF
    /flip_horz -> ON|OFF
    /refresh_rate -> [integer]
    /rtsp_server/port -> [integer]
    /rtsp_server/authentication -> ON|OFF
    /rtsp_server/channel1 -> ON|OFF
    /rtsp_server/channel1/audio -> ON|OFF
    /rtsp_server/channel1/fps -> [integer]
    /rtsp_server/channel1/url -> [url]
    /rtsp_server/channel2 -> ON|OFF
    /rtsp_server/channel2/audio -> ON|OFF
    /rtsp_server/channel2/fps -> [integer]
    /rtsp_server/channel2/url -> [url]
    /rtsp_server/channel1/bitrate_max -> [integer]
    /rtsp_server/channel2/bitrate_max -> [integer]
    /rtsp_server/channel1/bitrate_target -> [integer]
    /rtsp_server/channel2/bitrate_target -> [integer]
    /rtsp_server/channel1/enc_params -> [string]
    /rtsp_server/channel2/enc_params -> [string]
    /web_console -> ON|OFF
    /web_console/available -> ON|OFF  (if httpd is running)

    /status --> [JSON string]
            {
            "last_boot": "2022-11-10 21:10:43",
            "ts": "2022-11-12T02:00:45+00:00",
            "ip": "10.0.0.172",
            "link_quality": 79,
            "signal_level": 60,
            "noise_level": 0,
            "bit_rate": "72.2 Mb/s",
            "device": {
                "name": "wyzec3_838c",
                "identifiers": "D0:3F:27:5D:83:8C",
                "mf": "Wyze",
                "mdl": "WYZE_CAKP2JFUS",
                "sw": "4.36.9.139"
            }}

Writing camera configuration supported features:

    /leds/indicator/set ON|OFF
    /osd_time/set ON|OFF
    /night_mode/set ON|OFF
    /night_mode/auto/set ON|OFF
    /night_mode/early_activation/set ON|OFF
    /leds/ir_near/set ON|OFF
    /leds/ir_far/set ON|OFF
    /flip_vert/set ON|OFF
    /flip_horz/set ON|OFF
    /play [filename.wav] [volume_1-100]
    /web_console/set ON|true|OFF|false
    /refresh_rate/set [integer]

With the exception of playing a sound, updating the refresh rate and enabling or disabling the web console, ALL other changes in state require that the camera be rebooted before the change takes effect. This reboot is automatically done, but it does mean there is usually at least 5 seconds before the update takes effect. It also means that multiple update requests need to be spaced out with an appropriate delay to allow the camera to recycle before being able to accept the next request. Not ideal, but due to the limitations of the wz_mini_hack, the best we can do for now.

To access other, less frequently used configuration parameters, enable the web_console (starts httpd, port 80), added by the wz_mini_hacks project. This provides access to a rudimentary form via the browser for modifying all the configuration parameters. It also needs to reboot the camera to have the changes applied. Since the web console is not secured (no authentication options), generally keep it disabled and use MQTT instead (assuming the broker has been secured).

wz_mini_hacks-mqtt's People

Contributors

falaca avatar g8keeperzuul avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

wz_mini_hacks-mqtt's Issues

MQTT Reboot

Installed as per instructions.

Every time I change a setting via MQTT on Home Assistant, the camera reboots.

Tell me what you need to help understand this issue and I'll do my best to provide.

Thanks in advance.

Pan Movement Support

Receive a warm thank you from South America for sharing this project.
I will try to install it this weekend on my Pan v2.

Do you think there is any chance that the cmd move command to be supported as a sensor and command endpoint?

It would be ideal to have a sensor reporting the X and Y position of a PAN camera that can be obtained by issuing the cmd move command.

Then an MQTT message could be sent with the desired coordinates to trigger the cmd move <x> <y> command. something like /move/set x_y

image
This is an example output for the cmd move command that would be used to get the current camera position.

image
This is an example of an error (this or the command hangs), this happens if ranges are exceeded. Limits are not implemented yet on wz_mini, but they are 0 and 350 for and 0 and 40 for

And this is an example of a successful position adjustment using the command.
image

My desired use case is to point the camera at different locations based on sensor input, i.e: front door is opened -> aim to front door.

Thank you!

Error to move files to cam with ssh

I have configured the wz_mini and I can access ssh without problems. When i want to use the mqtt i get the following warning: "scp: Connection closed" so the configuration is not finished. Then, when I want to put the ssh manually I get the following error: "/opt/wz_mini/bin/dbclient: Warning: failed creating //.ssh: Read-only file system" and later: "Connection to [email protected]:xx exited: No auth methods could be used.
lost connection"
any ideas?

Enable Siren or play audio through HomeAssistant

From the info page:
"With the exception of playing a sound, updating the refresh rate and enabling or disabling the web console, ALL other changes in state require that the camera be rebooted before the change takes effect. "

Can a sound or the siren be enabled through this mqtt integration with HomeAssistant? I'd love to incorporate automations using frigate for person detection in a zone and play the siren or some other audio. If it is possible, how can it be done? Would HomeAssistant see it as a media player?

Motion detection support

There is a command called waitMotion which will wait for a bit of time and then if motion is detected, will return that motion info.

To support motion via MQTT another daemon could be created which listens for motion and sets the motion on / off

MQTT on forked project not working but work if tweaking g8keeperzuul installer to support SSH key with wyze cam V3

1st thing 1st thanks for your amazing work,
Here is my current issue :
i've figured to make this project work with openssh key auth cherry picking and tweaking installer from fork project https://github.com/bittles/wz-mini-hacks-mqtt-fork/
Since i would recommend to implement it in yours because this is the only way to use it with wzminihacks on wyze cam v3 since ssh key auth is mandatory, i also wish someone could help me to make it work with additional features that have been added in the bittles project https://github.com/bittles/wz-mini-hacks-mqtt-fork ...In fact i didnt understand where is the main difference that make this other project not being able to push mqtt command correctly even if status information seems to be collected correctly ...I know this concern another projet / repo but maybe someone way smarter than me could make it work or those cool additionals features (such as motion detection enabling / disabling option) could be implement in the https://github.com/g8keeperzuul/wz_mini_hacks-MQTT project...
Thanks a lot for any help that could make it happen , it will be greatly appreciated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.