The image at the bottom of this post shows how this is structured. The basis is a working Domoticz - Mosquitto - NodeRED installation with Sensibo API access. Also a dummy temperature/humidity sensor per sensibo controller is needed.
How does the solution work?
- First, the Node-RED node node-red-contrib-sensibo must be added to Node-RED (manage palette).
- A flow must be created with the following elements:
- an inject / timestamp block
- a "sensibo in" block per sensibo
- a function block
- a mqtt out block
- a debug block for testing
The inject/timestamp block is simple. An interval every 10/15 minutes or so.
The sensibo in is also simple. The api-key and the key/name of the device (if more then one).
The function/extract data block does the magic.
Code: Select all
var TEMP = msg.result.measurements.temperature;
var HUM = msg.result.measurements.humidity;
var HUM_STAT=0;
if (HUM < 30) {
HUM_STAT=2;
} else if ((HUM >= 30) & (HUM < 45)) {
HUM_STAT=0;
} else if ((HUM >= 45) & (HUM < 70)) {
HUM_STAT=1;
} else if (HUM >= 70) {
HUM_STAT=3;
}
msg.payload = {"command":"udevice","idx":3510,"nvalue":0,"svalue":TEMP + ";" + HUM + ";" + HUM_STAT};
return msg;
The MQTT/IN, named "publish temp" is the domoticz/in MQTT channel
The debug block is useful to turn debugging on / off and see what the output is.
There is also a "Sensibo send" block. I have not yet been able to find information on how that is working. Constructing the message looks a bit complicatied.