Jump to content

Trying to create a program that turns house off if no motion


silverton38

Recommended Posts

Since in my area it's quite common to have milliseconds long power outages, I have always in mind that possibility when making a program and I try to address it. In this case, what would you suggest to make it power failure proof? I thought to have the same "wait for 24 hours then off" in the else clause & then make the program run at startup.

 

What do you say?

 

Sent from my SPH-D710 using Tapatalk 2

Link to comment

If you are concerned with ISY not knowing that a power outage occurred, you can write a script on a computer that posts a variable to ISY on reboot. Of course you need the computer set to reboot with power restoration. The variable could say be set to 1 by the script. When that happens an iSY program could trigger a query and then reset the variable to 0.

Link to comment

silverton38-

 

I have a series of programs that handle occupancy detection for me. Pretty sure they will survive a power outage for the most part. Here is how it works:

 

State mvar for detection delay. In my case 45 minutes, in yours, 24 hours.

 

First program monitors motion sensors and a list of switch try devices. Idea here is in the areas with no motion detection, someone operating a switch says occupied as well. When any activity is detected, the detection delay mvar gets reset to 45 (24 for yours)

 

Second program says if detection delay >0, set detection delay mvar init to detection delay mvar, wait 1 minute (1 hr for you) and subtract 1. This restarts the 1 minuet (hour) timer since the state var changes. The set init is the part that solves for power outages. Set this to run at startup.

 

Third program runs on detection delay mvar reaching 0. This is where you turn off your scene. Then set the delay mvar < 0 to disable till next detection.

 

Prog#1
If 
 motion detected

then
  s.occupancyDelay = 45


Prog#2
if 
  s.occupancyDelay > 0

then
  s.occupancyDelay InitTo s.occupancyDelay
  wait 1
  s.occupancyDelay =- 1


Prog#3
if 
  s.occupancyDelay = 0

then
  Set scene MostLights Off
  s.occupancyDelay InitTo -1
  s.occupancyDelay = -1

 

Hope this helps. My progs are a bit more involved as I'm tracking occupancy statistics as well but this should meet your needs.

Link to comment

Thanks for all the suggestions. However there are several types of Insteon devices which revert to an off state after a power failure. I have made ISY programs for those devices to make them go back to the state they were before the power outage. In order for this to work the ISY has to know that a power failure occured. So I rather don't have the ISY on a UPS, and just design all my programs in such a way with the possibilty of a power failure in mind.

 

Sent from my SPH-D710 using Tapatalk 2

Link to comment

Thank You very much for this program. It is exactly what I am looking for.

 

I entered the program pretty much as you listed. I do notice the the second and third program do not seem to run unless I right click "RUN(if)".

 

 

silverton38-

 

I have a series of programs that handle occupancy detection for me. Pretty sure they will survive a power outage for the most part. Here is how it works:

 

State mvar for detection delay. In my case 45 minutes, in yours, 24 hours.

 

First program monitors motion sensors and a list of switch try devices. Idea here is in the areas with no motion detection, someone operating a switch says occupied as well. When any activity is detected, the detection delay mvar gets reset to 45 (24 for yours)

 

Second program says if detection delay >0, set detection delay mvar init to detection delay mvar, wait 1 minute (1 hr for you) and subtract 1. This restarts the 1 minuet (hour) timer since the state var changes. The set init is the part that solves for power outages. Set this to run at startup.

 

Third program runs on detection delay mvar reaching 0. This is where you turn off your scene. Then set the delay mvar < 0 to disable till next detection.

 

Prog#1
If 
 motion detected

then
  s.occupancyDelay = 45


Prog#2
if 
  s.occupancyDelay > 0

then
  s.occupancyDelay InitTo s.occupancyDelay
  wait 1
  s.occupancyDelay =- 1


Prog#3
if 
  s.occupancyDelay = 0

then
  Set scene MostLights Off
  s.occupancyDelay InitTo -1
  s.occupancyDelay = -1

 

Hope this helps. My progs are a bit more involved as I'm tracking occupancy statistics as well but this should meet your needs.

Link to comment
Thank You very much for this program. It is exactly what I am looking for.

 

I entered the program pretty much as you listed. I do notice the the second and third program do not seem to run unless I right click "RUN(if)".

 

 

You need to use "State" variables. State variables trigger the if to run every time they change. You probably are using integer variables. And as mentioned, the second program needs to be set to run at startup to get the ball rolling again after a power failure.

Link to comment

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...