I have a 4 channel relay and DHT22 sensor connected to ESP32. I am not using MQTT.
I am trying to control the 4 channel relay in node red. I am reading the humidity and when humidity drops certain percentage a relay should go on.
In my case instead off only one relay turned on, all are turned on. I do not know why this could happen and how to fix.
I am pasting here also a json from my Node Red.
[{"id":"1e1d15e60a4ac660","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"e2ddcb18d4e27a0d","type":"server-state-changed","z":"1e1d15e60a4ac660","name":"","server":"7ae32593.b0e90c","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_number.humidity_target","entityidfiltertype":"exact","outputinitially":true,"state_type":"num","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":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":170,"y":100,"wires":[["4310ce8249d984c8"]]},{"id":"08d73835cb81c426","type":"server-state-changed","z":"1e1d15e60a4ac660","name":"","server":"7ae32593.b0e90c","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_number.humidity_tolerance","entityidfiltertype":"exact","outputinitially":true,"state_type":"num","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":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":160,"y":180,"wires":[["4310ce8249d984c8"]]},{"id":"5146069a2b18cc12","type":"server-state-changed","z":"1e1d15e60a4ac660","name":"","server":"7ae32593.b0e90c","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.humidity_2","entityidfiltertype":"exact","outputinitially":false,"state_type":"num","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":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":220,"y":240,"wires":[["4310ce8249d984c8"]]},{"id":"4310ce8249d984c8","type":"join","z":"1e1d15e60a4ac660","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"3","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":510,"y":240,"wires":[["2178d964084b7787","15b95f2b31a02432"]]},{"id":"2178d964084b7787","type":"function","z":"1e1d15e60a4ac660","name":"","func":"if (msg.payload[\"sensor.humidity_2\"] < (msg.payload[\"input_number.humidity_target\"] - msg.payload[\"input_number.humidity_tolerance\"])){\nreturn msg;\n}\n\nelse if (msg.payload[\"sensor.humidity_2\"] > (msg.payload[\"input_number.humidity_target\"] + msg.payload[\"input_number.humidity_tolerance\"])){\nreturn [null, msg];\n}\n\n/*example\n\nhumid = 50\ntoler = 5\nreading: 65\n*/","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":680,"y":240,"wires":[["14ddb57c5080b076"],["7929afcea1c24d3e"]]},{"id":"f5fc0d8d9171e078","type":"api-call-service","z":"1e1d15e60a4ac660","name":"","server":"7ae32593.b0e90c","version":4,"debugenabled":false,"domain":"switch","service":"turn_on","target":{"areaId":[],"deviceId":["d9d110496a6bfd3bdc905efdf90272da"],"entityId":["switch.relay_1_2"]},"data":"1","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1200,"y":200,"wires":[[]]},{"id":"14ddb57c5080b076","type":"api-current-state","z":"1e1d15e60a4ac660","name":"","server":"7ae32593.b0e90c","version":3,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.relay_1_2","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":930,"y":220,"wires":[["f5fc0d8d9171e078"],[]]},{"id":"7929afcea1c24d3e","type":"api-current-state","z":"1e1d15e60a4ac660","name":"","server":"7ae32593.b0e90c","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.relay_1_2","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":970,"y":300,"wires":[["364a80e7fe9a9a5c"],[]]},{"id":"364a80e7fe9a9a5c","type":"api-call-service","z":"1e1d15e60a4ac660","name":"","server":"7ae32593.b0e90c","version":4,"debugenabled":false,"domain":"switch","service":"turn_off","target":{"areaId":[],"deviceId":["d9d110496a6bfd3bdc905efdf90272da"],"entityId":["switch.relay_1_2"]},"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1200,"y":300,"wires":[[]]},{"id":"15b95f2b31a02432","type":"debug","z":"1e1d15e60a4ac660","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":750,"y":120,"wires":[]},{"id":"7ae32593.b0e90c","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30}]