Could someone please let me know how to properly setup a listener for the deconz events:
That is what I tried without success:
This is correct. If you don’t see any events appearing than your device doesn’t raise any event on the event bus.
Thanks very much for your reply.
I have several Xiaomi devices which properly reporting their states using deconz integration with home assistant.
According to my research in order to build an automation using Xiaomi Vibration sensor, I need to use deconz_event.
I know that I am getting the events from deconz because I see them in homeassistant.log:
019-09-02 20:45:19 DEBUG (MainThread) [pydeconz.websocket] Websocket data: {"e":"changed","id":"19","r":"sensors","state":{"lastupdated":"2019-09-03T00:45:19","orientation":[1,0,89],"tiltangle":360,"vibration":true,"vibrationstrength":88},"t":"event","uniqueid":"00:15:8d:00:02:c3:a8:21-01-0101"}
2019-09-02 20:45:32 DEBUG (MainThread) [pydeconz.websocket] Websocket data: {"e":"changed","id":"22","r":"sensors","state":{"lastupdated":"2019-09-03T00:45:32","open":true},"t":"event","uniqueid":"00:15:8d:00:03:1b:36:e5-01-0006"}
But I don’t get any deconz_event(s).
Someone on discord mentioned that deconz websocket port needs to be properly setup on home assistant side, but I am not sure how that can be done.
Could you please point me in a right direction?
I have this sensor and I got it work some time ago. I’m on holiday this week so I can’t check, but have you read this topic? Maybe it helps. Next week I can check it out for you if you can’t find a solution.
Thank you very much. I am looking forward to hear from you soon.
Enjoy your vacation.
I did look at this sensor and just to clarify I have this type of Xiaomi Aquara Vibration sensor:
I used it long time ago and I remember I did it via events as you mentioned. However now what I can see in the latest ConBee firmware 2.05.69 is that it shows up as a binary_sensor
so it’s very easy to use in any automation.
Default state is off
but as soon as I touch it changes to on
for approximately half a minute.
It has also many attributes:
on: true
temperature: 28
orientation: 2,-1,88
tiltangle: 175
vibrationstrength: 19
friendly_name: Vibration Sensor
device_class: motion
You may set up an automation looking for the state change.
Or if you need an automation based on it’s attribute you can proceed like this:
- alias: Vibration Sensor Temperature is less than 25
trigger:
platform: template
value_template: "{{ state_attr('binary_sensor.vibration_15', 'temperature') < 25 | int }}"
condition:
...
Thanks for your response.
I am trying to come up with “Dryer Off” automation using this sensor.
I am not sure how to set it up because the sensor resets quickly to ‘off’ even when vibration that triggered the ‘on’ state continues.
The vibrationstrength attribute does not seem to update in any consistent matter to be used as an indicator that the vibration that triggered the ‘on’ state is still present.
Any help will be greatly appreciated. Thank you.