Backup automatico script del 2026-02-08 07:00

This commit is contained in:
2026-02-08 07:00:03 +01:00
parent d79431ed28
commit 812bcd002c
8 changed files with 1911 additions and 446 deletions
+16 -1
View File
@@ -41,6 +41,7 @@ SEVERE_SCRIPT = os.path.join(SCRIPT_DIR, "severe_weather.py")
ICE_CHECK_SCRIPT = os.path.join(SCRIPT_DIR, "check_ghiaccio.py")
IRRIGATION_SCRIPT = os.path.join(SCRIPT_DIR, "smart_irrigation_advisor.py")
SNOW_RADAR_SCRIPT = os.path.join(SCRIPT_DIR, "snow_radar.py")
FOTOVOLTAICO_SCRIPT = os.path.join(SCRIPT_DIR, "fotovoltaico.py")
# FILE STATO VIAGGI
VIAGGI_STATE_FILE = os.path.join(SCRIPT_DIR, "viaggi_attivi.json")
@@ -237,6 +238,7 @@ def restricted(func):
async def wrapped(update: Update, context: ContextTypes.DEFAULT_TYPE, *args, **kwargs):
user_id = update.effective_user.id
if user_id not in ALLOWED_IDS:
logger.warning("Comando da utente non in ALLOWED_IDS: user_id=%s", user_id)
return
return await func(update, context, *args, **kwargs)
return wrapped
@@ -248,7 +250,7 @@ async def start(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
[InlineKeyboardButton("🛡️ Pi-hole", callback_data="menu_pihole"), InlineKeyboardButton("🌐 Rete", callback_data="menu_net")],
[InlineKeyboardButton("🌤️ Meteo Casa", callback_data="req_meteo_home"), InlineKeyboardButton("📜 Logs", callback_data="menu_logs")]
]
text = "🎛 **Loogle Control Center v8.1**\nComandi disponibili:\n🔹 `/meteo <città>`\n🔹 `/meteo7 <città>` (Previsione 7gg)\n🔹 Pulsanti sotto"
text = "🎛 **Loogle Control Center v8.1**\nComandi disponibili:\n🔹 `/meteo <città>`\n🔹 `/meteo7 <città>` (Previsione 7gg)\n🔹 `/fotovoltaico` (Previsione produzione FV)\n🔹 Pulsanti sotto"
if update.message: await update.message.reply_text(text, reply_markup=InlineKeyboardMarkup(keyboard), parse_mode="Markdown")
else: await update.callback_query.edit_message_text(text, reply_markup=InlineKeyboardMarkup(keyboard), parse_mode="Markdown")
@@ -365,6 +367,18 @@ async def snowradar_command(update: Update, context: ContextTypes.DEFAULT_TYPE)
# Avvia in background
subprocess.Popen(cmd, cwd=SCRIPT_DIR)
@restricted
async def fotovoltaico_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
"""Comando /fotovoltaico: previsione produzione 72h future e curva 48h passate (ICON Italia)."""
chat_id = str(update.effective_chat.id)
cmd = ["python3", FOTOVOLTAICO_SCRIPT, "--telegram", "--chat_id", chat_id]
await update.message.reply_text(
"☀️ **Fotovoltaico**\n\n"
"Generazione curve previsione (72h future + 48h passate)... I grafici verranno inviati a breve.",
parse_mode="Markdown"
)
subprocess.Popen(cmd, cwd=SCRIPT_DIR)
@restricted
async def irrigazione_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
"""Comando /irrigazione: consulente agronomico per gestione irrigazione"""
@@ -849,6 +863,7 @@ def main():
application.add_handler(CommandHandler("road", road_command))
application.add_handler(CommandHandler("irrigazione", irrigazione_command))
application.add_handler(CommandHandler("snowradar", snowradar_command))
application.add_handler(CommandHandler("fotovoltaico", fotovoltaico_command))
application.add_handler(CallbackQueryHandler(button_handler))
job_queue = application.job_queue