Skip 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.

Problem with misbehaving simple vacation program

Featured Replies

My wife and I decided to take an overnight trip a few days ago so I created this simple program to make the house look "lived in" that night. I set $sOnVacation (a state variable I had just created) to 1 just before we left, and then set it to zero right after we returned. At 10PM that night the lights turned off unexpectedly. It happened again the next night. Since the variable is 0 (zero), why would it do that? There must be something I'm not understanding. Thanks!

Look Lived In - [ID 0051][Parent 004E]

If

$sOnVacation is 1

And From Sunset

To 10:00:00PM (same day)

Then

Set 'Living room lights' On

Else

Set 'Living room lights' Off

  • Author

But the variable is zero (I triple checked it), and there is an AND clause between the variable check and the From/To statement, so shouldn't the entire program be FALSE all the time? Why would it still trigger at 10PM?

What is happening is that at 10pm, the IF clause will get evaluated.

Since you are home, the variable is 0, so it executes the ELSE.

Think of a time schedule like a variable..if you change the variable, then the IF gets evaluated in any program that has that variable.

The clock is like the variable.. when the time is hit, the IF will be evaluated. This is true for any program that has a schedule.

The simplest thing to do is to split this into two programs. First one evaluates the variable and if true, it enables the second program that has the schedule in the IF and the then and else as you have it. The ELSE in the first program would disable the second program, so that it doesnt run when you are home.

There are many ways to work around what you experiencing.

Create an account or sign in to comment

Account

Navigation

Search

Search

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.