Open Tigwin opened 1 year ago
I used this to get the current date: https://learn.adafruit.com/adafruit-funhouse/getting-the-date-time
This seems to work to do what I wanted (I shift the time around during the day so its not the same leds lit all the time):
def clear_flight():
aio_username = secrets["aio_username"]
aio_key = secrets["aio_key"]
location = secrets.get("timezone", None)
TIME_URL = "https://io.adafruit.com/api/v2/%s/integrations/time/strftime?x-aio-key=%s&tz=%s" % (aio_username, aio_key, location)
TIME_URL += "&fmt=%25Y-%25m-%25d+%25H%3A%25M%3A%25S.%25L+%25j+%25u+%25z+%25Z"
response = requests.get(TIME_URL)
tmp_text=response.text
hour=tmp_text[11:13]
if tmp_text[11:13] == "13": hour=" 1"
if tmp_text[11:13] == "14": hour=" 2"
if tmp_text[11:13] == "15": hour=" 3"
if tmp_text[11:13] == "16": hour=" 4"
if tmp_text[11:13] == "17": hour=" 5"
if tmp_text[11:13] == "18": hour=" 6"
if tmp_text[11:13] == "19": hour=" 7"
if tmp_text[11:13] == "20": hour=" 8"
if tmp_text[11:13] == "21": hour=" 9"
if tmp_text[11:13] == "22": hour=" 10"
if tmp_text[11:13] == "23": hour=" 11"
mins=tmp_text[14:16]
label1.text=""
label2.text=hour+":"+mins
label3.text=""
Nice. Yeah, you could put anything you wanted in at that point really and it will run it/show it whenever it doesn't find a flight.
Note that in your example 'X-AIO-Key' is case sensitive.
Thanks for the example, it works well, and is a cool addition to the Flightportal
My flight portal is working great, but I was thinking about moving out of my office and into my back yard by my pool. That way if I hear a plane and see a plane, I can easily learn more about it. Right now I have a clock mounted on a wall by the pool, and I was thinking it would be great if the matrix display would show the time when no flights are seen, that way it can have dual purpose.
Dumb or good idea?