Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: When Dark outside... Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
GadgetGeek
Newbie
Newbie


Joined: February 26 2006
Location: United States
Online Status: Offline
Posts: 2
Posted: February 26 2006 at 16:42 | IP Logged Quote GadgetGeek

I searched and searched, and I know it's got to be here somewhere, but I can't find it!

I am looking for a simple way for a macro to only trigger (based on a motion detector) if it's dark outside (after dark, before sunrise).

I have a MS13a that I want to put in my garage. At night when I drive in, it will see the headlights (and the light from the garage door opener) and send a "light" status. I want to turn on certain lights in the house, but only if it's dark outside.

Thanks!



__________________
GadgetGeek
Back to Top View GadgetGeek's Profile Search for other posts by GadgetGeek
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: February 26 2006 at 20:31 | IP Logged Quote TonyNo

Welcome to PH!

One way would be to create two timed events to alternately set a flag to "dark" or "light" and then enable/disable the trigger.

Create a Global Variable, call it "SUN STATE". Create a Timed Event, set the "Timing" to "Dusk", make it a formula, and enter ph_setglobal_s( "SUN STATE", "dark" ). Create another Timed Event, this time set it to "Dawn", and make the formula ph_setglobal_s( "SUN STATE", "light" ).

Now, set the Boolean field for the trigger to be if( "{SUN STATE}" = "dark", 1, 0)

Another way would be to compare the current time to [DAWN] and [DUSK] and enable the trigger that way in the Boolean field.
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
GadgetGeek
Newbie
Newbie


Joined: February 26 2006
Location: United States
Online Status: Offline
Posts: 2
Posted: February 28 2006 at 06:15 | IP Logged Quote GadgetGeek

Thanks! It works great!


__________________
GadgetGeek
Back to Top View GadgetGeek's Profile Search for other posts by GadgetGeek
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum