Wyze sense sensor integrations

Yeah I have 3 sensors hooked up (the starter kit). I was seeing some lag when using your container too so it might be something about my hassio setup / machine / the fact that there a bunch of other hubs in proximity to the Wyze hub or something random.

I think you’re right though, it’s not super noticeable unless you’re looking for it

EDIT: I tried the original python app again and I’m seeing the same lag. So its gotta just be my machine.

@dariopb

I’m trying out your docker container with a wyze sense start pack that I’ve never used before.

I’m a bit confused though, how does the rest api work so I can send the command to add new devices?

thanks!

duh feel like and idiot - just found the interface open on 8080

Did you get it to work? Yes, there is an http endpoint listening on port 8080 and when you hit the http://xxxx:8080/sensors/scan endpoint, it will put the dongle in pairing state for 30secs. If you press the button in the sensor during that time you should get back the new paired sensor (the call won’t return during those 30 secs until it pairs or times out).

Yes I got it mostly working once i figured out the port.

I had some issues getting it to log into my mqtt broker, I was running sort of in a test environment at my office so I don’t know if it will translate when I attempt to set up when I get home. I have a 2 brokers bridged to test out something else and was able to use the other broker which has anonymous r/w access.

Seems very responsive, I’ll test some more tomorrow.

Thanks. There was a bug in the code setting the password (thanks @brmo! for spotting it) , that might be the reason you couldn’t connect to your authenticated mqtt broker :(. I fixed it and it should be working now. Please docker pull the image before you try again.

just pulled the new image and now working with the authenticated mqtt broker! Happy this was a bug as I was running out of ideas as to why it wasn’t working!

Thanks for putting this together, it seems to be working very well. have you had any luck getting the device_class into the discovery message?

FWIW I got this working on HASSOS by using the ssh-terminal addon and disabling protection mode. I created a gosenseapp folder with a blank app.yaml file inside my config folder. I then started it from the terminal:

sudo docker run -it --rm --net host -v /mnt/data/supervisor/homeassistant/gosenseapp/app.yaml:/app.yaml --privileged dariob/gosenseapp-pi:latest

once started I can use the portainer addon to restart on config changes etc.

Glad it is working for you!
Yes, device_class is working (next version you’ll be able to configure the class to report for the devices). What I still didn’t get is how to change the icons for the “parameters” (like battery and signal strength)…
I’m looking into making it an add-on as well (reason I didn’t do it yet is because my setup is raw ha, no hassio).

Can’t wait!!! If the sensor will be supported, it means sayonara to Xiaomi gateway/sensors. Thank you for your work!

I think the delay is that the sensor is very sensitive, it shows as closed until the magnet is about an inch away. and will go back to closed as soon as it’s within that range.

That could definitely be it and why opening “seems” to be much slower than closing. Are you seeing that in gosense?

yes this is with gosense.

Eh I think thats still a little faster than the python component. I’ll investigate later today. I’ll probably release it sooner so people can play with.

Alright all here’s the python component: https://github.com/kevinvincent/wyzesense

Please report any issues you run into using the github issue tracker. I’m especially interested if anyone sees an exception at this line in their logs https://github.com/kevinvincent/wyzesense/blob/b9460eb188b06d90a280b1bce0c2038b529ee436/binary_sensor.py#L486

I know its a lot to ask but I’m also interested in having people who have gosense working comparing speeds in sensor updates! Unfortunately both of them cannot be active at once as only one can read and write to the device at once which prevents side by side comparisons.

3 Likes

I will download this and give it a shot.

So I’ve received proof that the python version is slower. The door icon is python and the check mark is gosense. https://photos.app.goo.gl/2uCbeL9FNBMcQ1ZE8

So I think at this point I’m gonna pause development on it since I can’t really figure out why. @dariopb let me know if you need help turning it into an add on. I recently made one like 1 week ago so I’m pretty familiar with it.

Does the camera have to be plugged into the hass computer?

the sense dongle has to be plugged in the the computer/pi running gosense or the python component. no camera needed.

Thank you, that is what I have done and given it similiar permissions to my zwave/zigbee stick. The problem I am running into is my Home Assistant instance is a docker and I am passing the wyze sense hub into the docker container. In my logs I am getting this:

2019-07-20 16:16:33 ERROR (MainThread) [custom_components.wyzesense.binary_sensor] 'NoneType' object is not iterable
Traceback (most recent call last):
  File "/config/custom_components/wyzesense/binary_sensor.py", line 612, in async_setup_platform
    gateway.Start()
  File "/config/custom_components/wyzesense/binary_sensor.py", line 486, in Start
    for x in sensors:
TypeError: 'NoneType' object is not iterable

Ah yes. I just put an updated version on github that avoids that issue. Can you try downloading it again?