Recover device status after power outage

Hello, I am trying to develop an application to recover the devices status after a power outage.
I’m planning to use a battery powered Arduino + Shield to store the devices status and keep that information during the outage. As soon as the power came back, the Arduino will send the command to turn on to all devices that were turned on before the outage.
Does anybody know if there is an smartapp similar to this, or have any idea for me?
I am a newbie smartthings developer and still don’t have all the knowledge required to develop this app.
I don’t know where to start my search.
Thanks in advance

Here is my CoRE solution that I’m very happy with in my world of ST.

Another thing you can set into motion with CoRE are ‘Sanity Checks’. Little scripts that would turn things off when you know they should be off. For example, nobody is home during the day, so every day at noon, create a CoRE piston that turns off all the lights. Maybe set the same piston to fire off at 3AM for good measure.

1 Like

Obviously everyone has their own needs in this regard, but just something to keep in mind in general engineering best practices it’s fine to turn the lights back on after a power outage, but you typically leave everything else off until a human has reviewed it.

This is for two separate safety reasons.

First, you don’t know what caused the outage when you design the program, and it may have been a faulty or broken device. You don’t always want to turn that one back on right away, particularly if, say, it’s giving off smoke. :wink:

Second, The household requirements may have changed since the time of the power outage just because it’s a different time of day or a different set of people are home. The door that was unlocked at 7 PM when the power went out you might not want to have be unlocked again at three in the morning. Same thing for a television that was on, the coffee pot that was on, etc. The things that you wanted on at 7 PM or not necessarily the same ones that you want on at 3 AM. If the problem had been anything to do with the water pump and the water has drained either during the outage or during repairs, you don’t want it to come back on when the power is restored. So lots of potential issues.

Again, if it’s for your own household you can do whatever you want with it, but this is the usual reason why there isn’t just a standard “restore state” utility except for lights, where it may be annoying, but it won’t usually be unsafe.

1 Like

We should also mention that there’s a popular smart app which does basically the opposite, once the power comes back on, it turns all the smart bulbs off. This is because they’re assuming that the bulbs were off during the day anyway, and they don’t want them coming on in the middle of the night and waking everyone up if there was just a temporary power outage.

You don’t need this kind of smartapp for a smart switch, because those typically remain in the off position when the power comes back on.

But smartbulbs, particularly zigbee smart bulbs, do tend to come on full bright when the power is restored. This is an intentional design, and is intended to handle the situation where someone has manually flipped the wall switch. They will expect the lights to come on when the switch is flipped back on.

But as we mentioned, there are community members who don’t like that feature, and so one community member did write a smartapp that just turns off all the smart bulbs when the power is restored.

So as always, different things work for different households. :sunglasses:

2 Likes

^^^ This! ^^^

As a “computer science guy”, I like to think of complex edge-case scenarios that, after a bunch of thought, aren’t really that unusual or complex after-all!

I wrote a discussion / proposal on the forum a couple years ago, saying that SmartThings should be considered a “state machine”, and that “mode” was being under-leveraged.

Each room, related devices, etc., etc., should have it’s own mode and each mode it’s own schedule and conditions, and modes are not limited to their rooms. “Movie Mode” may set the lights, projector, heating in the Theatre room and also dim lights in other rooms, but also keep on a “popcorn light” in the kitchen, and arm the front-door against monster attacks. When you ask SmartThings to activate this mode, it would turn on/off/dim the various lights, etc., as necessary.

The mode, however, would be set to a predefined sanity schedule, so that if SmartThings was down when the movie is over and came up at 3am, SmartThings would not restore the Movie Mode, but rather either do nothing or transition the state to the “overnight mode”.

Yah – it’s not an easy problem to solve, but it isn’t a graduate thesis either.

3 Likes