You said:
I would say, it works (almost).It
Works perfectly
The svalue is in this case a fixed value of "0", which means "normal" .
See: https://piandmore.wordpress.com/2019/02 ... -domoticz/
So regardless of the "Humidity" in percent the environmental level is always normal.lv is the environment level which can have the following values:
0, normal
1, comfortable
2, dry
3, wet
About 5 years ago I created a kind of model for all weather sensors, which I recently updated to support newer Node-RED versions:
See: viewtopic.php?p=263147&hilit=weather#p263147 My post 09 Dec 2020, 16:57.
And also: viewtopic.php?p=323593&hilit=weather#p323593 My post 12 Feb 2025, 19:13
If you want to use that function, you should change the code in the "Function" node into the following:
Code: Select all
let hum_stat;
function comfortlevel(hum) {
switch (true) {
case hum > 70: { hum_stat = 3 } break;
case hum < 30: { hum_stat = 2 } break;
case hum >= 30 && hum <= 45: { hum_stat = 0 } break;
case hum > 45 && hum <= 70: { hum_stat = 1 } break;
default: { hum_stat = 0 } break;
}
return hum_stat;
}
let hu = msg.payload.humidity / 10;
let lv = comfortlevel(hu).toString();
msg.payload = { "command": "udevice", "idx": 1234, "nvalue":parseInt(hu), "svalue": lv};
return msg;
Regards