Coder Social home page Coder Social logo

ha-wyzesense's Introduction

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

  • Call the services below to add and remove sensors from your WYZE Sense hub.

  • If you have already bound sensors to the hub (for example using the Wyze Cam and Wyze App), they will be automatically added when the sensor is first triggered.

  • Entities will show up as binary_sensor.wyzesense_<MAC> for example (binary_sensor.wyzesense_777A4656).

    • As like any other entity you can change the entity id and friendly name from the states page, which will stick even after restarts.
  • Notes on Individual Sensors

    • Motion
      • State on: Motion Detected
      • State off: No Motion Detected
      • Wyze motion sensors will keep reporting the on state for 40 seconds after the last motion is detected. This is non configurable, but in practice it isn't a big deal and usually makes automations simpler.
    • Door
      • State on: Sensor open
      • State off: Sensor closed
      • Wyze door sensors will report off when the magnetized portion is within ~1 inch of the door sensor body.
  • Notes on selected Sensor Attributes:

    • rssi: This stands for received signal strength indicator. Higher values (closer to 0) mean a stronger signal.
    • battery_level: The sensor does a basic calculation with the battery voltage. Because of this, battery percentage may be higher than 100% when you first get a sensor. Enjoy the longer battery life :)

Services

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

wyzesense.scan

  • Call this service and then within 30 seconds, insert a pin into the hole on the side of a sensor and push until the red led flashes three times. The sensor will now be bound and show up in your entities. You will have to call this service once at a time for each sensor you want to add.

wyzesense.remove

  • Removes a sensor. Make sure you call this service with the correct MAC address of the sensor (which is the string of numbers and possibly letters that looks like 777A4656). You can find this in the entity's attributes in the developer section.

Troubleshooting

  • Passing dongle hidraw device into Docker:
  • Permission denied /dev/hidraw0
    • Additional Information
      • If you see this error on a Hassio installation please follow Reporting an Issue below. It is most likely an issue with your specific setup.
      • This is known to occur on Hassbian. This occurs when the group homeassistant is denied from accessing hidraw devices.
    • Solution
      • Create / Modify the file /etc/udev/rules.d/99-com.rules on your machine and insert KERNEL=="hidraw*", SUBSYSTEM=="hidraw", MODE="0666"
      • Restart your machine
  • TimeoutError: _DoCommand
    • Ensure that you have updated to the latest component code. If you still see this error follow Reporting an Issue below.

Reporting an Issue

  1. Setup your logger to print debug messages for this component using:
logger:
  default: info
  logs:
    custom_components.wyzesense: debug
    wyzesense.gateway: debug
  1. Restart HA
  2. Verify you're still having the issue
  3. File an issue in this Github Repository containing your HA log (Developer section > Info > Load Full Home Assistant Log)
    • You can paste your log file at pastebin https://pastebin.com/ and submit a link.
    • Please include details about your setup (Pi, NUC, etc, docker?, HASSOS?)
    • The log file can also be found at /<config_dir>/home-assistant.log

ha-wyzesense's People

Contributors

kevinvincent avatar photinus avatar skilau avatar iiaironwolf avatar bradynpoulsen avatar daveenguyen avatar elahd avatar mediacowboy avatar tomhoover avatar

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.