Jump to content

Program Question: Light switches for activity in home


propman07

Recommended Posts

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')


Link to comment

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')

Link to comment

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.

Link to comment

Archived

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


×
×
  • Create New...