Author |
|
martlist Newbie
Joined: January 07 2007
Online Status: Offline Posts: 31
|
Posted: April 09 2007 at 13:11 | IP Logged
|
|
|
I have searched but have not been able to find some specific examples of processing based on dusk or sunset.
I have a trigger that executues when the house is empty based on two buttons for my wife and myself. When one of the buttons is pressed I run several tests, one is to see if it is after 5pm and it turns on the porch light if we are both out.
I really want it to use sunset or dusk so I don't have to modify the macro throughout the year. Could anyone tell me how to replace the following:
if( hour(now()) > 17,ph_insteon("PORCHKEY",ion,255),0)
With a test for after sunset?
Martin
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: April 09 2007 at 18:01 | IP Logged
|
|
|
Try...
if( now() > relativetime( 00:00:00, [SUNSET] ), ph_insteon("PORCHKEY",ion,255),0)
|
Back to Top |
|
|
martlist Newbie
Joined: January 07 2007
Online Status: Offline Posts: 31
|
Posted: April 09 2007 at 23:22 | IP Logged
|
|
|
Tony, thankyou for humouring me. Worked a treat. Obvious now I see it.
|
Back to Top |
|
|
skippy31 Newbie
Joined: April 12 2007 Location: Canada
Online Status: Offline Posts: 2
|
Posted: April 12 2007 at 12:09 | IP Logged
|
|
|
I was trying to do something very similar by checking only the hour.
if (hour (now()) > hour(ph_getsuntime(date(today()),2)) and hour(now()) < hour(ph_getsuntime(date(today()),1)), "CONTINUE", "END")
problem is it does not seem to work right. The sunset time was showing up several hours early.
Any thoughts other than doing it as described earlier in this thread?
Skippy31
|
Back to Top |
|
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: April 12 2007 at 19:09 | IP Logged
|
|
|
Welcome to PowerHome!
The earlier-mentioned method is shorter and more to the point, why not use it?
It looks like you are trying to determine if it's after sunset but before sunrise.
Try...
if( now() > relativetime( 00:00:00, [SUNSET] ) or now() < relativetime( 00:00:00, [SUNRISE] ), "CONTINUE", "END")
Edited by TonyNo - April 12 2007 at 19:43
|
Back to Top |
|
|
skippy31 Newbie
Joined: April 12 2007 Location: Canada
Online Status: Offline Posts: 2
|
Posted: April 13 2007 at 16:54 | IP Logged
|
|
|
Yes you exactly right. I have a trigger on my front door that turns on the outside lights and an inside light if I enter the house at night. There is a little more to the macro, but for some reason my method did not work. I was guessing that there is a discrepancy with the date in my function since the sunset time is off by a few hours.
I did end up using the other method and it does work, but just wanted to find out if I had encountered a bug in powerhome, or there was another explanation.
Best Regards,
Skippy31
|
Back to Top |
|
|