Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome General
 PowerHome Messageboard : PowerHome General
Subject Topic: Midnight Timing Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
seyler
Newbie
Newbie


Joined: December 27 2001
Location: United States
Online Status: Offline
Posts: 9
Posted: December 28 2001 at 15:15 | IP Logged Quote seyler

I'm trying to set it up so that PowerHome decides when to turn off a light based on an elapsed time. I think I've got it figured out when the elapsed time is within the same day, but none of the built in date/time variables seem to understand a specific time delay when it spills over to the next day. Any advice for me?

Thanks!
Steve
Back to Top View seyler's Profile Search for other posts by seyler
 
seyler
Newbie
Newbie


Joined: December 27 2001
Location: United States
Online Status: Offline
Posts: 9
Posted: December 28 2001 at 16:24 | IP Logged Quote seyler

Actually, I've answered my own question. But I thought I would share it, since at this early version of PowerHome there is not a lot in the way of documented samples. What I needed to accomplish was to have a datetime variable set to a specific interval in the future (say 15 minutes.) I originally accomplished this using the secondsafter function. However, if the time is near midnight (say 11:50 pm) then the secondsafter function returns null. I needed to have a variable set to 12:05 am on the next day.

Here is how I accomplished this:
(Note that {OFFICE DURATION} is the time in minutes that I want a particular light to remain on. It is a dynamic variable, dependant on the time of day. {OFFICE OFF TIME} is the variable calculated by this macro which holds the date and time that the light should be turned off. FYI, this function is run every time a motion detector transmits an ON, so the {OFFICE OFF TIME} is continually updated.)

set system
MACRO1
secondsafter(now(),23:59:59)

set system
MACRO2
{OFFICE DURATION}*60

goto label
if([MACRO1]<[MACRO2],"Tomorrow","Today")

label
Today

set global
OFFICE OFF TIME
datetime(today(),relativetime(now(),[MACRO2]))

jump
999

label
Tomorrow

set global
OFFICE OFF TIME
datetime(relativedate(today(),1),relativetime(00:00:00,int([MACRO2])-int([MACRO1])))

If anyone else has interesting macros that they would like to share, I would sure like to see them! I'm trying to come up with creative ways to implement PowerHome.

Regards,
Steve
Back to Top View seyler's Profile Search for other posts by seyler
 

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