Stopping flow help - still can't crack it

Hi, I’ve really been searching a lot and I can’t figure it out.

My old analog airco is automated with infrared device, and I get its status with a light sensor glue in front of the “on off” light. That works… most of the time.

So I need a babysitter that will resend the infrared call if it hasn’t started.

But if I click manually again to “switch it off” - I need the babysitter to stop its previous task. I can’t figure out how to switch this. Hope I make sense?

[{"id":"d852c9aff1378b7d","type":"server-state-changed","z":"696f8303.5ee06c","name":"Airco Switch","server":"a0eea9da.0fe1d8","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"switch.airco","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":true,"ignorePrevStateUnknown":true,"ignorePrevStateUnavailable":true,"ignoreCurrentStateUnknown":true,"ignoreCurrentStateUnavailable":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":110,"y":360,"wires":[["25e16acf11b13660"],["284c2f68ee68075d"]]},{"id":"7c79186bbef6dac1","type":"delay","z":"696f8303.5ee06c","name":"","pauseType":"delay","timeout":"60","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":680,"y":340,"wires":[["32d2cbd5f81c8b11"]]},{"id":"a15dc5cd7b785f58","type":"api-current-state","z":"696f8303.5ee06c","name":"airco switch on","server":"a0eea9da.0fe1d8","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.airco","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":1080,"y":340,"wires":[[],["7442be41cdfcc832"]]},{"id":"7442be41cdfcc832","type":"api-call-service","z":"696f8303.5ee06c","name":"Turn on again","server":"a0eea9da.0fe1d8","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.airco"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1260,"y":340,"wires":[[]]},{"id":"25e16acf11b13660","type":"debounce-leading-trailing","z":"696f8303.5ee06c","time":"3000","debouncetype":"trailing","name":"3sec","x":250,"y":340,"wires":[["5500e6d2d788c9ec","4a4d83c3620a8db5"]]},{"id":"661dca9a0946bc73","type":"delay","z":"696f8303.5ee06c","name":"","pauseType":"delay","timeout":"60","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":680,"y":400,"wires":[["b4a696f56b7040de"]]},{"id":"b3816d517e115305","type":"api-current-state","z":"696f8303.5ee06c","name":"airco switch on","server":"a0eea9da.0fe1d8","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.airco","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":1080,"y":400,"wires":[["f15f60bd0b3147f7"],[]]},{"id":"f15f60bd0b3147f7","type":"api-call-service","z":"696f8303.5ee06c","name":"Turn off again","server":"a0eea9da.0fe1d8","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.airco"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1260,"y":400,"wires":[[]]},{"id":"284c2f68ee68075d","type":"debounce-leading-trailing","z":"696f8303.5ee06c","time":"3000","debouncetype":"trailing","name":"3sec","x":250,"y":400,"wires":[["fd26054da2ee3750","1736c913f2cf5323"]]},{"id":"5500e6d2d788c9ec","type":"change","z":"696f8303.5ee06c","name":"set controloff","rules":[{"t":"set","p":"topic","pt":"msg","to":"controloff","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"close","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":340,"wires":[["661dca9a0946bc73"]]},{"id":"b4a696f56b7040de","type":"gate","z":"696f8303.5ee06c","name":"gate stop off","controlTopic":"controloff","defaultState":"open","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","defaultCmd":"default","statusCmd":"status","persist":false,"storeName":"memory","x":870,"y":400,"wires":[["b3816d517e115305"]]},{"id":"32d2cbd5f81c8b11","type":"gate","z":"696f8303.5ee06c","name":"gate stop on","controlTopic":"controlon","defaultState":"open","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","defaultCmd":"default","statusCmd":"status","persist":false,"storeName":"memory","x":870,"y":340,"wires":[["a15dc5cd7b785f58"]]},{"id":"1736c913f2cf5323","type":"change","z":"696f8303.5ee06c","name":"set controlon","rules":[{"t":"set","p":"topic","pt":"msg","to":"controlon","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"close","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":380,"wires":[["7c79186bbef6dac1"]]},{"id":"fd26054da2ee3750","type":"change","z":"696f8303.5ee06c","name":"set controloff","rules":[{"t":"set","p":"topic","pt":"msg","to":"controloff","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"open","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":420,"wires":[["661dca9a0946bc73"]]},{"id":"4a4d83c3620a8db5","type":"change","z":"696f8303.5ee06c","name":"set controlon","rules":[{"t":"set","p":"topic","pt":"msg","to":"controlon","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"open","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":300,"wires":[["7c79186bbef6dac1"]]},{"id":"a0eea9da.0fe1d8","type":"server","name":"GOOD Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30"}]

The one node where you can actually react in its processing time is the delay node, so it is that one you have to look at.

I would probably replace it with a join node with a fixed timeout of your 60 seconds.
You can then add multiple inputs to it and have a node after that will handle the inputs and check if there is a break message among them collected inputs.

I do not have all of your nodes installed, so I have just provided a proof of concept here.

[{"id":"868143805efe18cf","type":"join","z":"242e69e25e610855","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"5","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":910,"y":690,"wires":[["6b99165cae2a93e9"]]},{"id":"b69d15018c22ab10","type":"inject","z":"242e69e25e610855","name":"","props":[{"p":"topic","vt":"str"},{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"On","payload":"Command_on","payloadType":"str","x":690,"y":645,"wires":[["868143805efe18cf"]]},{"id":"3f1772a2e573c755","type":"inject","z":"242e69e25e610855","name":"","props":[{"p":"topic","vt":"str"},{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Off","payload":"Command_off","payloadType":"str","x":690,"y":735,"wires":[["868143805efe18cf"]]},{"id":"ad8b3c1e4b23c583","type":"debug","z":"242e69e25e610855","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1240,"y":690,"wires":[]},{"id":"6b99165cae2a93e9","type":"change","z":"242e69e25e610855","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"move","p":"topic","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1075,"y":690,"wires":[["ad8b3c1e4b23c583"]]}]

Its set to interrupt the wait if a extra command arrives, but if you do not want that, then just increase the “After a number of message parts” setting to an insane amount, like 1000.

Brilliant people are cool. Thanks - this works perfectly. I tested it a bit further with 2 inject nodes that would replicate the input from the switch and a split node at the end to trigger different actions.

[{"id":"868143805efe18cf","type":"join","z":"696f8303.5ee06c","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"5","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":610,"y":560,"wires":[["6b99165cae2a93e9"]]},{"id":"ad8b3c1e4b23c583","type":"debug","z":"696f8303.5ee06c","name":"ON","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1130,"y":540,"wires":[]},{"id":"6b99165cae2a93e9","type":"change","z":"696f8303.5ee06c","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"move","p":"topic","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":775,"y":560,"wires":[["81fbc7aa78732b90"]]},{"id":"5639332ed7675059","type":"change","z":"696f8303.5ee06c","name":"Comman_on","rules":[{"t":"set","p":"topic","pt":"msg","to":"on","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"Command_on","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":540,"wires":[["868143805efe18cf"]]},{"id":"f5804b2000c41f1d","type":"change","z":"696f8303.5ee06c","name":"Comman_off","rules":[{"t":"set","p":"topic","pt":"msg","to":"off","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"Command_off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":580,"wires":[["868143805efe18cf"]]},{"id":"a93e692fc4f706e9","type":"inject","z":"696f8303.5ee06c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":220,"y":540,"wires":[["5639332ed7675059"]]},{"id":"a181bd42e22988e0","type":"inject","z":"696f8303.5ee06c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":220,"y":580,"wires":[["f5804b2000c41f1d"]]},{"id":"81fbc7aa78732b90","type":"switch","z":"696f8303.5ee06c","name":"On or off?","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":960,"y":560,"wires":[["ad8b3c1e4b23c583"],["90e1d2aef25060c4"]]},{"id":"90e1d2aef25060c4","type":"debug","z":"696f8303.5ee06c","name":"OFF","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1130,"y":600,"wires":[]},{"id":"d5df070b7f4914cf","type":"comment","z":"696f8303.5ee06c","name":"Simulate inout from a sensor","info":"","x":180,"y":500,"wires":[]},{"id":"1ad74785d4de1023","type":"comment","z":"696f8303.5ee06c","name":"Simulate output to an action","info":"","x":1120,"y":500,"wires":[]}]

I spoke too soon… :frowning: It works as intended, but it doesn’t solve my problem.

The switch can be either:

  • Turn on by an action (button, etc)
  • Have its status reset by a python script based on the satus of a sensor (is the power on the device on).

This works. It makes sure tyhat the switch status is always in sync with reality - and the python script, in home assistant, doesn’t trigger an action. But it does in Node-red…

The flow above turns into an eternel loop. (The switch gets set to “off” by the python script which triggers your flow - while it shoudn’t - only be trigger when “not by the python script”…

So you need a helper to detect the python script action.
Set a helper up in HA and set the helper to true when the python script runs.
Test as first thing after the trigger in your flow if the helper is true.
If it is then set it to false and nothing more.
If it is not, then run the normal flow.

1 Like

… this is what I just finished figuring out :slight_smile:

[{"id":"37dc9ef0eeef0843","type":"api-call-service","z":"696f8303.5ee06c","name":"Python airco state change ON","server":"a0eea9da.0fe1d8","version":5,"debugenabled":false,"domain":"python_script","service":"state_change","areaId":[],"deviceId":[],"entityId":[],"data":"{\"entity_id\":\"switch.airco\",\"state\":\"on\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[{"property":"python","propertyType":"global","value":"on","valueType":"str"}],"queue":"none","x":470,"y":120,"wires":[[]]},{"id":"1bd1776fdf9fb972","type":"server-state-changed","z":"696f8303.5ee06c","name":"Airco Sensor","server":"a0eea9da.0fe1d8","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.lightlevel_69","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"2","halt_if_type":"num","halt_if_compare":"gte","outputs":2,"output_only_on_state_change":true,"for":"10","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":150,"y":120,"wires":[["37dc9ef0eeef0843"],["cd3e57f3ae1ed363"]]},{"id":"cd3e57f3ae1ed363","type":"api-call-service","z":"696f8303.5ee06c","name":"Python airco state change OFF","server":"a0eea9da.0fe1d8","version":5,"debugenabled":false,"domain":"python_script","service":"state_change","areaId":[],"deviceId":[],"entityId":[],"data":"{\"entity_id\":\"switch.airco\",\"state\":\"off\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[{"property":"python","propertyType":"global","value":"off","valueType":"str"}],"queue":"none","x":470,"y":180,"wires":[[]]},{"id":"6abf14c3619b42da","type":"poll-state","z":"696f8303.5ee06c","name":"constant checker","server":"a0eea9da.0fe1d8","version":2,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"updateinterval":"60","updateIntervalType":"num","updateIntervalUnits":"seconds","outputinitially":false,"outputonchanged":true,"entity_id":"sensor.lightlevel_69","state_type":"str","halt_if":"2","halt_if_type":"num","halt_if_compare":"gte","outputs":2,"x":160,"y":180,"wires":[["37dc9ef0eeef0843"],["cd3e57f3ae1ed363"]]},{"id":"d3bc0b9bd63aa386","type":"comment","z":"696f8303.5ee06c","name":"Sync switch with light sensor","info":"","x":200,"y":80,"wires":[]},{"id":"13e8abe41aab8afe","type":"server-state-changed","z":"696f8303.5ee06c","name":"Airco Sensor sync?","server":"a0eea9da.0fe1d8","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.lightlevel_69","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"2","halt_if_type":"num","halt_if_compare":"gte","outputs":2,"output_only_on_state_change":true,"for":"10","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":130,"y":480,"wires":[["508a11a4f7652e50"],["0dd0adfee18436f7"]]},{"id":"508a11a4f7652e50","type":"api-call-service","z":"696f8303.5ee06c","name":"status on","server":"a0eea9da.0fe1d8","version":5,"debugenabled":false,"domain":"input_boolean","service":"turn_on","areaId":[],"deviceId":[],"entityId":["input_boolean.airdevicecoolingstatus"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":340,"y":400,"wires":[[]]},{"id":"0dd0adfee18436f7","type":"api-call-service","z":"696f8303.5ee06c","name":"status off","server":"a0eea9da.0fe1d8","version":5,"debugenabled":false,"domain":"input_boolean","service":"turn_off","areaId":[],"deviceId":[],"entityId":["input_boolean.airdevicecoolingstatus"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":330,"y":500,"wires":[[]]},{"id":"b42517127a4b1f32","type":"comment","z":"696f8303.5ee06c","name":"Test toggle airco","info":"","x":780,"y":80,"wires":[]},{"id":"13716cdbcaad3be0","type":"inject","z":"696f8303.5ee06c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":780,"y":120,"wires":[["d26e0c55e86f7167"]]},{"id":"d26e0c55e86f7167","type":"api-call-service","z":"696f8303.5ee06c","name":"","server":"a0eea9da.0fe1d8","version":5,"debugenabled":false,"domain":"switch","service":"toggle","areaId":[],"deviceId":[],"entityId":["switch.airco"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":950,"y":120,"wires":[[]]},{"id":"868143805efe18cf","type":"join","z":"696f8303.5ee06c","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"5","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":600,"y":300,"wires":[["6b99165cae2a93e9"]]},{"id":"6b99165cae2a93e9","type":"change","z":"696f8303.5ee06c","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"move","p":"topic","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":690,"y":260,"wires":[["fc5bfdce7356d8dd"]]},{"id":"5639332ed7675059","type":"change","z":"696f8303.5ee06c","name":"Comman_on","rules":[{"t":"set","p":"topic","pt":"msg","to":"on","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"Command_on","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":280,"wires":[["868143805efe18cf"]]},{"id":"f5804b2000c41f1d","type":"change","z":"696f8303.5ee06c","name":"Comman_off","rules":[{"t":"set","p":"topic","pt":"msg","to":"off","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"Command_off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":320,"wires":[["868143805efe18cf"]]},{"id":"81fbc7aa78732b90","type":"switch","z":"696f8303.5ee06c","name":"On or off?","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":910,"y":300,"wires":[["aa7e6493e8f037d1"],["a0097861ca9376d7"]]},{"id":"54d3f7c9a5fcc133","type":"server-state-changed","z":"696f8303.5ee06c","name":"Airco Switch","server":"a0eea9da.0fe1d8","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"switch.airco","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":false,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":true,"ignorePrevStateUnknown":true,"ignorePrevStateUnavailable":true,"ignoreCurrentStateUnknown":true,"ignoreCurrentStateUnavailable":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":100,"y":300,"wires":[["a3bcf3383b35e198"],["4d43b46db5ccb350"]]},{"id":"aa7e6493e8f037d1","type":"api-current-state","z":"696f8303.5ee06c","name":"airco switch on","server":"a0eea9da.0fe1d8","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.airco","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":1090,"y":280,"wires":[[],["56dda86030b477e2"]]},{"id":"a0097861ca9376d7","type":"api-current-state","z":"696f8303.5ee06c","name":"airco switch on","server":"a0eea9da.0fe1d8","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.airco","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":1090,"y":340,"wires":[["6dbeab2d084ec3f6"],[]]},{"id":"6dbeab2d084ec3f6","type":"api-call-service","z":"696f8303.5ee06c","name":"Turn off again","server":"a0eea9da.0fe1d8","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.airco"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1270,"y":340,"wires":[["0795de857ec0d281"]]},{"id":"56dda86030b477e2","type":"api-call-service","z":"696f8303.5ee06c","name":"Turn on again","server":"a0eea9da.0fe1d8","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.airco"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1270,"y":280,"wires":[["fb1de99952a906eb"]]},{"id":"fb1de99952a906eb","type":"debug","z":"696f8303.5ee06c","name":"on","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1440,"y":280,"wires":[]},{"id":"0795de857ec0d281","type":"debug","z":"696f8303.5ee06c","name":"off","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1440,"y":340,"wires":[]},{"id":"a3bcf3383b35e198","type":"switch","z":"696f8303.5ee06c","name":"Only on","property":"python","propertyType":"global","rules":[{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":270,"y":280,"wires":[["5639332ed7675059"]]},{"id":"4d43b46db5ccb350","type":"switch","z":"696f8303.5ee06c","name":"Only off","property":"python","propertyType":"global","rules":[{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":270,"y":320,"wires":[["f5804b2000c41f1d"]]},{"id":"fc5bfdce7356d8dd","type":"delay","z":"696f8303.5ee06c","name":"","pauseType":"delay","timeout":"60","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":770,"y":320,"wires":[["81fbc7aa78732b90"]]},{"id":"a0eea9da.0fe1d8","type":"server","name":"GOOD Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30"}]

In other words, I only want the “babysitter” to get trigger if the switch change has a different state that the python script update. This seems to work now. Thanks!

Perfect! :slight_smile: