kevinvincent / ha-wyzesense

A Home Assistant Component to interface with the WYZE Sense hub and sensor system
368 stars 97 forks source link

No Longer Maintained

Hi all, I'm unable to maintain this component anymore due to time constraints. Unfortunately, there is a fatal issue with these sensors that has appeared over the year. They can die permanently if the battery gets too low, https://twitter.com/WyzeCam/status/1321147804610252800. Wyze is no longer selling wyze sense v1. If and when new sensors come out, I will try to create a component for those. Apologies to all who have bought these sensors, it seems like the sensors themselves are flawed, leading to a ton of issues after a year, and this component can't do much about it.

I recommend upvoting this thread on the wyze forums so that wyze knows we want an official wyzesense integration: https://forums.wyzecam.com/t/home-assistant-integration/3971

Home Assistant - WYZE Sense Component

Special thanks to HcLX and his work on WyzeSensePy which is the core of this component. His reverse engineering talents and development of WyzeSensePy made it quite easy to connect with WYZE sense devices.

Are you a visual person? Here's a video walkthrough of the setup and configuration. Check this README for the most up to date information.

WARNING: This component does not work on Mac OSX, Synology DSM, or other OSs that don't have hidraw drivers.

Installation (HACS) - Highly Recommended

  1. Have HACS installed, this will allow you to easily update
  2. Add https://github.com/kevinvincent/ha-wyzesense as a custom repository as Type: Integration
  3. Click install under "Wyze Sense Component", restart your instance. NOTE: You must have the Wyze Sense Hub removed from you device before installing the Wyze Sense Component and restarting your instance. If not, the setup may fail.
  4. Plug in the Wyze Sense Hub (the usb device) into an open port on your device.

Installation (Manual)

  1. Download this repository as a ZIP (green button, top right) and unzip the archive
  2. Copy /custom_components/wyzesense to your <config_dir>/custom_components/ directory
    • You will need to create the custom_components folder if it does not exist
    • On Hassio the final location will be /config/custom_components/wyzesense
    • On Hassbian the final location will be /home/homeassistant/.homeassistant/custom_components/wyzesense
  3. Plug in the WYZE Sense hub (the usb device) into an open port on your device.

Configuration

Add the following to your configuration file and restart Home Assistant to load the configuration

The custom_component will use the contents of /sys/class/hidraw to determine which hidraw device is the Wyze receiver dongle.

binary_sensor:
  - platform: wyzesense
    device: auto

Advanced Configuration

Specify hidraw device

You can also optionally specify the hidraw device to use:

binary_sensor:
  - platform: wyzesense
    device: "/dev/hidraw0"

Most likely your device will be mounted to /dev/hidraw0. You can confirm the hidraw name of the device by running dmesg | grep hidraw to find out what hidraw number the bridge grabbed. Be aware that sometimes on restarts the hidraw device number will change. You can permanently fix the name (ex. as '/dev/wyzesense' in order to passthrough in Docker) by following the simple steps in this comment

Set initial states for sensors

By default, the component will restore the last state of the entity prior to a restart. If sensors change state during a restart, the change may not be reflected in HA. In order to combat this you can optionally specify an initial_state for sensors (by mac address) that will be set upon a restart. Be sure to put quotes around "on" or "off" so that they are strings not booleans.

binary_sensor:
  - platform: wyzesense
    device: "/dev/hidraw0"
    initial_state:
      77793176: "on"
      77793193: "off"

Usage

Services

For all services a persistent notification will be sent for both successes and failures.

wyzesense.scan

wyzesense.remove

Troubleshooting