06-sep: [domotica] Pantalla como dispositivo aparte (comando + submenu)

This commit is contained in:
juanjo
2026-09-06 15:33:20 +02:00
parent df1f7f0d93
commit 7f0769edd2
3 changed files with 50 additions and 20 deletions

View File

@@ -116,6 +116,9 @@ def teclado_domotica():
_btn("🤖 Aspiradora", PREFIJO + "cat:aspi"),
_btn("🔌 Termo", PREFIJO + "cat:termo"),
],
[
_btn("🖥️ Pantalla", PREFIJO + "cat:pantalla"),
],
FILA_VOLVER,
])
@@ -167,6 +170,17 @@ def teclado_termo():
])
def teclado_pantalla():
return _mk([
[
_btn("🖥️ ON", PREFIJO + "acc:pantalla:on"),
_btn("🖥️ OFF", PREFIJO + "acc:pantalla:off"),
_btn("📊 Estado", PREFIJO + "acc:pantalla:estado"),
],
[_btn("⬅️ Domótica", PREFIJO + "cat:domotica")],
])
def teclado_tv():
return _mk([
[
@@ -409,6 +423,7 @@ def _header(categoria):
"aspi": "🤖 <b>Aspiradora</b>",
"potencia": "⚡ <b>Potencia aspiradora</b>",
"termo": "🔌 <b>Termo</b>",
"pantalla": "🖥️ <b>Pantalla</b>",
"sistema": "🛠️ <b>Sistema</b>",
"router": "📡 <b>Router ASUS</b>",
}
@@ -453,6 +468,7 @@ def _teclado_categoria(chat_id, categoria):
"aspi": teclado_aspi,
"potencia": teclado_potencia,
"termo": teclado_termo,
"pantalla": teclado_pantalla,
"sistema": teclado_sistema,
"router": teclado_router,
}
@@ -624,13 +640,13 @@ def _ejecutar_accion(chat_id, message_id, partes):
if accion in directos:
_disp(chat_id, message_id, directos[accion], CAT_ACC.get(accion))
return
if accion == "termo":
if accion in ("termo", "pantalla"):
if sub == "estado":
_reabrir(chat_id, message_id, "termo", "termo estado")
_reabrir(chat_id, message_id, accion, f"{accion} estado")
elif sub in ("on", "off"):
pi_bot.procesar(f"termo {sub}", chat_id)
pi_bot.procesar(f"{accion} {sub}", chat_id)
_cerrar_menu(chat_id, message_id)
_fin_accion(chat_id, "termo")
_fin_accion(chat_id, accion)
return
if accion == "aspiradora":
if sub in ("estado", "stats", "consumibles"):