Jump to content

Nightlight programming assistance


PGME

Recommended Posts

For the life of me I can't get what I would consider to be a simple program to operate correctly. I'm sure someone out there has done this before and gotten it to work properly and can spot my error.

 

After sunset when certain lights are turned off the program should trigger a nightlight to be turned on. The problem is that the nightlight always comes on, even when it's not sunset. My first attempt to get this to work involved setting the sunrise/sunset right in the program. But since I have moved onto creating a variable for night. If the sun has set (night time) = 1, if the sun is out (daytime) = 0.

 

Any help on getting this program to function ONLY when it's dark outside?

 

-----------

 

If

$Night is 1

And Control '1ST FLOOR / Kitchen Sink' is switched Off

Or Control '1ST FLOOR / Kitchen' is switched Off

Or Control '1ST FLOOR / Kitchen Sink / Kitchen Sink.D.OFF' is switched Off

Or Control '1ST FLOOR / Kitchen Table / Kitchen Table.D.OFF' is switched Off

Or Control '1ST FLOOR / Kitchen / Kitchen.D.OFF' is switched Off

Or Control '1ST FLOOR / Mud Room / Mud Room.D.OFF' is switched Off

Or Control '1ST FLOOR / TV Remote( IRLink) / TV Remote.J.HOME' is switched Off

 

Then

Set '1ST FLOOR / Kitchen Under.Stove' 20%

Set '1ST FLOOR / Kitchen Sink' 24%

 

Else

Wait 15 seconds

Link to comment

Parens are needed for the IF to work. The variable is ANDed with the first and only the first Control statement without the parens.

 

If $Night is 1

And

(

Control '1ST FLOOR / Kitchen Sink' is switched Off

Or Control '1ST FLOOR / Kitchen' is switched Off

Or Control '1ST FLOOR / Kitchen Sink / Kitchen Sink.D.OFF' is switched Off

Or Control '1ST FLOOR / Kitchen Table / Kitchen Table.D.OFF' is switched Off

Or Control '1ST FLOOR / Kitchen / Kitchen.D.OFF' is switched Off

Or Control '1ST FLOOR / Mud Room / Mud Room.D.OFF' is switched Off

Or Control '1ST FLOOR / TV Remote( IRLink) / TV Remote.J.HOME' is switched Off

)

 

Then

Set '1ST FLOOR / Kitchen Under.Stove' 20%

Set '1ST FLOOR / Kitchen Sink' 24%

 

Else

Wait 15 seconds

 

Also note that the Wait 15 in the Else clause serves no function since there are no statements after the Wait

Link to comment

Are you setting nighttime=0 every time you set daytime=1 and vice versa. I only use one variable for this since you'd have to change both each time anyways. daytime=1 means the sun is shining. daytime=0 means the sun is not shining (night time).

 

Should the nightlight turn on only when ALL those lights are off or any one is off? You'll need parentheses for the Or clauses.

Link to comment

Archived

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


×
×
  • Create New...