Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: dusk & sunset checking Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
martlist
Newbie
Newbie


Joined: January 07 2007
Online Status: Offline
Posts: 31
Posted: April 09 2007 at 13:11 | IP Logged Quote martlist

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 View martlist's Profile Search for other posts by martlist
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: April 09 2007 at 18:01 | IP Logged Quote TonyNo

Try...

if( now() > relativetime( 00:00:00, [SUNSET] ), ph_insteon("PORCHKEY",ion,255),0)
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
martlist
Newbie
Newbie


Joined: January 07 2007
Online Status: Offline
Posts: 31
Posted: April 09 2007 at 23:22 | IP Logged Quote martlist

Tony, thankyou for humouring me. Worked a treat. Obvious now I see it.
Back to Top View martlist's Profile Search for other posts by martlist
 
skippy31
Newbie
Newbie


Joined: April 12 2007
Location: Canada
Online Status: Offline
Posts: 2
Posted: April 12 2007 at 12:09 | IP Logged Quote skippy31

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 View skippy31's Profile Search for other posts by skippy31
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: April 12 2007 at 19:09 | IP Logged Quote TonyNo

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 View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
skippy31
Newbie
Newbie


Joined: April 12 2007
Location: Canada
Online Status: Offline
Posts: 2
Posted: April 13 2007 at 16:54 | IP Logged Quote skippy31

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 View skippy31's Profile Search for other posts by skippy31
 

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