Posts

Showing posts from June, 2025

A newer approach.

    In the last post, I developed a way to use a python script to control my HUE porch lights (front and back porch) to turn on and off at dawn and dusk using 'sunrise' and 'sunset' calculations for my given latitude and longitude.    I tend to be persistant in my searches for answers and knowledge, and, not surpiisngly, I continued the search for rise/set control of my HUE lights.    Success. After a lot of digging and reading and thinking, I came up with a way to program using the HUE bridge's internal 'Daylight' sensor.     Now, all I need to do is use cURL or the CLIP debugger to program the bridge to turn the lights off/on at dawn and dusk.     The 'Daylight' sensor does what my programming does: calculates sunrise and sunset for a given day and latitude/longitude. A boolean variable is set to true or false depending on the time of day and the rise/set times. 'Daylight' is false for night and true for day. There is an offs...

A change in porch light control approach.

     Up to this point, I had, tentatively, decided to use python and bash scipting to create a sysemd service and timer to control the front, and back porch lights, using calculated sunrise and sunset times on a daily basis. The calculations woiuld be done using a python script I translated from a NOAA Excel spreadsheet, years ago. The same script is used to calculate the solar elevation and azimuth plotted in the online graphs..    I've discovered, after extensive searching on the web, there is a ''virtual' sensor in the HUE bridge that performs the same calculations using GPS coordinates supplied by me. I previously discovered how to enter those coordinates and have done so. This morning, I worked to enter the rest of the necessary code.    The success of my efforts remains to be seen.    Tonight the code will be activated for the first time.

Porch lighting schedule upgrade

     The porch lights are on a fixed schedule of 6AM-8PM on/off. The date now is June 5th. Summer is here and the sun sets later than any other time of the year.    In the cominng December, winter, the sun will set earluer than any other time of the year.    The thought occurred to me that the python script I use to calculate solar elevation and azimuth based on time of day, would also be useful for calculating the surise and sunset times for any given day.    Years ago, I downloaded an excel spreadsheet from a NOAA website. That spreadsheet contains formulas for a number of astronomical variables useful in atronomy and weather forecasting.    I stranslated the formulas from the Excel language into the Python language equivalents and placed them in a python script.    I decided to write, and install, a systemd service that calculates the sunrise and sunset times each day. The service then calls curl to write the new schedu...