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.

Program Question: Light switches for activity in home

Featured Replies

Posted

Hi-

 

I'm new to programming, so I hope that you'll excuse me if this has been asked and answered before. I did search around a bit before posting, but I can't seem to find the answer to my question. I'm trying to set up a program that only runs during a specific time of day. During that time, if someone turns a light switch on, I would like the system to send me an e-mail. I wrote the program below, and it does work. I get e-mails when a switch is turned on. The only problem is that I get the e-mails outside of the time frame that I'm interested in. Any help or pointers would be appreciated. Thanks.

 

If
       Control 'Hardware / Family Room Light' is switched On
    Or Control 'Hardware / Family Room Light Slave' is switched On
    Or Control 'Hardware / Living Room Lighting' is switched On
    Or Control 'Hardware / Master Bedroom Switch' is switched On
    Or Control 'Hardware / Hallway Switch' is switched On
    Or Control 'Hardware / Kitchen Lighting' is switched On
    Or Control 'Hardware / Master Bedroom Switch' is switched On
   And On Mon, Tue, Wed, Thu, Fri
       From     3:00:00PM
       To       8:00:00PM (same day)

Then
       Send Notification to 'David' content 'Home Active'

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


You need to add parens as indicated below. The Wiki has some good information on order of precedence which affects what statements are Anded and Ored together. Only the last statement above the Time Range was Anded with the Time Range. The other statements being Ored together operated independent of the Time Range.

If
   (
       Control 'Hardware / Family Room Light' is switched On
    Or Control 'Hardware / Family Room Light Slave' is switched On
    Or Control 'Hardware / Living Room Lighting' is switched On
    Or Control 'Hardware / Master Bedroom Switch' is switched On
    Or Control 'Hardware / Hallway Switch' is switched On
    Or Control 'Hardware / Kitchen Lighting' is switched On
    Or Control 'Hardware / Master Bedroom Switch' is switched On
   )
   And On Mon, Tue, Wed, Thu, Fri
       From     3:00:00PM
       To       8:00:00PM (same day)

Then
       Send Notification to 'David' content 'Home Active'

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

  • Author

Lee-

 

Thanks. You've helped me out a lot in the past, so I really appreciate the quick reply. I didn't know that you could add the parenthesis like that, and them move them around. That will help me out a ton in the future!

 

Thanks again for your help.

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.