This commit is contained in:
Wiktor Przybylski 2024-12-01 22:42:49 +01:00
parent 950c678492
commit dbe04fe53e
1 changed files with 4 additions and 4 deletions

8
app.py
View File

@ -122,7 +122,7 @@ def fetch_hourly_forecast():
return response.json()
def create_payload(icon, text1="", text2=None, font="(5) LITERY 112X17", invert=False, auto_break=False, align="center"):
def create_payload(icon, text1="", text2=None, font=text_font, invert=False, auto_break=False, align=text_align):
result = {
"addition": {
"addition_type": "icon",
@ -137,7 +137,7 @@ def create_payload(icon, text1="", text2=None, font="(5) LITERY 112X17", invert=
"font": font,
"invert": invert,
"auto_break": auto_break,
"align": "center"
"align": align
})
if text2:
result["lines"].append({
@ -145,7 +145,7 @@ def create_payload(icon, text1="", text2=None, font="(5) LITERY 112X17", invert=
"font": font,
"invert": invert,
"auto_break": auto_break,
"align": "center"
"align": align
})
return result
@ -212,7 +212,7 @@ def send_mqtt(page, payload):
def main():
current_weather = fetch_current_weather()
forecast = fetch_hourly_forecast()
payloads = generate_payload(current_weather, forecast, font=text_font, align=text_align)
payloads = generate_payload(current_weather, forecast)
if is_post:
clean()
for i, payload in enumerate(payloads):