The result so far. This is my flow:
A little explanation might be handy:
- On the left the websocket binding. Here you should fill in the IP of the Deconz RPI.
- Then the conversion to a JSON object.
- Then multiple switches, based on the existence of various keys we can identify what kind of sensor is submitting the event.
- The function element generates the MQTT topic and converts the value to preferred HA state, for example, motion sensors should be ON while motion and OFF while no motion. This was a little bit weird. At first I used the HA rest-api to set the sensor. Because this meant I had to create all sensors in HA and Node-red I switched to MQTT. However, the HA rest api accepts “on” and “off” while the MQTT sensor wants “ON” and “OFF” in order to work
- At last publishing the message to the broker.
One thing I should add, is filtering on the input to process only events with changed states. The events with new device added or sensor x is reachable should be ignored.
I’m posting this because one might find it handy. Switches and Motion sensors are working and have been tested. Light sensors and open close sensors will arrive soon
(The debugging elements can be removed. I kept them because they provide some nice info.)