Node Red turn smart switch on/off by power usage smart plug

For anyone looking as hard as I was this maybe help.
Included the sequence I use to turn on another smart-plug by power reading of another smart-plug.
So when power usage above 1 watt plug turns on, lower then 1 watt plug turns off.

[{"id":"bea4e2293c75a78f","type":"tab","label":"Houtbewerking","disabled":false,"info":"","env":[]},{"id":"ca459df7c0fe8781","type":"ha-wait-until","z":"bea4e2293c75a78f","name":"","server":"a465afba.fb6ee","version":0,"outputs":2,"entityId":"switch.houtbewerking_local","entityIdFilterType":"exact","property":"attributes.current_consumption","comparator":"lt","value":"1","valueType":"num","timeout":"1","timeoutType":"num","timeoutUnits":"seconds","entityLocation":"","entityLocationType":"none","checkCurrentState":true,"blockInputOverrides":true,"x":500,"y":160,"wires":[["dbb93dc2e3ff85c5"],["a68a4df249a64646"]]},{"id":"dbb93dc2e3ff85c5","type":"api-call-service","z":"bea4e2293c75a78f","name":"Stofzuiger-Uit","server":"a465afba.fb6ee","version":3,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.stofzuiger_local","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":840,"y":120,"wires":[[]]},{"id":"a68a4df249a64646","type":"api-call-service","z":"bea4e2293c75a78f","name":"Stofzuiger-Aan","server":"a465afba.fb6ee","version":3,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.stofzuiger_local","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":840,"y":200,"wires":[[]]},{"id":"76f204fee3730d15","type":"poll-state","z":"bea4e2293c75a78f","name":"","server":"a465afba.fb6ee","version":2,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"updateinterval":"2","updateIntervalType":"num","updateIntervalUnits":"seconds","outputinitially":false,"outputonchanged":false,"entity_id":"switch.houtbewerking_local","state_type":"str","halt_if":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"x":190,"y":160,"wires":[["ca459df7c0fe8781"],[]]},{"id":"dbc577659bb57429","type":"comment","z":"bea4e2293c75a78f","name":"Houtbewerking, Schakelt de stekker met stofzuiger aan/uit op het moment dat de stekker houtbewerking meer/minder dan 1 watt stroom verbruikt.","info":"Schakelt de stekker met stofzuiger aan/uit op het moment dat de stekker houtbewerking meer/minder dan 1 watt stroom verbruikt.","x":520,"y":60,"wires":[]},{"id":"a465afba.fb6ee","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}]
1 Like