Jump to content

How to return a light to original status in program


AgentAR9

Recommended Posts

Posted

I created a program that would notify me that the garage door has been opened by flashing the hall lights on/off once time. The problem is, if the hall light is already on it remains off because the programs final command is set the light to fast off. What do I need to include in the program to have the light return to its original state, even if the light was on 100% or dimmed?

 

I use the following code:

 

If - garage sensor is off

Then - set hall switch to fast on

set hall switch to fast off

Else - (blank)

 

Thanks

Posted

This would take a variable and a series of programs to accomplish for just On and Off. To capture the Dim state of the light would currently take MANY programs. UDI is working on the next generation firmware that WILL allow us to capture the current dim state and reset it later. That ability is due out early this year I believe. Once we have that capability, it should be a simple change to the programs below to include the dim level. For capturing the On/Off state and resetting, here is the flow:

 

Define an integer Variable: 1.HallLightsOn

 

If Control Garage Sensor is switched Off

Then 
  Run Program Flash1 (If Path)

 

 

Program: Flash1 (Disabled)

If Status Hall Switch is On

Then
  i.HallLightsOn = 1
  Run Program Flash2 (If Path)

Else
  i.HallLighsOn = 0
  Run Program Flash2 (If Path)

 

Program: Flash2

If i.HallLightsOn=1

Then
  Set HallLights FastOff
  Wait 1
  Set HallLights FastOn

Else
  Set HallLights FastOn
  Wait 1
  Set HallLights FastOff

 

Don't forget to set Flash1 as DISABLED or you could end up with a continuously flashing hallway.

Hope this helps.

 

-Xathros

Posted

This will work, but you can also remove the If test from the flash2 program and just have flash1 run the then path or else path based on the check that is already occurring.

Posted

Good point.

 

-Xathros

Posted

I would do something similar but slightly different.

 

If

status hall is not off

and

control garage sensor is switched off

Then

set hall light off

wait 1 second

set hall light on

Else

- -

 

If

status

status hall is off

and control garage sensor is switched off

Then

set hall light on

wait 1 second

set hall light off

Else

- --

Guest
This topic is now closed to further replies.

×
×
  • Create New...