Skip to content
This repository has been archived by the owner on Dec 23, 2024. It is now read-only.

Commit

Permalink
Update alert message to include the current pollution level
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielSzewczuk committed Oct 27, 2024
1 parent 46f42e1 commit 40b6dcb
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def send_notification(alert_level, avg_pm25, avg_pm10, avg_pm1):
"Powietrze wróciło do normy. :white_check_mark:\n"
"Jakość powietrza jest teraz w bezpiecznych granicach.\n"
"Więcej informacji znajdziesz tutaj: <https://czystybialystok.pl|CzystyBialystok.pl>\n"
"powered by <https://airalert.dlsk.tech/|AirAlert>"
"Powered by <https://airalert.dlsk.tech/|AirAlert>"
)
elif alert_level < current_alert_level:
emoji = EMOJIS[alert_level]
Expand All @@ -94,19 +94,24 @@ def send_notification(alert_level, avg_pm25, avg_pm10, avg_pm1):
f"PM10: {avg_pm10:.2f} µg/m3\n"
f"PM1: {avg_pm1:.2f} µg/m3\n"
"Więcej informacji znajdziesz tutaj: <https://czystybialystok.pl|CzystyBialystok.pl>\n"
"powered by <https://airalert.dlsk.tech/|AirAlert>"
"Powered by <https://airalert.dlsk.tech/|AirAlert>"
)
else:
emoji = EMOJIS[alert_level]
alert_text = "podwyższony" if alert_level == 1 else "wysoki"
if alert_level == 1:
alert_text = "podwyższony"
elif alert_level == 2:
alert_text = "wysoki"
elif alert_level == 3:
alert_text = "bardzo wysoki"
message = (
f"{emoji} Uwaga! {alert_text.capitalize()} poziom zanieczyszczeń:\n"
f"{emoji} Uwaga! Wzrost poziomu zanieczyszczeń! Aktualnie poziom zanieczyszczeń jest {alert_text}.\n"
f"PM2.5: {avg_pm25:.2f} µg/m3\n"
f"PM10: {avg_pm10:.2f} µg/m3\n"
f"PM1: {avg_pm1:.2f} µg/m3\n"
f"Poziom zagrożenia: {alert_level}\n"
"Więcej informacji znajdziesz tutaj: <https://czystybialystok.pl|CzystyBialystok.pl>\n"
"powered by <https://airalert.dlsk.tech/|AirAlert>"
"Powered by <https://airalert.dlsk.tech/|AirAlert>"
)

payload = {"text": message}
Expand Down

0 comments on commit 40b6dcb

Please sign in to comment.