Wyze sense sensor integrations

@MediaCowboy That’s great to hear! If you have any issues (after a restart for example) please submit an issue on Github. That shouldn’t happen anymore but just in case haha. I want to get this polished up so I can start the process of submitting it as an official component, your testing was super helpful.

And showing the state as off initially with assumed_state: true is expected behavior. I’ve updated the installation instructions to say this:

Usage
Restart HA and the sensors you have already bound to the hub should show up as off with assumed_state: true and no device_class . This is because the hub will not know the state / type of the sensor until it triggers for the first time. The first time the component hears from the sensor, the state and the rest of the fields such as battery, device class (motion or door), signal strength, etc. will be shown. Icons that depend on the device_class will also automatically update on your UI once this is received.

I hope you enjoy creating automations with these sensors!

1 Like

Looks like running into dependency issue. not sure which package i need to install

 ERROR (MainThread) [homeassistant.loader] Error loading custom_components.wyzesense.binary_sensor. Make sure all dependencies are installedESC[0m
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/loader.py", line 166, in _load_file
    module = importlib.import_module(path)
  File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 673, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/home/homeassistant/.homeassistant/custom_components/wyzesense/binary_sensor.py", line 11, in <module>
    from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorDevice, DEVICE_CLASS_MOTION, DEVICE_CLASS_DOOR
ImportError: cannot import name 'DEVICE_CLASS_MOTION'ESC[0m

It’s still an issue with your version being a little out of date, it looks like that also was added 4 months ago too. This new file basically takes it back to what was available 8 months ago I believe. Try this:

latest…I understand if you don’t want to look into it. I will just try it later with newer version. Thanks again!

 ERROR (MainThread) [homeassistant.components.binary_sensor] Error while setting up platform wyzesenseESC[0m
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py", line 128, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/lib/python3.5/asyncio/tasks.py", line 400, in wait_for
    return fut.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/homeassistant/.homeassistant/custom_components/wyzesense/binary_sensor.py", line 41, in setup_platform
    import wyzesense
ImportError: No module named 'wyzesense'ESC[0m

Haha, yet another recent update. My method of pulling in dependencies was introduced in 0.92.0. I’ve updated the file again. https://gist.github.com/kevinvincent/375a063723ecd8b0b06943e3d28ebc93

It’s my personal mission to get this to work for you. I don’t mind it at all :slight_smile: They’re all one line changes.

Also can you file an github issue if you run into anything more? Just to keep this back and forth off this thread.

@kevinvincent - this looks like great work and I’m eager to try it out!

Would you be willing to support HACS (home assistant community store)? I believe it would only require a minor structure change in your github repo. The benefit is that any new releases are tracked and managed via the HACS component.

https://custom-components.github.io/hacs/developer/integration/

@raff I just want one more confirmation that it’s working for other people and then I’ll definitely get it onto HACS!

1 Like

Looks like success but I’m not home currently so can’t pin/reset the sensor as nothing shows up under Devices as binary_sensor.wyzesense yet. But do see these lines…I’m good to go (until i could reset the
sensor)?

[homeassistant.loader] Loaded wyzesense from custom_components.wyzesense
[homeassistant.loader] Loaded wyzesense.binary_sensor from custom_components.wyzesense.binary_sensor
[homeassistant.components.binary_sensor] Setting up binary_sensor.wyzesense
INFO (Thread-23) [wyzesense.gateway] LOG: time=1969-12-31T18:00:00, data=b'14ff'

Thank you so much!!!

Forgot to say that I need to insert this line below to /etc/udev/rules.d/99-com.rules Otherwise, I keep receiving “Permission denied /dev/hidraw0”

KERNEL=="hidraw*", SUBSYSTEM=="hidraw", MODE="0664", GROUP="homeassistant"

^^^^ Assuming the user belongs to homeassistant group.

@quattro The log messages look good! Be sure that you’re looking for a binary_sensor.6272AAF3 (8 char MAC address) or something like that, not binary_sensor.wyzesense. Each sensor will have an entry like that, but just like any other entity you can change the entity ID and friendly name from the states page to something nicer. It’ll remember that across reboots.
If you’ve previously paired a sensor to it, it should appear in states already without having to re-pair it to the hub! If it doesn’t please let me know.
And interesting that you had to do that. I believe Hassio won’t need that but maybe Hasbian does.

Unfortunately the gateway still does not recognize the door sensor. I tried to reset it a few times, using the provided pin and let the red light blinked 3 times and waited. I monitor the log and nothing pops up. The bridge is plugged into Pi and blue light is lid.

I do not have any Wyze camera.

@quattr0 Just to be sure, you called the service wyzesense.scan before pushing the pin correct? The blue light is a good sign that the component has talked to the bridge. If you want to debug this further please follow “Reporting an issue” here: https://github.com/kevinvincent/wyzesense

@dariopb is there a way to assign a different port for the api than assigning it in my docker-compose.yaml? 8080 is already in use on my system. Is it assignable in the app.yaml?

here’s my docker-compose and I suppose I could just use ports: instead of network_mode:, but are there any other ports I would need to open up that way?

  gosense:
    image: dariob/gosenseapp:latest
    volumes:
      - ${USERDIR}/docker/gosense/app.yaml:/app.yaml
    network_mode: host
    privileged: true
    restart: always
    environment: 
      - PUID=${PUID}
      - PGID=${PGID}
      - TZ=America/Chicago

Hi @atomicpapa, it is not currently configurable (an oversight from my side :frowning:). I have the changes ready to make that configurable (and to set the default to something else than 8080) and some other enhancements (like mapping the device type to whatever you want).
I’ll update the code and images tonight as well as the docs to show docker not using nethosts. BTW, are you using raspberry pi or x86 Linux?

Running on Ubuntu 18.04 on an i7 with 32GB Ram and about 30 other containers lol

Do I need to expose any other ports?

edit: Apparently not. It’s working perfectly!!! I knew it wouldn’t take long for someone to come up with a solution to add these things to Home Assistant! One of my better purchases and I’m glad I jumped in on the pre-purchase!

Success!!! How could i buy your a few beers?

1 Like

Great! Was it just that you had to call wyzesense.scan? And honestly the hard work for this was done by those who reverse engineered the protocol so they deserve it ;). I’m just building a bridge between their code and HA.

Yup, i totally forgot about it.

Hi @raff. Thanks for the link, it is now available on HACS. Just follow the instructions in the README to add it as a custom repository for HACS. https://github.com/kevinvincent/ha-wyzesense

I agree. Remember you need a wyze cam for it to work.