Jump to content
View in the app

A better way to browse. Learn more.

Universal Devices Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Nightlight programming assistance

Featured Replies

Posted

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

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

  • Author

Thank you Lee, I will try that solution right away and let you know the results.

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.

  • Author

Thank you, the parentheses resolved the issue and it works properly now.

 

The else was a failed attempt at delaying action in the thought that might solve the problem.

Guest
This topic is now closed to further replies.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.