Use
At the top of the code are a few user parameters you'll want to update. lat and long are for your latitude and longitude location. This is used with the Open-Meteo API to fetch the sunset time for your location. tz_offset is your GMT timezone offset as an integer (examples: -5 for New York, 9 for Tokyo, Japan). Finally, hanukkah_date carries the month and date for the first day of Hanukkah.
# latitude lat = 42.36 # longitude long = -71.06 # timezone offset from GMT tz_offset = -5 hanukkah_date = [12, 14] # month, date
After updating these values, you can run the code on your MagTag. The project utilizes deep sleep, so you can power it with a battery.
On wake, the MagTag fetches the date and time from the internet. It checks if the date is coinciding with Hanukkah based on the date at the top of the code. This determines how many candles will be lit. The sunset time is fetched and compared to the current time. If it's after sunset, the next candle is lit. Then, the MagTag goes back into deep sleep until sunset the next day.
Page last edited December 18, 2025
Text editor powered by tinymce.