Jump to content

Problem with Nightlight Program


pdxcav

Recommended Posts

Posted

This should be really easy (not to mention common scenario)...but I cannot figure out what is wrong. I have this nagging error in one of my programs that I can't figure out. My set-up:

 

TV room has 5 lamps (controlled by various LampLincs) in it, all controlled via a scene that turns them on & off, triggered by a RemoteLinc2.

 

One of the lamps, near the stairs, serves as a nightlight. It is turned on/off automatically around sunrise/sundown.

I wrote a program triggered by the RemoteLinc2 that if the RemoteLinc2 turned off the TV room lights scene and that it was dark out (i.e. nightlights should be on - determined by a variable set by another program), that the lamp by the stairs should be turned back on.

 

What happens is that when I turn off the TV Room lights with the RemoteLinc2, the lights go off as expected, then the nightlight lamp by stairs turns back on (as expected), and then it turns off again. I have no idea why it turns off.

 

Here are the programs:

This turns on/off all nightlights in the house and also sets the nightlight_status variable (integer variable).

If
       From    Sunset  - 30 minutes
       To      Sunrise + 30 minutes (next day)

Then
       $nightlight_status  = 1
       Repeat 2 times
          Set Scene 'Housewide Scenes / Nightlights' On
          Wait  5 seconds

Else
       $nightlight_status  = 0
       Repeat 2 times
          Set Scene 'Housewide Scenes / Nightlights' Off
          Wait  5 seconds

 

This is the program that is triggered by the RemoteLinc2 button being pushed:

If
       $nightlight_status is 1
   And (
            Control 'TV Room / TVR:RemoteLinc2 - A' is switched Off
         Or Control 'TV Room / TVR:RemoteLinc2 - A / TVR:RemoteLinc2 - B' is switched Off
       )

Then
       Wait  2 seconds
       Set 'TV Room / TVR:LampByStairs' On

Else
  - No Actions - (To add one, press 'Action')

 

I added the wait 2 seconds to the 2nd program b/c I thought maybe the program was turning on the lamp b4 the scene was actually completely turned off.

 

I have disabled all other programs in case one of them was being inadvertently triggered. I also watched the events through the event log & sure enough, after all lights are turned off, I see the lamp by stairs being turned back on & then back off.

 

Any help would be greatly appreciated!

Posted

I think there must be another program involved somewhere.

 

-Xathros

Posted

Repeat 2 times

Set Scene 'Housewide Scenes / Nightlights' On

Wait 5 seconds

 

You turn off the lights and while you wait 5 seconds you turn the shade back on. Then this wait finishes and you turn it back off. You shouldn't need the repeat 2 times but if you think you do lower the wait a bit and raise the wait in the other program so they no longer overlap.\

 

edit: Easier fix may be to move the setting of your flag down to after the repeat loop. Timing will still take 10 seconds tho....

Posted

bsobel

 

That activity

 

Repeat 2 times

Set Scene 'Housewide Scenes / Nightlights' On

Wait 5 seconds

 

only happens at Sunset-30. For it to be having an affect the RemoteLinc2 button would have to be pressed within those few seconds. Of course that may be what the OP is doing but I took it to be a scenario not related to the exact Sunset-30 time. Perhaps the OP can clarify when the RemoteLinc2 button is being pressed relative to Sunset-30

Posted
bsobel

 

That activity

 

Repeat 2 times

Set Scene 'Housewide Scenes / Nightlights' On

Wait 5 seconds

 

only happens at Sunset-30. For it to be having an affect the RemoteLinc2 button would have to be pressed within those few seconds. Of course that may be what the OP is doing but I took it to be a scenario not related to the exact Sunset-30 time. Perhaps the OP can clarify when the RemoteLinc2 button is being pressed relative to Sunset-30

 

Oops, concentrated on the then logic and didn't consider the if correctly...

Posted
Post the Program that turns the light Off from the RemoteLinc2 button press.

 

The RemoteLinc2 is the controller of the Scene that controls all of the TV Room lights. So, there is no program to turn those lights on or off. The only program is to detect when OFF is selected & then based on the variable nightlight_status will turn one of the TV Room lights back on (the one by stairs).

Posted

That is the problem. The RemoteLinc2 being a battery RF device sends multiple messages when a button is pressed. It triggers the Program immediately which sets the light On but the RemoteLinc 2 is not done sending its Scene control commands. The solution is to extend the Wait to perhaps 4 seconds to allow the RemoteLinc2 processing to complete.

 

An Event trace of the sequence should help identify how much time is needed to Wait before turn the light On with the Program.

Guest
This topic is now closed to further replies.

×
×
  • Create New...