Multiple inputs with external conditions from Home-Assistant

Hi all,

I read nearly every article and the Node-Red Primer (here) to figure out how to accomplish my node setup. Following requirements:

  • interval every 2hours turn on this switch - with a delay of 30min turn it off (working)
  • skip the switch turn on action if humidity is below 80%
  • thus those two inputs to be joined and contents compared with a function

here is my current not working code with kind request for your help:

[{"id":"aec813ed.ae5","type":"inject","z":"e3e1d3c0.6b18","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"3600","crontab":"","once":true,"onceDelay":"","topic":"","payload":"","payloadType":"date","x":170,"y":660,"wires":[["ab666945.3b5c68"]]},{"id":"4457999e.bcd758","type":"delay","z":"e3e1d3c0.6b18","name":"","pauseType":"delay","timeout":"15","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":710,"y":560,"wires":[["e9f35c06.ef52f"]]},{"id":"e9f35c06.ef52f","type":"api-call-service","z":"e3e1d3c0.6b18","name":"","server":"2c3f285.7dce7d8","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.luftung_bad","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":990,"y":560,"wires":[["133b3eb2.6309c1"]]},{"id":"e0e6509a.a4a18","type":"api-call-service","z":"e3e1d3c0.6b18","name":"","server":"2c3f285.7dce7d8","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.luftung_bad","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1170,"y":740,"wires":[[]]},{"id":"ab666945.3b5c68","type":"time-range-switch","z":"e3e1d3c0.6b18","name":"","lat":"50.93333","lon":"6.95","startTime":"sunriseEnd","endTime":"00:00","startOffset":0,"endOffset":0,"x":350,"y":660,"wires":[["4457999e.bcd758","8be66078.37f18"],[]]},{"id":"133b3eb2.6309c1","type":"debug","z":"e3e1d3c0.6b18","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1230,"y":560,"wires":[]},{"id":"e85a6f2.8c2919","type":"poll-state","z":"e3e1d3c0.6b18","name":"","server":"2c3f285.7dce7d8","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"updateinterval":"60","updateIntervalUnits":"seconds","outputinitially":false,"outputonchanged":false,"entity_id":"sensor.lywsd03mmc_humidity_kleines_bad","state_type":"str","halt_if":"80","halt_if_type":"num","halt_if_compare":"gt","outputs":2,"x":300,"y":760,"wires":[["3bda4ff1.27158","e6b66866.3640b8"],[]]},{"id":"5d701db5.14fd14","type":"function","z":"e3e1d3c0.6b18","name":"","func":"if (msg.payload1 === \"true\" && msg.payload2 == \"true\") {\n    msg.payload = true;\n}\n\nelse {\n    msg.payload = false;\n}\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":800,"y":700,"wires":[["16eb6d5b.5513e3","64541d80.bccbe4"]]},{"id":"dc66e6f5.42a418","type":"comment","z":"e3e1d3c0.6b18","name":"Multiple Inputs / Conditions","info":"You can have multiple inputs into a function node BUT each one will run separately. If you need data fron the other one, you will need to join them together before sending to the function node.","x":320,"y":580,"wires":[]},{"id":"e6b66866.3640b8","type":"change","z":"e3e1d3c0.6b18","name":"","rules":[{"t":"set","p":"payload2","pt":"msg","to":"true","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":720,"wires":[["5d701db5.14fd14","799c678c.1257a8"]]},{"id":"8be66078.37f18","type":"change","z":"e3e1d3c0.6b18","name":"","rules":[{"t":"set","p":"payload1","pt":"msg","to":"true","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":660,"wires":[["5d701db5.14fd14","91d0e013.26e44"]]},{"id":"16eb6d5b.5513e3","type":"debug","z":"e3e1d3c0.6b18","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":850,"y":640,"wires":[]},{"id":"91d0e013.26e44","type":"debug","z":"e3e1d3c0.6b18","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload1","targetType":"msg","statusVal":"","statusType":"auto","x":660,"y":620,"wires":[]},{"id":"799c678c.1257a8","type":"debug","z":"e3e1d3c0.6b18","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload2","targetType":"msg","statusVal":"","statusType":"auto","x":660,"y":760,"wires":[]},{"id":"64541d80.bccbe4","type":"switch","z":"e3e1d3c0.6b18","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"true","vt":"str"},{"t":"eq","v":"false","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":960,"y":720,"wires":[["e0e6509a.a4a18"],[]]},{"id":"2c532f67.0330e","type":"trigger","z":"e3e1d3c0.6b18","name":"","op1":"reset","op2":"true","op1type":"str","op2type":"bool","duration":"2","extend":true,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":500,"y":860,"wires":[["e4e42b96.97a338"]]},{"id":"e4e42b96.97a338","type":"trigger","z":"e3e1d3c0.6b18","name":"","op1":"0","op2":"0","op1type":"str","op2type":"str","duration":"-2","extend":false,"overrideDelay":false,"units":"s","reset":"reset","bytopic":"all","topic":"topic","outputs":1,"x":660,"y":860,"wires":[["83e47b7.c234188"]]},{"id":"3bda4ff1.27158","type":"debug","z":"e3e1d3c0.6b18","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":370,"y":980,"wires":[]},{"id":"83e47b7.c234188","type":"debug","z":"e3e1d3c0.6b18","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":890,"y":860,"wires":[]},{"id":"2c3f285.7dce7d8","type":"server","name":"Home-Assistant","legacy":false,"addon":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

Edit: Picture attached that not everyone needs to import the code.

Edit2: Here is the function:

if (msg.payload1 === "true" && msg.payload2 == "true") {
    msg.payload = true;
}

else {
    msg.payload = false;
}

return msg;

Hi, @noobred, welcome to the fourm.

The first concept you need to understand in node-red (or any computer language) is that messages do NOT arrive at the same time.

See this article in the cookbook for an example of how to join messages into one object.

thank you very much ! Sorry that I forgot to mention that I had this considered yesterday. I went through the cookbook but eventually failed. Added this pattern now with the following code:

  • set per node a custom message.topic
  • join them together into one key/value object
  • using the function to apply IF/ELSE logic

Am i doing it right?

[{"id":"aec813ed.ae5","type":"inject","z":"e3e1d3c0.6b18","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"3600","crontab":"","once":true,"onceDelay":"","topic":"","payload":"","payloadType":"date","x":110,"y":640,"wires":[["ab666945.3b5c68"]]},{"id":"4457999e.bcd758","type":"delay","z":"e3e1d3c0.6b18","name":"","pauseType":"delay","timeout":"15","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":650,"y":540,"wires":[["e9f35c06.ef52f"]]},{"id":"e9f35c06.ef52f","type":"api-call-service","z":"e3e1d3c0.6b18","name":"","server":"2c3f285.7dce7d8","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.luftung_bad","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":930,"y":540,"wires":[["133b3eb2.6309c1"]]},{"id":"e0e6509a.a4a18","type":"api-call-service","z":"e3e1d3c0.6b18","name":"","server":"2c3f285.7dce7d8","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.luftung_bad","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1190,"y":800,"wires":[[]]},{"id":"ab666945.3b5c68","type":"time-range-switch","z":"e3e1d3c0.6b18","name":"","lat":"50.93333","lon":"6.95","startTime":"sunriseEnd","endTime":"00:00","startOffset":0,"endOffset":0,"x":290,"y":640,"wires":[["4457999e.bcd758","8be66078.37f18"],[]]},{"id":"133b3eb2.6309c1","type":"debug","z":"e3e1d3c0.6b18","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1170,"y":540,"wires":[]},{"id":"e85a6f2.8c2919","type":"poll-state","z":"e3e1d3c0.6b18","name":"","server":"2c3f285.7dce7d8","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"updateinterval":"60","updateIntervalUnits":"minutes","outputinitially":false,"outputonchanged":false,"entity_id":"sensor.lywsd03mmc_humidity_kleines_bad","state_type":"str","halt_if":"80","halt_if_type":"num","halt_if_compare":"gt","outputs":2,"x":240,"y":740,"wires":[["3bda4ff1.27158","e6b66866.3640b8"],[]]},{"id":"5d701db5.14fd14","type":"function","z":"e3e1d3c0.6b18","name":"","func":"if (msg.payload1 === \"true\" && msg.payload2 == \"true\") {\n    msg.payload = true;\n}\n\nelse {\n    msg.payload = false;\n}\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":940,"y":660,"wires":[["64541d80.bccbe4"]]},{"id":"dc66e6f5.42a418","type":"comment","z":"e3e1d3c0.6b18","name":"Multiple Inputs / Conditions","info":"You can have multiple inputs into a function node BUT each one will run separately. If you need data fron the other one, you will need to join them together before sending to the function node.","x":320,"y":580,"wires":[]},{"id":"e6b66866.3640b8","type":"change","z":"e3e1d3c0.6b18","name":"","rules":[{"t":"set","p":"payload2","pt":"msg","to":"true","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"shroom_humidity","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":540,"y":700,"wires":[["799c678c.1257a8","4aee80b.97c9f8"]]},{"id":"8be66078.37f18","type":"change","z":"e3e1d3c0.6b18","name":"","rules":[{"t":"set","p":"payload1","pt":"msg","to":"true","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"interval","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":540,"y":640,"wires":[["91d0e013.26e44","4aee80b.97c9f8"]]},{"id":"91d0e013.26e44","type":"debug","z":"e3e1d3c0.6b18","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload1","targetType":"msg","statusVal":"","statusType":"auto","x":600,"y":600,"wires":[]},{"id":"799c678c.1257a8","type":"debug","z":"e3e1d3c0.6b18","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload2","targetType":"msg","statusVal":"","statusType":"auto","x":600,"y":740,"wires":[]},{"id":"64541d80.bccbe4","type":"switch","z":"e3e1d3c0.6b18","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"true","vt":"str"},{"t":"eq","v":"false","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":970,"y":760,"wires":[["e0e6509a.a4a18"],[]]},{"id":"2c532f67.0330e","type":"trigger","z":"e3e1d3c0.6b18","name":"","op1":"reset","op2":"true","op1type":"str","op2type":"bool","duration":"2","extend":true,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":500,"y":860,"wires":[["e4e42b96.97a338"]]},{"id":"e4e42b96.97a338","type":"trigger","z":"e3e1d3c0.6b18","name":"","op1":"0","op2":"0","op1type":"str","op2type":"str","duration":"-2","extend":false,"overrideDelay":false,"units":"s","reset":"reset","bytopic":"all","topic":"topic","outputs":1,"x":660,"y":860,"wires":[["83e47b7.c234188"]]},{"id":"3bda4ff1.27158","type":"debug","z":"e3e1d3c0.6b18","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":310,"y":960,"wires":[]},{"id":"83e47b7.c234188","type":"debug","z":"e3e1d3c0.6b18","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":890,"y":860,"wires":[]},{"id":"4aee80b.97c9f8","type":"join","z":"e3e1d3c0.6b18","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":750,"y":660,"wires":[["5d701db5.14fd14","9497e70e.e5d758"]]},{"id":"9497e70e.e5d758","type":"debug","z":"e3e1d3c0.6b18","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":850,"y":600,"wires":[]},{"id":"2c3f285.7dce7d8","type":"server","name":"Home-Assistant","legacy":false,"addon":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

I dont think so.

In your function you try to access msg.payload1 and msg.payload2 but I that is not what will be coming out of the join node.

Have a look at the debug message coming out of the join node.

Then read this page in the docs that will explain how to use the debug panel to find the right path to any data item.

Thanks Steve! That helped very much. Now I can address specific elements in a payload. That is really cool. I think it works now technically. However the switch turns on regardless of my injection node interval (1hour). In example I set the update interval of the humidity to 2seconds but the interval should fire only once an hour. The switch should not be turned ON. How can I solve this problem?

Thank you very much !

[{"id":"aec813ed.ae5","type":"inject","z":"e3e1d3c0.6b18","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"3600","crontab":"","once":true,"onceDelay":"","topic":"","payload":"","payloadType":"date","x":110,"y":534,"wires":[["ab666945.3b5c68"]]},{"id":"4457999e.bcd758","type":"delay","z":"e3e1d3c0.6b18","name":"","pauseType":"delay","timeout":"15","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":650,"y":434,"wires":[["e9f35c06.ef52f"]]},{"id":"e9f35c06.ef52f","type":"api-call-service","z":"e3e1d3c0.6b18","name":"","server":"2c3f285.7dce7d8","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.luftung_bad","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":930,"y":434,"wires":[["133b3eb2.6309c1"]]},{"id":"e0e6509a.a4a18","type":"api-call-service","z":"e3e1d3c0.6b18","name":"","server":"2c3f285.7dce7d8","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.luftung_bad","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1290,"y":540,"wires":[[]]},{"id":"ab666945.3b5c68","type":"time-range-switch","z":"e3e1d3c0.6b18","name":"","lat":"50.93333","lon":"6.95","startTime":"sunriseEnd","endTime":"00:00","startOffset":0,"endOffset":0,"x":290,"y":534,"wires":[["4457999e.bcd758","8be66078.37f18"],[]]},{"id":"133b3eb2.6309c1","type":"debug","z":"e3e1d3c0.6b18","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1170,"y":434,"wires":[]},{"id":"e85a6f2.8c2919","type":"poll-state","z":"e3e1d3c0.6b18","name":"","server":"2c3f285.7dce7d8","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"updateinterval":"2","updateIntervalUnits":"seconds","outputinitially":false,"outputonchanged":false,"entity_id":"sensor.lywsd03mmc_humidity_kleines_bad","state_type":"str","halt_if":"80","halt_if_type":"num","halt_if_compare":"gt","outputs":2,"x":240,"y":634,"wires":[["e6b66866.3640b8"],[]]},{"id":"5d701db5.14fd14","type":"function","z":"e3e1d3c0.6b18","name":"","func":"if (msg.payload.interval === \"true\" && msg.payload.shroom_humidity == \"true\") {\n    msg.payload = true;\n}\n\nelse {\n    msg.payload = false;\n}\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":940,"y":540,"wires":[["64541d80.bccbe4"]]},{"id":"dc66e6f5.42a418","type":"comment","z":"e3e1d3c0.6b18","name":"Multiple Inputs / Conditions","info":"You can have multiple inputs into a function node BUT each one will run separately. If you need data fron the other one, you will need to join them together before sending to the function node.","x":320,"y":474,"wires":[]},{"id":"e6b66866.3640b8","type":"change","z":"e3e1d3c0.6b18","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"shroom_humidity","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":620,"wires":[["4aee80b.97c9f8"]]},{"id":"8be66078.37f18","type":"change","z":"e3e1d3c0.6b18","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"interval","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":520,"wires":[["4aee80b.97c9f8"]]},{"id":"64541d80.bccbe4","type":"switch","z":"e3e1d3c0.6b18","name":"","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":1090,"y":540,"wires":[["e0e6509a.a4a18","909abdf6.78efa"],[]]},{"id":"4aee80b.97c9f8","type":"join","z":"e3e1d3c0.6b18","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":750,"y":554,"wires":[["9497e70e.e5d758","5d701db5.14fd14"]]},{"id":"9497e70e.e5d758","type":"debug","z":"e3e1d3c0.6b18","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":850,"y":494,"wires":[]},{"id":"909abdf6.78efa","type":"debug","z":"e3e1d3c0.6b18","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1270,"y":494,"wires":[]},{"id":"2c3f285.7dce7d8","type":"server","name":"Home-Assistant","legacy":false,"addon":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

Sorry, I dont know HA

however, in your function code, you test for payload to be both == "true" and === "true" (i.e. would fail on a boolean true as true !== "true")

I would probably do ...

var i = msg.payload.interval == true || msg.payload.interval == "true";
var h = msg.payload.shroom_humidity == true || msg.payload.shroom_humidity == "true";
msg.payload = (i && h);
return msg;

also, the switch node - the 2nd condition should really be "otherwise" (as a catch all)

But the answer to why - you will need to inspect the values in the debug coming out of the join node to figure out the reason.

thank you very much Steve! I will try it out and come back to document the solution here - at least to challenge it ;9

I updated the function code (I misunderstood) your intent - i think its right now...

yeah!i think it is working now. with your code it looks professionally coded and copes also with my inability declaring boolean vs. string "true" - thanks for that. To help others I paste the code here:

[{"id":"aec813ed.ae5","type":"inject","z":"e3e1d3c0.6b18","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"7200","crontab":"","once":true,"onceDelay":"","topic":"","payload":"","payloadType":"date","x":110,"y":534,"wires":[["ab666945.3b5c68"]]},{"id":"4457999e.bcd758","type":"delay","z":"e3e1d3c0.6b18","name":"","pauseType":"delay","timeout":"15","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":650,"y":434,"wires":[["e9f35c06.ef52f"]]},{"id":"e9f35c06.ef52f","type":"api-call-service","z":"e3e1d3c0.6b18","name":"","server":"2c3f285.7dce7d8","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.luftung_bad","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":930,"y":434,"wires":[["133b3eb2.6309c1"]]},{"id":"e0e6509a.a4a18","type":"api-call-service","z":"e3e1d3c0.6b18","name":"","server":"2c3f285.7dce7d8","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.luftung_bad","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1290,"y":540,"wires":[["fdb5db07.7c6488"]]},{"id":"ab666945.3b5c68","type":"time-range-switch","z":"e3e1d3c0.6b18","name":"","lat":"50.93333","lon":"6.95","startTime":"sunriseEnd","endTime":"00:00","startOffset":0,"endOffset":0,"x":290,"y":534,"wires":[["4457999e.bcd758","8be66078.37f18"],[]]},{"id":"133b3eb2.6309c1","type":"debug","z":"e3e1d3c0.6b18","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1170,"y":434,"wires":[]},{"id":"e85a6f2.8c2919","type":"poll-state","z":"e3e1d3c0.6b18","name":"","server":"2c3f285.7dce7d8","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"updateinterval":"15","updateIntervalUnits":"minutes","outputinitially":false,"outputonchanged":false,"entity_id":"sensor.lywsd03mmc_humidity_kleines_bad","state_type":"str","halt_if":"80","halt_if_type":"num","halt_if_compare":"gt","outputs":2,"x":240,"y":634,"wires":[["e6b66866.3640b8"],[]]},{"id":"5d701db5.14fd14","type":"function","z":"e3e1d3c0.6b18","name":"","func":"var i = msg.payload.interval == true || msg.payload.interval == \"true\";\nvar h = msg.payload.shroom_humidity == true || msg.payload.shroom_humidity == \"true\";\nmsg.payload = (i && h);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":920,"y":540,"wires":[["64541d80.bccbe4","be16c70.f61f938"]]},{"id":"dc66e6f5.42a418","type":"comment","z":"e3e1d3c0.6b18","name":"Multiple Inputs / Conditions","info":"You can have multiple inputs into a function node BUT each one will run separately. If you need data fron the other one, you will need to join them together before sending to the function node.","x":320,"y":474,"wires":[]},{"id":"e6b66866.3640b8","type":"change","z":"e3e1d3c0.6b18","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"shroom_humidity","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":620,"wires":[["4aee80b.97c9f8"]]},{"id":"8be66078.37f18","type":"change","z":"e3e1d3c0.6b18","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"interval","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":520,"wires":[["4aee80b.97c9f8"]]},{"id":"64541d80.bccbe4","type":"switch","z":"e3e1d3c0.6b18","name":"","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":1090,"y":540,"wires":[["e0e6509a.a4a18","909abdf6.78efa"],[]]},{"id":"4aee80b.97c9f8","type":"join","z":"e3e1d3c0.6b18","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":750,"y":554,"wires":[["9497e70e.e5d758","5d701db5.14fd14"]]},{"id":"9497e70e.e5d758","type":"debug","z":"e3e1d3c0.6b18","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":850,"y":494,"wires":[]},{"id":"909abdf6.78efa","type":"debug","z":"e3e1d3c0.6b18","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1270,"y":494,"wires":[]},{"id":"fdb5db07.7c6488","type":"change","z":"e3e1d3c0.6b18","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"interval","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1480,"y":540,"wires":[[]]},{"id":"be16c70.f61f938","type":"debug","z":"e3e1d3c0.6b18","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1110,"y":600,"wires":[]},{"id":"2c3f285.7dce7d8","type":"server","name":"Home-Assistant","legacy":false,"addon":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

thanks again !