Can someone help me with the issue below that I can’t seem to resolve?
I am using the NRGwatch add-on print for the ITHO mv, and I have added it to Homey following the instructions. This reads the following values through an MQTT Hub device and adds a dim function:
{
"dim": {
"capability": "dim",
"stateTopic": "itho/state",
"setTopic": "itho/cmd",
"valueTemplate": "round((value / 255) * 100)",
"outputTemplate": "round((value / 100) * 255)",
"displayName": "Dim level"
},
"measure_temperature": {
"capability": "measure_temperature",
"stateTopic": "itho/ithostatus",
"setTopic": "",
"valueTemplate": "$['temp']",
"outputTemplate": "",
"displayName": "Temperature"
},
"measure_humidity": {
"capability": "measure_humidity",
"stateTopic": "itho/ithostatus",
"setTopic": "",
"valueTemplate": "$['hum']",
"outputTemplate": "",
"displayName": "Humidity"
}
}
However, now I would like the button to function in Homey as an on/off switch. So when the button is on, the ventilation turns on, and when off, it turns off. Presets for this are available in the add-on print. The latter works, but when turned on, the status is not remembered. So, if I turn it on, the button lights up, but after a few seconds, it goes off again. If I then turn it on again, it stays on.
Now, I would like the on/off button to display the status as on when it is greater than 0 and off when it is exactly 0. In the example below, I am currently using the value of 220, but it seems not to work correctly. Perhaps the value itho/state = 220 is coming in too late. No idea.
Hopefully, someone can tell me how to achieve this and explain what I am doing wrong.
{
"dim": {
"capability": "dim",
"stateTopic": "itho/state",
"setTopic": "itho/cmd",
"valueTemplate": "round((value / 255) * 100)",
"outputTemplate": "round((value / 100) * 255)",
"displayName": "Dim level"
},
"measure_temperature": {
"capability": "measure_temperature",
"stateTopic": "itho/ithostatus",
"setTopic": "",
"valueTemplate": "$['temp']",
"outputTemplate": "",
"displayName": "Temperature"
},
"measure_humidity": {
"capability": "measure_humidity",
"stateTopic": "itho/ithostatus",
"setTopic": "",
"valueTemplate": "$['hum']",
"outputTemplate": "",
"displayName": "Humidity"
},
"onoff": {
"capability": "onoff",
"stateTopic": "itho/state",
"setTopic": "itho/cmd",
"valueTemplate": "value == '220' ",
"outputTemplate": "value ? '220' : '0' ",
"displayName": "Turned on"
}
}