Dawn and Dusk Time

Posted on
Tue Jul 09, 2019 3:02 pm
McIntoshBear offline
Posts: 29
Joined: Apr 26, 2019
Location: Massachusetts

Dawn and Dusk Time

On my 35 yo StarGate I implemented a very crude approximation of dawn and dusk time based on the time of year and an approximation from the published calculations I could find at the time. This approximation has served my needs. I now am attempting to re-implement this functionality and others I created in a very different home automation environment - Indigo. I am beginning to teach myself Python and I quickly realized what I now could do if I mastered this new (for me) programing environment.

1. Has anyone wrote a Python script that would calculate the dawn and dusk time in Indigo?
2. Has anyone requested that dawn and dusk times be included in Indigo just like Sunrise and Sunset times can be selected from a drop down?

I know that using a "luminescence" sensor can be used to give an actual light level but I like the idea of being able to use more that 1 bit of information to trigger a lighting event.

I did a search of dawn and dusk and a majority of the posts that my search returned had to do with getting Indigo Sunrise and Sunset times to work correctly. I hope I have not overlooked other relevant posts. If I have please forgive me.

Thank you. :)

Posted on
Tue Jul 09, 2019 3:07 pm
Dual offline
Posts: 255
Joined: Feb 05, 2019

Re: Dawn and Dusk Time

Wouldn’t sunrise and sunset with a time offset be sufficient?


Sent from my iPhone using Tapatalk

Posted on
Tue Jul 09, 2019 3:29 pm
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Dawn and Dusk Time

Here's something I found on slashdot about calculating them in Python. I've never attempted to use that particular library, but maybe it's a start.

[MODERATOR NOTE] moved to a more appropriate forum since it's not specifically about Indigo's Schedule implementation.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Jul 09, 2019 3:37 pm
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Dawn and Dusk Time

I use PyEphem to calculate sun angles so I can lower some shades as needed. Works well. I expect using that library to do dusk/dawn would be similar.

Code: Select all
import ephem

varAzimuth    = indigo.variables[717359973] # "Azimuth"
varElevation  = indigo.variables[719196174] # "Elevation"

(lat, long) = indigo.server.getLatitudeAndLongitude()

obs=ephem.Observer()
obs.lat=str(lat)
obs.long=str(long)
sun = ephem.Sun(obs)

azimuth = float(sun.az) * 57.2957795      # convert radians to degrees
elevation = float(sun.alt) * 57.2957795

indigo.variable.updateValue(varAzimuth, str(azimuth))
indigo.variable.updateValue(varElevation, str(elevation))

# indigo.server.log(u"Sun Azimuth: %s, elevation: %s" % (str(azimuth), str(elevation)))

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Wed Jul 10, 2019 6:04 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Dawn and Dusk Time

If there’s a calculation, I’m happy to add it to the Clock plugin.


Sent from my iPhone using Tapatalk Pro

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 6 guests