Switch SmartPlug according to Humidity

A conditional in the change node should get you true/false output based on humdity value. This uses a JSONata expression, you could do similar in a function node
e.g.

[{"id":"c202f2f3.ee146","type":"inject","z":"8d22ae29.7df6d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"35","payloadType":"num","x":160,"y":2400,"wires":[["e55b031e.79888"]]},{"id":"1c9ac260.e6e08e","type":"inject","z":"8d22ae29.7df6d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"40","payloadType":"num","x":160,"y":2460,"wires":[["e55b031e.79888"]]},{"id":"e55b031e.79888","type":"change","z":"8d22ae29.7df6d","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload < 40 ? true : false","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":320,"y":2420,"wires":[["1cd6b62b.b27a2a"]]},{"id":"1cd6b62b.b27a2a","type":"rbe","z":"8d22ae29.7df6d","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":500,"y":2420,"wires":[["c7a8c472.018348"]]},{"id":"c7a8c472.018348","type":"debug","z":"8d22ae29.7df6d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":580,"y":2320,"wires":[]}]

I also added a rbe node, so to filter out repeated trues and falses.

1 Like