Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Bug Reports
 PowerHome Messageboard : PowerHome Bug Reports
Subject Topic: ph_getsuntime ( dt, type ) Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
smarty
Super User
Super User
Avatar

Joined: May 21 2006
Location: United States
Online Status: Offline
Posts: 728
Posted: March 13 2007 at 07:37 | IP Logged Quote smarty

Not sure if this is a bug or not.......

I guess this function DOES NOT take Daylight Savings Time into account when it returns Sunrise/Sunset Dawn/Dusk times?? (documentation makes no mention if DST is applied or not).

My location is set properly, but my times seem off by about an hour.

__________________
Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
Back to Top View smarty's Profile Search for other posts by smarty
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: March 13 2007 at 13:20 | IP Logged Quote TonyNo

Mine is working correctly.
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
smarty
Super User
Super User
Avatar

Joined: May 21 2006
Location: United States
Online Status: Offline
Posts: 728
Posted: March 13 2007 at 14:31 | IP Logged Quote smarty

I wonder......

I patched my XP system with the Microsoft just a few nights ago (I routinley keep auto update OFF and do patch updates only about 4/year). Prior to doing the patch updates I already had the latest version of PH on my machine.

I wonder if the PH function relies in anyway on the Microsoft patch, and the order of installation????

To be very clear...

For me, the fuction doesn't work, even though my XP system is now patched.

__________________
Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
Back to Top View smarty's Profile Search for other posts by smarty
 
smarty
Super User
Super User
Avatar

Joined: May 21 2006
Location: United States
Online Status: Offline
Posts: 728
Posted: March 13 2007 at 19:45 | IP Logged Quote smarty

ph_getsuntime(date("03/13/2007"),1) <=Sunrise
Formula Evaluation
     The formula evaluates to: 07:02:48 <=close????


ph_getsuntime(date("03/13/2007"),2) <=Sunset
Formula Evaluation
     The formula evaluates to: 17:26:59 <=about5:30 pm
????


From Weather.com (for San Antonio)
Sunrise = 7:46 am
Sunset = 7:41pm



Both my production machine and experimental machine perform the same with this function. I update my experimental machine will all patches as soon as they are released (auto-update).

__________________
Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
Back to Top View smarty's Profile Search for other posts by smarty
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: March 13 2007 at 20:08 | IP Logged Quote TonyNo

Maybe a clue...

ph_getsuntime( today(), 2) = 19:00:19 <- Correct

ph_getsuntime( date( "03/13/2007"), 2) = 16:25:12

ph_getsuntime( date( today()), 2) = 16:25:12

Maybe a date() problem?
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: March 13 2007 at 20:29 | IP Logged Quote dhoward

Ok, Ive checked this out and I think Tony has hit upon the problem. First, the ph_getsuntime function is strictly math based upon the date passed to it and the longitude and latitude defined in the Setup screen. It also takes the daylight savings time formula into effect. It doesnt depend upon anything Windows (I don't know if thats a blessing or a curse ).

The problem is that the ph_getsuntime formula is expecting a datetime value. It definately blows up with just a date value. The today() function returns a datetime and so it works.

The proper way to structure a date value in PowerHome is yyyy-mm-dd. It doesnt require any quotes or similar. A datetime is structured yyyy-mm-dd hh:mm:ss. So, to get the function working with your data, you should be able to do this: ph_getsuntime(2007-03-13 00:00:00,1). You can also use the format that is above, but need to use the datetime function instead: ph_getsuntime(datetime("03/13/2007"),1).

Try this out and let me know how it goes.

Dave.


Edited by dhoward - March 13 2007 at 20:30
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
smarty
Super User
Super User
Avatar

Joined: May 21 2006
Location: United States
Online Status: Offline
Posts: 728
Posted: March 13 2007 at 20:40 | IP Logged Quote smarty

SUPER!! That will work. The only reason I was using a date (only) value was that was how I intrepreted the function help (see below).


ph_getsuntime ( dt, type )
Argument Description
dt The date that you wish to retrieve the sun time for.
type The type of sun calculation you wish returned. Use 1 for Sunrise, 2 for Sunset, 3 for Dawn (start of civil twilight), and 4 for Dusk (end of civil twilight).

Return value
Time. The time of the specified sun calculation for the specified date.


__________________
Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
Back to Top View smarty's Profile Search for other posts by smarty
 
Viper
Groupie
Groupie


Joined: January 14 2007
Location: United States
Online Status: Offline
Posts: 88
Posted: March 19 2007 at 11:38 | IP Logged Quote Viper

I haven't done any testing, but you may want to use a different time value as the time change really occurs somewhere between 1:00, 2:00, or 3:00AM depending on where you are and which way things are changing. So March 11th was both a "Daylight Savings Time day" and also not a "Daylight Savings Time day".

Another thing to consider is that 2:30 am on March 11th did not exist.
Back to Top View Viper's Profile Search for other posts by Viper
 

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