Michel De Meester
Posts: 8
Joined: Tue Apr 29, 2014 6:46 am
Location: Antwerp Belgium

Astro Clock

Mon Sep 23, 2019 10:57 am

Hello,

Sorry for writing in "bad English", I'm living in the Flemish speaking part of Belgium.

I am creating a "home alarm system" using a PI2 and Python.

One thing I want to integrate:

You can buy electronic astro clocks where you can enter your location (lat-long).
The clock then calculates the sunrise and sunset and switch the outdoor lights on or off (in Belgium used in street lightning and at many parking areas)

Example:
https://www.distrelec.be/nl/time-clock- ... FwQAvD_BwE

I want to integrate this in software in my alarm system so when an intrusion is detected during "darkness" the pi turn on the lights, while daylight the lights stay off.

Is there a function, module or formule available where I can enter my location and the sunrise and sunset times are calculated?

Thanks in advance
Michel

User avatar
RaTTuS
Posts: 10500
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: Astro Clock

Mon Sep 23, 2019 11:01 am

see sunwait
http://risacher.org/sunwait/
github.com/risacher/sunwait
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

pcmanbob
Posts: 7264
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Astro Clock

Mon Sep 23, 2019 11:04 am

A quick google search found astral 1.10.1

https://pypi.org/project/astral/
https://astral.readthedocs.io/en/stable/index.html

which according to the docs
Astral is a python module for calculating the times of various aspects of the sun and moon.

It calculates the following

Dawn
The time in the morning when the sun is a specific number of degrees below the horizon.
Sunrise
The time in the morning when the top of the sun breaks the horizon (asuming a location with no obscuring features.)
Solar Noon
The time when the sun is at its highest point.
Solar Midnight
The time when the sun is at its lowest point.
Sunset
The time in the evening when the sun is about to disappear below the horizon (asuming a location with no obscuring features.)
Dusk
The time in the evening when the sun is a specific number of degrees below the horizon.
which should do what you want.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

User avatar
peppy.player
Posts: 196
Joined: Mon Mar 07, 2016 6:10 am

Re: Astro Clock

Mon Sep 23, 2019 3:42 pm

If your system will have the Internet access there is one more option - use Yahoo!Weather web service. You can provide either your city and country or latitude/longitude and the service will return weather conditions for today and forecast. That info also includes sunrise and sunset times. Here is the example from Peppy player for Paris. It shows sunset/sunrise times:

Image

User avatar
joelostinspace
Posts: 26
Joined: Sat Aug 10, 2019 2:51 pm
Location: Earth

Re: Astro Clock

Mon Sep 23, 2019 4:57 pm

another option is to use a light sensor- aka photo resistor. https://pimylifeup.com/raspberry-pi-light-sensor/

also check out motioneyeos way to this:https://blog.ligos.net/2016-04-18/Day-N ... nEye.html

I would rather live in a world where my life is surrounded by mystery than a world so small that my mind could comprehend it.


--- Harry Emerson Fosdick

Michel De Meester
Posts: 8
Joined: Tue Apr 29, 2014 6:46 am
Location: Antwerp Belgium

Re: Astro Clock

Thu Oct 03, 2019 11:26 am

pcmanbob wrote:
Mon Sep 23, 2019 11:04 am
A quick google search found astral 1.10.1

https://pypi.org/project/astral/
Indeed Astral does the job, after struggling with timezone included and exluded timeformats everything is working.

Thanks for thinking with me,
Michel

Return to “Python”