Sunrise and Sunset time info Control page

Posted on
Sun Jan 27, 2013 8:19 am
McJohn offline
User avatar
Posts: 631
Joined: Dec 18, 2012
Location: The Netherlands

Sunrise and Sunset time info Control page

It's not specially an Indigo 6 question but does anybody know how I can get
the Sunrise and Sunset time info in a Control page?

Thanks for the help and kind regards,

John

Posted on
Sun Jan 27, 2013 12:51 pm
SpencerJRoberts offline
User avatar
Posts: 256
Joined: Dec 09, 2012
Location: Mountain View, CA

Re: Sunrise and Sunset time info Control page

Here's what I do:

Create variables for sunrise and sunset, then make a trigger with the following:
If variable isDaylight changes, always, execute this applescript
Code: Select all
tell application "IndigoServer"
   
   set value of variable "sunrise" to "Sunrise: " & (weekday of (calculate sunrise) as string) & " " & (time string of (calculate sunrise) as string)
   
   
   set value of variable "sunset" to "Sunset: " & (weekday of (calculate sunset) as string) & " " & (time string of (calculate sunset) as string)
   
end tell


Then create two new objects for the variables on your control page and you're good to go! You could run the script once manually to get the initial values, then it will automatically update every sunrise/sunset.

Here's my control page currently (always changing)
Attachments
IMG_0011.PNG
IMG_0011.PNG (184.1 KiB) Viewed 7831 times

Posted on
Mon Jan 28, 2013 9:25 am
McJohn offline
User avatar
Posts: 631
Joined: Dec 18, 2012
Location: The Netherlands

Re: Sunrise and Sunset time info Control page

Hi,

Thanks for the help. Nice control panel!

I made a new Script (and the 2 Variables and Trigger) but I got an error;

error "IndigoServer got an error: Can’t set value of variable \"sunrise\" to \"Sunrise: Tuesday 08:27:03\"." number -10006 from value of variable "sunrise"

When I run this script manually, I got this error in AppleScript and the Variables are not changing.
Do you know what this is?

Thanks for the help and kind regards,

John

Posted on
Mon Jan 28, 2013 9:37 am
McJohn offline
User avatar
Posts: 631
Joined: Dec 18, 2012
Location: The Netherlands

Re: Sunrise and Sunset time info Control page

It works!
Sorry for my stupid question but the Variable Name is case sensitive....
(When the name is lower case (sunrise), it works!

Kind regards,

John

Posted on
Mon Jan 28, 2013 1:41 pm
SpencerJRoberts offline
User avatar
Posts: 256
Joined: Dec 09, 2012
Location: Mountain View, CA

Re: Sunrise and Sunset time info Control page

Glad you got it working!

Posted on
Tue Jan 29, 2013 7:04 am
Dewster35 offline
Posts: 1030
Joined: Jul 06, 2010
Location: Petoskey, MI

Re: Sunrise and Sunset time info Control page

Diggin the control page man! Nice work!

Posted on
Tue Jan 29, 2013 1:53 pm
SpencerJRoberts offline
User avatar
Posts: 256
Joined: Dec 09, 2012
Location: Mountain View, CA

Re: Sunrise and Sunset time info Control page

Thanks! It changes about one a week because our HA system is still growing, but it's getting close to where I want it visually now.

Posted on
Tue Jan 29, 2013 1:54 pm
Dewster35 offline
Posts: 1030
Joined: Jul 06, 2010
Location: Petoskey, MI

Re: Sunrise and Sunset time info Control page

I don't know that these pages ever get "done"... but I like yours. Very clean and can see most stuff at a glance.

Posted on
Thu Jan 31, 2013 4:22 am
Sevilsivle offline
Posts: 122
Joined: Jan 11, 2013

Re: Sunrise and Sunset time info Control page

Hi,

I have a similar setup but have assigned the variables to the 2 objects in such a way that the next event ( either sunrise or sunset) is shown on the left and the event after that on the right.
The script is run by a trigger set when the isDaylight changes.
Code: Select all
tell application "IndigoServer"
   if the (value of variable "isDaylight") is "false" then
      
      set value of variable "LeftSun" to "Sunrise: " & (weekday of (calculate sunrise) as string) & " " & (time string of (calculate sunrise) as string)
      set value of variable "RightSun" to "Sunset: " & (weekday of (calculate sunset) as string) & " " & (time string of (calculate sunset) as string)
      
   else if the (value of variable "isDaylight") is "true" then
      
      set value of variable "LeftSun" to "Sunset: " & (weekday of (calculate sunset) as string) & " " & (time string of (calculate sunset) as string)
      set value of variable "RightSun" to "Sunrise: " & (weekday of (calculate sunrise) as string) & " " & (time string of (calculate sunrise) as string)
      
   end if
end tell


I would like to add icons showing sunrise and sunset but haven't yet found a way of depicting these so that it is immediately evident which is which.
Animated gifs are probably the only way to go!?!

regards

Tim

Posted on
Thu Jan 31, 2013 11:01 am
SpencerJRoberts offline
User avatar
Posts: 256
Joined: Dec 09, 2012
Location: Mountain View, CA

Re: Sunrise and Sunset time info Control page

Good idea Tim! I may modify my setup to this too

Posted on
Thu Jan 31, 2013 2:33 pm
ckeyes888 offline
Posts: 2425
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: Sunrise and Sunset time info Control page

Here's a couple icons that are sized for your page if you like.

Carl
Attachments
sunset.png
sunset.png (4.01 KiB) Viewed 7652 times
sunrise.png
sunrise.png (4.23 KiB) Viewed 7652 times

Posted on
Thu Jan 31, 2013 2:38 pm
SpencerJRoberts offline
User avatar
Posts: 256
Joined: Dec 09, 2012
Location: Mountain View, CA

Re: Sunrise and Sunset time info Control page

ckeyes888 wrote:
Here's a couple icons that are sized for your page if you like.


Thanks!

Posted on
Tue Jul 30, 2013 7:04 am
bmcgowan13 offline
Posts: 67
Joined: Jan 13, 2013

Re: Sunrise and Sunset time info Control page

Not a biggie but the time displayed on my Control Page is off an hour (no doubt due to DST)

tell application "IndigoServer"

set value of variable "sunrise" to "Sunrise: " & " " & (time string of (calculate sunrise) as string)

set value of variable "sunset" to "Sunset: " & " " & (time string of (calculate sunset) as string)

end tell

Is there a way to easily correct this?

Posted on
Tue Jul 30, 2013 8:26 am
jay (support) offline
Site Admin
User avatar
Posts: 18225
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Sunrise and Sunset time info Control page

I'm not quite following: I just tested the calculate sunrise/sunset and it came out correctly. Is it those two times that are incorrect for you? What are the time/date settings of your Mac? You need to make sure that you have the correct city selected in the Time Zone tab of the Date & Time system preference. We use that setting to calculate the next sunrise/sunset unless you override it in the Indigo Preferences by specifying your latitude/longitude.

[EDIT] You may also want to restart the Indigo server - I suppose it may have failed to update the last time DST changed for you.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Jul 30, 2013 11:07 am
bmcgowan13 offline
Posts: 67
Joined: Jan 13, 2013

Re: Sunrise and Sunset time info Control page

Weird. It shows the correct time in the Indigo Preferences panel (Sunrise at 6:46AM) but the display on my Control Page still show sunrise at 7:33:46AM. The two times aren't even in sync.

Could my script be picking up the location from somewhere else? Another location??

Who is online

Users browsing this forum: No registered users and 5 guests