Turn off device after it has used little power for a while?


I have been looking on the forums and in the wiki, willing to dig in the whole luup programming thing…but a pointer from one of you expert would be very welcome :slight_smile:

Here is my situation:
I want to automatically turn off my coffee machine (big power consumer) after it hasn’t been used for a while. It is connected to an AEON Smart Switch.
It draws above 1400W when brewing an espresso, otherwise around 3W, with occasional peaks at 600W.

So the logic would be quite simple: if power consumption has remained under 1000W during the last 30 min, turn this device off.
I don’t know if there is example code related to power consumption, or even if it’s possible.


[tt]PED[/tt] ([tt]http://forum.micasaverde.com/index.php/topic,8291.0.html[/tt]) might do the trick.

Wow, that was super fast. That looks exactly like what I need, thanks!

I’m not sure if the plug-in is better suited to do what you want, but this is how I turn my device off when it’s shutdown, but still leeching power:

local lul_watts1=luup.variable_get(“urn:micasaverde-com:serviceId:EnergyMetering1”,“Watts”,39)
local lul_tmp = luup.variable_get(“urn:upnp-org:serviceId:SwitchPower1”, “Status”, 39)

if (( tonumber(lul_watts1)<10 ) and (lul_tmp == “1”))
return true
return false

In other words, if device 39 is drawing less than 10W and the switch is on, then run a command. If you want a delay like I do, use the advanced section and insert a delay, before sending the command to the switch.
Under timer you can set how often the scene runs to check if there’s low wattage.