06-sep: [domotica] Mesillas Meross (comando + submenu)
This commit is contained in:
@@ -118,6 +118,7 @@ def teclado_domotica():
|
||||
],
|
||||
[
|
||||
_btn("🖥️ Pantalla", PREFIJO + "cat:pantalla"),
|
||||
_btn("🛏️ Mesillas", PREFIJO + "cat:mesillas"),
|
||||
],
|
||||
FILA_VOLVER,
|
||||
])
|
||||
@@ -181,6 +182,21 @@ def teclado_pantalla():
|
||||
])
|
||||
|
||||
|
||||
def teclado_mesillas():
|
||||
return _mk([
|
||||
[_btn("📊 Estado mesillas", PREFIJO + "acc:mesilla:estado")],
|
||||
[
|
||||
_btn("🛏️ Juanjo ON", PREFIJO + "acc:mesilla:juanjo:on"),
|
||||
_btn("🛏️ Juanjo OFF", PREFIJO + "acc:mesilla:juanjo:off"),
|
||||
],
|
||||
[
|
||||
_btn("🛏️ Nahid ON", PREFIJO + "acc:mesilla:nahid:on"),
|
||||
_btn("🛏️ Nahid OFF", PREFIJO + "acc:mesilla:nahid:off"),
|
||||
],
|
||||
[_btn("⬅️ Domótica", PREFIJO + "cat:domotica")],
|
||||
])
|
||||
|
||||
|
||||
def teclado_tv():
|
||||
return _mk([
|
||||
[
|
||||
@@ -424,6 +440,7 @@ def _header(categoria):
|
||||
"potencia": "⚡ <b>Potencia aspiradora</b>",
|
||||
"termo": "🔌 <b>Termo</b>",
|
||||
"pantalla": "🖥️ <b>Pantalla</b>",
|
||||
"mesillas": "🛏️ <b>Mesillas</b>",
|
||||
"sistema": "🛠️ <b>Sistema</b>",
|
||||
"router": "📡 <b>Router ASUS</b>",
|
||||
}
|
||||
@@ -469,6 +486,7 @@ def _teclado_categoria(chat_id, categoria):
|
||||
"potencia": teclado_potencia,
|
||||
"termo": teclado_termo,
|
||||
"pantalla": teclado_pantalla,
|
||||
"mesillas": teclado_mesillas,
|
||||
"sistema": teclado_sistema,
|
||||
"router": teclado_router,
|
||||
}
|
||||
@@ -685,6 +703,17 @@ def _ejecutar_accion(chat_id, message_id, partes):
|
||||
"bloquear/desbloquear:",
|
||||
teclado_dispositivos(lista))
|
||||
return
|
||||
if accion == "mesilla":
|
||||
# sub: estado | nombre | nombre:accion
|
||||
rest = ":".join(partes[1:])
|
||||
trozos = rest.split(":")
|
||||
if len(trozos) == 1 and trozos[0] == "estado":
|
||||
_reabrir(chat_id, message_id, "mesillas", "meross estado")
|
||||
elif len(trozos) == 2 and trozos[1] in ("on", "off"):
|
||||
pi_bot.procesar(f"meross {trozos[0]} {trozos[1]}", chat_id)
|
||||
_cerrar_menu(chat_id, message_id)
|
||||
_fin_accion(chat_id, "mesillas")
|
||||
return
|
||||
if accion == "tablets":
|
||||
if sub in ("bloquear", "desbloquear"):
|
||||
verbo = "desactivar" if sub == "bloquear" else "activar"
|
||||
|
||||
Reference in New Issue
Block a user