Turn off plug when no much power taken (washmachine)

I am very new to node-red and homeassistant, so far I had no problems with basic setup however this scenario I don't know how to achieve.

Basically I have a wash machine and a dryer connected to a smart plug. I thought maybe based on the power I can determine whether the plug should continue to be turn on or off.


  1. when I turn on the plug, it should listen for 10 minutes if there is any power taken (more than 10 WAT)
    a) if not, turn off the plug
    b) if yes, continue listening whether the power drops below 10 WAT, wait 10 minutes and turn off. Of course, if in waiting time (10 minutes) power will be above 10 WAT, it should cancel turning off and continue listening again.

I hope I somehow wrote it clear.

...the major flow in that concept is, in my opinion, that today, even since the last 10 years, there are only digital controlled washing/drying machines available anymore.

So, as soon as you switch on the plug, will the machine run/start automatically with the desired programme that is suitable for the clothing inside?
A machine with digital controls will just "boot up" and sit there and do nothing until you manually configure its programme via the input keys, because there is no programme selector that can be set manually before you switch on the machine via the plug.

I think you might not understand what I want. The only thing I want that is to cut the power after the wash machine done the job. Since I have all the values like power, ability to turn on/off the plug, the only thing I need is to put that together in the node-red.

As said, the plug must not turn off when wash machine actually does something. It's to prevent accidental burn. 5 years ago, my old apartment was on fire because of the electronics components that got short inside the washing machine.

Such flow should be doable with a couple of evnt-trigger nodes, triggered with the power consumption and then start/re-start a timer/wait fundction. Could be done straight forward.
..at the end you want to switch off the wasching maschine to prevent from burning when it's in standby and are using for this purpose another electric/electronic device (smart plug) which could burn as well!!!!

Have a look at the Trigger node. You can configure it to send nothing, then after 10 minutes send the Off command. If you also select Extend Delay on new message then provided messages keep coming in it will not send the Off message, but when no messages have been received for that time it will send it. Then just routinely send the trigger node messages provided the power is greater than your threshold.

...for this kind of use-case I would not rely on external logic....use a smart-plug that offers the use of embedded/local rules, like with tasmota firmware.
Of course with tasmota firmware you can have both, as the plug will integrate via mqtt easily, so if node-red fails for an external reason, the embedded rule can kick in.

1 Like

I do what you are trying to do, but with a 3d printer.

[{"id":"625e498b.8f4ff8","type":"switch","z":"dd2d61eb.3a2db","name":"current > .35 passes","property":"payload","propertyType":"msg","rules":[{"t":"gt","v":".35","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":420,"y":1360,"wires":[["25ab321b.2d11ae"]]},{"id":"25ab321b.2d11ae","type":"traffic","z":"dd2d61eb.3a2db","name":"","property_allow":"payload","filter_allow":"ON","ignore_case_allow":false,"negate_allow":false,"send_allow":false,"property_stop":"payload","filter_stop":"OFF","ignore_case_stop":false,"negate_stop":false,"send_stop":false,"default_start":false,"differ":false,"x":650,"y":1360,"wires":[["828dff04.f32d8"]]},{"id":"1b95bbe7.3763c4","type":"change","z":"dd2d61eb.3a2db","name":"payload.ENERGY.Current","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.ENERGY.Current","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":1320,"wires":[["625e498b.8f4ff8","d7599773.5832a8"]]},{"id":"251c108d.ef8d2","type":"ui_switch","z":"dd2d61eb.3a2db","name":"","label":"3d-printer auto-off","tooltip":"","group":"44539f94.7e6d9","order":4,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"ON","onvalueType":"str","onicon":"","oncolor":"","offvalue":"OFF","offvalueType":"str","officon":"","offcolor":"","x":430,"y":1420,"wires":[["25ab321b.2d11ae"]]},{"id":"828dff04.f32d8","type":"trigger","z":"dd2d61eb.3a2db","name":"","op1":"","op2":"OFF","op1type":"nul","op2type":"str","duration":"15","extend":true,"overrideDelay":false,"units":"min","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":810,"y":1360,"wires":[["251c108d.ef8d2","8ae2fad4.d79558"]]},{"id":"d7599773.5832a8","type":"ui_gauge","z":"dd2d61eb.3a2db","name":"","group":"44539f94.7e6d9","order":3,"width":0,"height":0,"gtype":"gage","title":"3d printer current","label":"amps","format":"{{value}}","min":0,"max":"5","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":1050,"y":1320,"wires":[]},{"id":"d77fd8eb.2406e8","type":"json","z":"dd2d61eb.3a2db","name":"","property":"payload","action":"","pretty":false,"x":370,"y":1320,"wires":[["1b95bbe7.3763c4"]]},{"id":"8ae2fad4.d79558","type":"mqtt out","z":"dd2d61eb.3a2db","name":"","topic":"cmnd/sonoff-3d-printer/POWER","qos":"","retain":"","broker":"24a67b3a.6b04c4","x":1090,"y":1360,"wires":[]},{"id":"393ea3f8.8049dc","type":"mqtt in","z":"dd2d61eb.3a2db","name":"","topic":"tele/sonoff-3d-printer/SENSOR","qos":"2","datatype":"auto","broker":"24a67b3a.6b04c4","x":170,"y":1320,"wires":[["d77fd8eb.2406e8"]]},{"id":"44539f94.7e6d9","type":"ui_group","name":"Other controls","tab":"acb9e96c.bfae08","order":3,"disp":true,"width":"4","collapse":false},{"id":"24a67b3a.6b04c4","type":"mqtt-broker","broker":"","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"acb9e96c.bfae08","type":"ui_tab","name":"Higley Local Dashboard","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

I do use one additional node here that isn't installed by default. The excellent "stoplight" node can reduce a lot of spaghetti wires.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.