Boot Detection / Run Piston Once on Boot


#1

I have a problem on power outages where my presence sensor turns Not Present and when the power comes back, I become Present again. I want to restrict those pistons from running if the hub has just booted up in the last 10 minutes.

So I need something like Hub Uptime or the last boot time. Or, I need to just run a piston at boot time and use a global variable and some Wait statements. So…

How do I run a piston once on hub boot up?
Or suggest a different solution?

PS. I don’t want to rely on the power source property because the batteries often die and it never gets to the battery state. At this point, I just have a UPS and no batteries in it.


#2

I’m trying to understand your issue.

You have (apparently) frequent power outages.

You don’t have batteries in your hub (because they die)

You have the device on a UPS.

But even with the UPS the hub still shuts off during a power outage?

I feel like I’m not understanding or missing something.


#3

Yes, lately, frequent power outages.
The UPS only lasts a couple of hours.
If the power comes back on in the middle of the night, my “now present” pistons run. I want to stop that from happening if the hub recently booted up.

For example, my entry light turns on when I get home. I don’t want that to happen in the middle of the night. I also wanted my door to unlock, but not with this problem. It will unlock while I’m sleeping.


#4

I’m unaware of any variable that is reset upon hub reboot. Maybe someone else knows of one.

I’m trying to think of something with a 110 volt relay and a senor that reports to smartthings that the power is out. Let me sleep on it.


#5

It requires a bit of preparation, but one thing that ALWAYS happens in my house after the power returns is certain lights will come back on to 100% brightness.

Knowing this, I am careful to never program any bulb to ever go higher than level 99%. This way, I have ST monitor one bulb, and whenever it goes to 100% brightness, it knows that the power is back on. At that point, it runs a fairly complex piston to automatically get things back to the way I like them.

It works like a champ, as long as you never allow webCoRE (or your household) to turn that bulb to 100%. (a bulb in a rarely used closet works perfect for this… with motion in the closet set to turn light on to 99% or less. Basically, you want to be monitoring a bulb that is never turned on manually by a wall switch, and make sure no pistons ever turn that bulb to full brightness)


#6

You could build a device based on a econet contact sensor and a US charger plug to detect when your power is out. When out you can pause your presence sensor piston, then you can say after your home power stays on “mains” for 5 minutes, un-pause that piston. Make sense?


#7

Clever. That could work. I was thinking of putting a spare Phillips Hue bulb in a closet with a motion sensor. I know those always come back on at 100% and soft white.

Too bad I would have to resort to that. I haven’t looked, but it would be nice if ST and/or webcore could expose the hub’s last boot time I see in the IDE.


#8

I get it. However, I did try something else with “stays mains” but it never got triggered because it never went away from “mains”. I guess I should put to backup batteries back into the hub. That would at least make it change to “battery” before it eventually dies completely.


#9

Well, you need to make your own Sensor and not use the hubs on battery/on mains. You need an EcoNet contact Sensor. I’ll see if I can find a link to a post or two explaining how to build it.


#10

Oh, I see. Not the hub’s power at all. Just the sensor.


#11

You could always store the last boot time into a variable whenever the closet light turns to 100%.


Hubpowersource or Hub Power source does not
#12

Here is some info. My setup works the same, but I use a relay to not apply the voltage to the circuit.


#13

Oh, I also built a custom DH for this device.


#14

Actually the sensor still uses the battery. But when the plug loses power the contact opens on the contact sensor.


#15

Well, I decided to try putting the batteries back in my hub and unplugging it to test using the Hub Power Source property. But it doesn’t seem to change to “battery”, even after I see webCoRE add the little red battery icon on its home page. Here is what I tried.


#16

I realize I need an else-if on the bottom. Just ignore that unless it is pertinent.


#17

Here is a better attempt, but still no luck getting into the first If block.


#18

I’ve never trusted the power source, but… try this just to see if you get anything. I don’t have batteries in mine so I can’t test.


#19

Nothing. No events. I kept it unplugged for a few minutes. I don’t know if it would have triggered eventually. Maybe I’ll try for longer.

Anyway to access “Hub power source” in the evaluation console? I can’t figure out what device name to put. I tried Hub, Home, and Home Hub, and Location?


#20

I still love the idea of this:

IF Closet Bulb's level is 100%
THEN execute piston

Simple, clean, and rock solid reliable…

The only pitfall really is it won’t trigger until the power comes back on… (but this really isn’t so bad because 98% of devices would not have power during an outage anyways)