Function node only activating one call service and ignoring other despite proper conditions and code

Hey everyone so I’m following this tutorial by LEDGardener on setting up a flow in NR to automatically turn on/off a humidifier based on the readout from a wireless ruuvi tag. Everything in every tutorial has worked perfectly so far, up until this exact timestamp here, where he is able to adjust the desired humidity levels, and the node red flow turns on and off the TP device based on that.

I have my code set up exactly like his word for word with perfect formatting, and when the humidity target goes ABOVE the readouts from the ruuvi tags, the TP link devices turn on just like in the video at the timestamp, but when I drop the desired humidity BELOW the current humidity readouts, the turn_off call service node in the flow is never activated and so the TP links stay on no matter what. I’ve rewritten the code over and over and copied every single thing in the video, but can’t get the darn flow to activate the second call service.

Here is a full picture of the flow, perfectly mirroring the flow in the listed tutorial.

Here is a screenshot of the code inside the function node, again perfectly formatted and exactly copying the tutorial’s code.

Here are my current state nodes. The “current state is off” node is properly connected to the “turn_on” call service node, and the “current state is on” node is properly connected to the “turn_off” call service node.


And finally here are my call service nodes. As stated before, everything here works perfectly except I can’t for the life of me get the call service “switch.turn_off” to activate no matter what I set my
“input_number.humidity_target” at.


Thanks for the help, if there’s anything in this post that I need to clarify or explain better I’d be glad to, I am at my wit’s end trying to make this happen. It’s a very simple automation, literally just turning on or off a TP wireless mini plug based on the humidity readouts from an external hygrometer but I can’t get that “turn_off” call service to activate no matter what I do.

try something like this

image

[{"id":"50e8bb640b68428d","type":"server-state-changed","z":"c89d915bdff0f798","name":"sensors","server":"","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":["sensor.tent_a_humidity","input_number.humidity_target","input_number.humidity_tolerance"],"entityidfiltertype":"list","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"tent","propertyType":"msg","value":"$entities(\"sensor.tent_a_humidity\").state","valueType":"jsonata"},{"property":"target","propertyType":"msg","value":"$entities(\"input_number.humidity_target\").state","valueType":"jsonata"},{"property":"tolerance","propertyType":"msg","value":"$entities(\"input_number.humidity_tolerance\").state","valueType":"jsonata"}],"x":178,"y":1712,"wires":[["26b5b37216c61163"]]},{"id":"26b5b37216c61163","type":"function","z":"c89d915bdff0f798","name":"fogger A instructions","func":"if(msg.tent < msg.target - msg.tolerance) {\n    return msg;\n} else if( msg.tent > msg.target + msg.tolerance) {\n    return [null, msg];\n}\n","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":364,"y":1712,"wires":[["a73dc213c889f429"],["c574784d8b21079d"]]},{"id":"a73dc213c889f429","type":"debug","z":"c89d915bdff0f798","name":"turn on","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":572,"y":1696,"wires":[]},{"id":"c574784d8b21079d","type":"debug","z":"c89d915bdff0f798","name":"turn off","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":562,"y":1744,"wires":[]}]