Trigger an automation when power is applied to an outlet?

I am trying to determine a way to automate a script when a set of outlets is turned on. The outlets are on a physical (non-smart) switch. Is there a device I could plug into one of the outlets that I could use as a trigger? So, say when X-device is sensed, run this automation?/

I do something similar … but the opposite!
I setup a water sensor across a relay that tells me when there is NO power in a socket.
You could just use the same setup but showing when power IS present.
Cut the end off the water sensor cable and connect a relay between the two cables that go to the sensor
I power the 5v relay with a simple USB charger
You can easily modify the DTH to show something nicer than wet/dry on the 'things ’ page as I did
Let me know if you need any more details and I’ll try and write something up

I originally used expensive Fibaro door/window sensors… but you can do exactly the same with cheaper wet/dry sensors
Have a look here


I use a Zooz mini plug for something similar:

When the power reaches a certain wattage, I perform an action. You can build a custom app or use Core. The Iris smart plugs also have power metering too but I like how small the Zooz is.


I’m in th UK and sockets/switches are more expensive but I never thought of that for this application.
I do use a socket to tell the wife when the tumble dryer has finished :slight_smile:
With my original project a socket wouldn’t work because if the power goes out there is no reporting from the socket

Would th socket drop off the network if left off for too long?

I don’t have power outages often so I don’t speak from experience. However the Zooz product is Zwave which in my opinion handles power outages better than zigbee.

Very interesting idea! Thanks - that could work.

@ritchierich How small of a load could it sense? Like, could I program it to sense the load from a nightlight?

The z-wave socket I use for the tumble dryer will show down to 0 watt in increments of 1 watt
I can’t comment on any other but I would suspect they are all the same

Yes it measures wattage in use starting from 0. So you would just measure the wattage used by the nightlight and go from there.

What smartapp are you using to trigger this automation? None of the built in ones seem to be able to do it.

Core can handle it.

@Jeff_Bannow I wrote/adapted my own :slight_smile:

I really just use it for messaging (e.g. " The Dryer Has Finished") but it could be adapted to turn on/off a switch if that is what you are looking to do (unless someone has already created this)

You do not have to rely on the in-build smartapps there are hundreds already written by the community that you can use
If you can’t find anything that does this for you let me know and I can probably edit mine to do what you want


@Cobra Looks like the power meter reading won’t work for my situation - can you give me more details on how to wired up the relay setup?


This is how I did it :slight_smile:

• Power is supplied by 5V USB charger
• Relay used was DPDT but SPST is sufficient

The relay I used has a 5V dc coil

The relay I used was a 5 Vdc coil DPDT but a SPDT relay is all that is required (I just had a few relays hanging around)
As you can see from the picture above:

• Pins 1 & 8 are connected to the 5 Vdc coil connections (i.e. USB power supply)
• Pin 2 will be connected to pin 3 and 7 to 6 when power is off
• Pins will be connected to pin 4 and pin5 to pin 6 when power is on

The relays that I use are so small that it is best to solder then to a little piece of veroboard with a couple of screw terminals to make them easier to connect to. Larger relays could be soldered directly to the pins

My soldering is pretty messy but you get the idea:

I am using ‘Foxx Project’ Z-Wave water sensors obtained from just because I’ve found Foxx devices are actually Aeon Labs and connect perfectly to SmartThings (and they are reasonably cheap in the UK)

Cut the end off the water sensor cable and strip the wires – These two wires are then connected to ‘Common’ and either N/C or N/O on the relay

When connected to N/C the sensor will show DRY when power is applied
When connected to N/O the sensor will show WET when power is applied

For me, I used the N/C connections because I wanted to show wet when power was lost, but it doesn’t really matter because I changed the DTH to show different states in the ‘Things’ view anyway

Once all connected, join the water sensor to SmartThings in the normal way.
(Foxx water sensors just appear as either ‘Generic’ or Aeon Labs)
Applying power to the USB charger will change the state of the water sensor to show wet or dry depending on how it was connected to the relay

I also edited the DTH a little to show Power OK in green or Power Off in red the same as I did here

1 Like

Nice solution! Wanted to throw this out there as well, you can hardware your contact sensor as well so you don’t have to feed it expensive batteries:

Not for my power sensor as the power is cut to the USB charger to show when the mains is off, but I use a little dc-dc voltage reg circuit in my alarm panel to drive the water sensor - power (12vdc) is taken from the connection that powers the PIRs (has a battery backup) dropped down to 3v to drive the water sensors

Ok that wasn’t clear. Figured your water sensor needs power as well which I assume is a battery. I believe a contact sensor could also work instead of the water sensor, which typically work off batteries.

@ritchierich originally I did this with Fibaro door/window switches as they have wired inputs, but I found the water sensors to be about £10.00 cheaper :slight_smile:

My original project was to alert me when the power to the house was off (as it often goes off when we are not at home)

Original project here

For the power relay I originally used 240vac coil relays but found then to get too hot when energised all the time - Hence the USB charger and 5vdc relays :slight_smile:

Water sensor runs for about a year on two AA batteries

I want to know if it is possible to do the inverse (or at least be guided through it)

I have an Alexa and a SmartLife plug. Would it be possible to make Alexa “check” for which device are active and then through IFTTT, send a notification to indicate what devices don’t ping back? I have an appliance in a garage and it would be great to know if the device is out with my Alexa sending me a notification.

Not at the present time, the Echo does not offer this functionality. With the exception of the echo plus model, it just collects the voice request, parses it into something that the system which does control the device will understand, and then passes the request over to it.

Amazon just added in December 2017 the ability for some echo skills to push through notifications to echo, but that’s brand new, and it is up to the device manufacturer to figure out how to use it. It’s still not a native echo ability.