Once the project code and assets have been installed to the Magtag, edit the code.py file to make configuration changes as described below.
All changes are made by editing this small code block found at the top of the code listing:
# --| USER CONFIG |-------------------------- LAT = 47.6 # latitude LON = -122.3 # longitude TMZ = "America/Los_Angeles" # https://en.wikipedia.org/wiki/List_of_tz_database_time_zones METRIC = False # set to True for metric units # -------------------------------------------
Set Location
The Open-Meteo API currently only works with location specified by latitude and longitude. There's a simple geocoding API accessible here:
that can be used to find the latitude and longitude for your location. Search for your location and then find the appropriate latitude and longitude in the results table.
Update these lines of code with the latitude (LAT) and longitude (LON) values:
LAT = 47.6 # latitude LON = -122.3 # longitude
Set Timezone
The timezone for the location also needs to be specified. Use the link below to find the appropriate name to use:
Use the text from the TZ indentifier column in the timezone list table and update this line of code:
TMZ = "America/Los_Angeles" # https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
NOTE: The TMZ value must be set as a string, so don't forget the surrounding quotation marks.
Set Units
The units used for temperature and wind speed can be set to either imperial (deg F, mph) or metric (deg C, kmh). By default, imperial is used. To switch to metric, set the METRIC option to True:
METRIC = True # set to True for metric units
Page last edited October 09, 2024
Text editor powered by tinymce.