Jump to content

Preserve state variable value after power failure


Recommended Posts

Posted

I have a motion sensor that detects the presence of my car in the garage.  The presence or absence (1 or 0) is saves in a state variable, $caringarage.  When there is a power failure or any event that causes the Polisy to re-initialize, $caringarage is reset to 0.  The ISY manual shows a way to preserve the state variable value, but the syntax is confusing.  Any suggestions/examples?

Posted

There is a way. Right after you set the variable, put an 'init to' as the next program statement with the same value. It will survive the  reboot.

Posted (edited)

Here's an example I use to keep data for my sump pump. You' ll always need two variable statements, one to assign the value, and one to tell the isy to remember it even if it reboots.

If
        'TimeData' Day of Month is 1 days
    And Time is 11:59:55PM
 
Then
        $Sump_Pump_Maximum_daily_Gallons  = $Sump_Pump_Gallons_Daily
        $Sump_Pump_Maximum_daily_Gallons Init To $Sump_Pump_Maximum_daily_Gallons

Edited by paulbates
  • Like 1
Guest
This topic is now closed to further replies.

×
×
  • Create New...