Backup automatico script del 2026-07-26 07:00

This commit is contained in:
daniele committed 2026-07-26 07:00:01 +02:00
1 parent 4802b021fe
commit a9bbb92090
19 files changed
+1086 -550

No files matched your search

@@ -814,12 +814,30 @@ def analyze_all_locations(debug_mode: bool = False) -> None:
return
ok = telegram_send_html(msg, chat_ids=[TELEGRAM_CHAT_IDS[0]] if debug_mode else None)
web_ok = False
try:
from webapp_alert import publish_web_alert
web_ok = bool(publish_web_alert(msg, "severe_circondario", "warning", is_html=True, state=state))
except Exception as e:
LOGGER.debug("Web summary failed: %s", e)
delivered = bool(ok or web_ok)
if ok:
LOGGER.info("Alert inviato (%s) per %d località significative", category, len(significant_locations))
LOGGER.info("Alert inviato su Telegram (%s) per %d località significative", category, len(significant_locations))
elif web_ok:
LOGGER.info("Alert pubblicato su WebApp (%s) per %d località significative", category, len(significant_locations))
else:
LOGGER.warning("Alert NON inviato (token missing o errore Telegram)")
if ok and not debug_mode:
try:
from telegram_gate import telegram_alerts_enabled
suspended = not telegram_alerts_enabled()
except Exception:
suspended = False
if suspended:
LOGGER.warning("Alert NON pubblicato su WebApp (Telegram sospeso)")
else:
LOGGER.warning("Alert NON inviato (errore Telegram o WebApp)")
if delivered and not debug_mode:
record_notify(category, now, state)
state["last_signature"] = signature
state["last_signature_date"] = today