Dear Tidbyt-Developer
As a beginner, I have a question about the refresh of the app. There is function which gathers data from a public API and returns the values for later usage. In main, the function is executed, the values are formatted and shown on the display.
I have pushed the App locally for testing purposes with
pixlet render sbb.star
pixlet push --installation-id my-id ...
But, the App still shows the same values, there is no refresh. How can I force it, if the App rotates or by time, the values are updated?
Here is the function:
def get_delay():
response = http.get(STATIONTABLE_URL)
if response.status_code != 200:
fail("Stationtable request failed with status %d", response.status_code)
json_data = response.json() # Parse the response as JSON
if "stationboard" in json_data and len(json_data["stationboard"]) > 0:
delay = json_data["stationboard"][0]["stop"]["delay"]
name = json_data["station"]["name"]
departure = json_data["stationboard"][0]["stop"]["departure"]
return delay, name, departure
else:
return None
Regards,
Martin