Shut off if load falls below 20W

Is there a way to make an Everspring AN158 plug with metering shut off if the load falls below 20Watts ?

The ‘Power Event Device’ (PED) might do the trick.

What is the ‘Power Event Device’ (PED) ?

See @Ap15e’s plug-in.

Thank You, this code solved the issue, now I can get rid of the load from 24 standby LED’s from all kinds of equipment (stereo, tv, mediacenter etc.) I added a scedule to run this every hour.

local lul_watts1=luup.variable_get(“urn:micasaverde-com:serviceId:EnergyMetering1”,“Watts”,23)
local lul_tmp = luup.variable_get(“urn:upnp-org:serviceId:SwitchPower1”, “Status”, 23)
if (( tonumber(lul_watts1)<20 ) and (lul_tmp == “1”))
luup.call_action(“urn:upnp-org:serviceId:SwitchPower1”, “SetTarget”, {newTargetValue = “0”}, 23)
return false