06-sep: [menu] seccion Domotica (aspiradora+termo), tablets Ines+Carolina en parental, fin-accion limpia chat + vuelve a /menu
This commit is contained in:
@@ -69,9 +69,12 @@ def teclado_principal():
|
||||
[
|
||||
_btn("📺 TV", PREFIJO + "cat:tv"),
|
||||
_btn("👪 Control parental", PREFIJO + "cat:parental"),
|
||||
_btn("🛠️ Sistema", PREFIJO + "cat:sistema"),
|
||||
_btn("🏠 Domótica", PREFIJO + "cat:domotica"),
|
||||
],
|
||||
[
|
||||
_btn("🛠️ Sistema", PREFIJO + "cat:sistema"),
|
||||
_btn("📚 Ayuda (texto)", PREFIJO + "acc:ayuda"),
|
||||
],
|
||||
[_btn("📚 Ayuda (texto)", PREFIJO + "acc:ayuda")],
|
||||
])
|
||||
|
||||
|
||||
@@ -103,6 +106,20 @@ def teclado_nas():
|
||||
_btn("📥 Panel descargas", PREFIJO + "acc:descargas"),
|
||||
_btn("➕ Añadir enlace", PREFIJO + "txt:descargar"),
|
||||
],
|
||||
FILA_VOLVER,
|
||||
])
|
||||
|
||||
|
||||
def teclado_domotica():
|
||||
return _mk([
|
||||
[
|
||||
_btn("🤖 Aspiradora estado", PREFIJO + "acc:aspiradora:estado"),
|
||||
_btn("🧹 Aspirar", PREFIJO + "acc:aspiradora:start"),
|
||||
],
|
||||
[
|
||||
_btn("⏸️ Pausar", PREFIJO + "acc:aspiradora:pause"),
|
||||
_btn("🏠 A la base", PREFIJO + "acc:aspiradora:home"),
|
||||
],
|
||||
[
|
||||
_btn("🔌 Termo ON", PREFIJO + "acc:termo:on"),
|
||||
_btn("🔌 Termo OFF", PREFIJO + "acc:termo:off"),
|
||||
@@ -125,6 +142,10 @@ def teclado_tv():
|
||||
|
||||
def teclado_parental():
|
||||
return _mk([
|
||||
[
|
||||
_btn("🔒 Bloquear tablets", PREFIJO + "acc:tablets:bloquear"),
|
||||
_btn("🔓 Desbloquear tablets", PREFIJO + "acc:tablets:desbloquear"),
|
||||
],
|
||||
[_btn("📋 Listar estado", PREFIJO + "acc:parental_listar")],
|
||||
[
|
||||
_btn("🔒 Desactivar…", PREFIJO + "sub:desactivar"),
|
||||
@@ -261,6 +282,19 @@ def _disp(chat_id, message_id, comando):
|
||||
_cerrar_menu(chat_id, message_id)
|
||||
|
||||
|
||||
def _fin_accion(chat_id):
|
||||
"""Tras una accion: deja ver el resultado, limpia toda la pantalla
|
||||
y deja el mensaje para volver al menu."""
|
||||
import time as _time
|
||||
import pi_bot
|
||||
_time.sleep(4)
|
||||
try:
|
||||
pi_bot.limpiar_pantalla(chat_id)
|
||||
except Exception:
|
||||
pass
|
||||
_enviar_nuevo(chat_id, "✅ Hecho. Pulsa /menu para volver al menú.", None)
|
||||
|
||||
|
||||
# ----------------------------------------------------------------- menu ----
|
||||
|
||||
def enviar_menu(chat_id):
|
||||
@@ -277,6 +311,7 @@ def _header(categoria):
|
||||
"nas": "📥 <b>NAS / Descargas</b>",
|
||||
"tv": "📺 <b>TV</b>",
|
||||
"parental": "👪 <b>Control parental</b>",
|
||||
"domotica": "🏠 <b>Domótica</b>",
|
||||
"sistema": "🛠️ <b>Sistema</b>",
|
||||
"router": "📡 <b>Router ASUS</b>",
|
||||
}
|
||||
@@ -289,6 +324,7 @@ def _abrir_categoria(chat_id, message_id, categoria):
|
||||
"nas": teclado_nas,
|
||||
"tv": teclado_tv,
|
||||
"parental": teclado_parental,
|
||||
"domotica": teclado_domotica,
|
||||
"sistema": teclado_sistema,
|
||||
"router": teclado_router,
|
||||
}
|
||||
@@ -432,6 +468,20 @@ def _ejecutar_accion(chat_id, message_id, partes):
|
||||
if accion == "termo":
|
||||
_disp(chat_id, message_id, f"termo {sub}")
|
||||
return
|
||||
if accion == "aspiradora":
|
||||
if sub in ("estado", "start", "stop", "home", "pause", "locate"):
|
||||
_disp(chat_id, message_id, f"aspiradora {sub}")
|
||||
if sub != "estado":
|
||||
_fin_accion(chat_id)
|
||||
return
|
||||
if accion == "tablets":
|
||||
if sub in ("bloquear", "desbloquear"):
|
||||
verbo = "desactivar" if sub == "bloquear" else "activar"
|
||||
pi_bot.procesar(f"parental {verbo} Inés", chat_id)
|
||||
pi_bot.procesar(f"parental {verbo} Carolina", chat_id)
|
||||
_cerrar_menu(chat_id, message_id)
|
||||
_fin_accion(chat_id)
|
||||
return
|
||||
if accion == "router":
|
||||
mapeo = {
|
||||
"estado": "router estado",
|
||||
|
||||
Reference in New Issue
Block a user