mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-21 06:54:24 +01:00
upd
This commit is contained in:
@@ -31,7 +31,8 @@ def on_connect(client, userdata, flags, rc):
|
|||||||
client.subscribe("tele/tasmota_nspdev2/RESULT")
|
client.subscribe("tele/tasmota_nspdev2/RESULT")
|
||||||
|
|
||||||
def on_ha_update(entity_id):
|
def on_ha_update(entity_id):
|
||||||
logging.debug(f"{entity_id} updated/state changed")
|
for panel in panels:
|
||||||
|
panel.ha_event_callback(entity_id)s
|
||||||
|
|
||||||
def on_message(client, userdata, msg):
|
def on_message(client, userdata, msg):
|
||||||
try:
|
try:
|
||||||
@@ -41,10 +42,8 @@ def on_message(client, userdata, msg):
|
|||||||
if msg.topic == "tele/tasmota_nspdev2/RESULT":
|
if msg.topic == "tele/tasmota_nspdev2/RESULT":
|
||||||
data = json.loads(msg.payload.decode('utf-8'))
|
data = json.loads(msg.payload.decode('utf-8'))
|
||||||
if "CustomRecv" in data:
|
if "CustomRecv" in data:
|
||||||
# print(data["CustomRecv"])
|
|
||||||
if parts[1] in panels:
|
if parts[1] in panels:
|
||||||
panels[parts[1]].customrecv_event_callback(
|
panels[parts[1]].customrecv_event_callback(data["CustomRecv"])
|
||||||
data["CustomRecv"])
|
|
||||||
else:
|
else:
|
||||||
logging.error(
|
logging.error(
|
||||||
"Got message for unknown panel: %s - %s", parts[1], data["CustomRecv"])
|
"Got message for unknown panel: %s - %s", parts[1], data["CustomRecv"])
|
||||||
|
|||||||
@@ -91,6 +91,11 @@ class LovelaceUIPanel:
|
|||||||
if iid in self.hidden_cards:
|
if iid in self.hidden_cards:
|
||||||
return self.hidden_cards[iid]
|
return self.hidden_cards[iid]
|
||||||
|
|
||||||
|
def on_ha_update(entity_id):
|
||||||
|
logging.debug(f"{entity_id} updated/state changed")
|
||||||
|
# TODO: Check if entity is on current card
|
||||||
|
libs.panel_cmd.entityUpd(self.sendTopic, self.current_card.render())
|
||||||
|
|
||||||
def customrecv_event_callback(self, msg):
|
def customrecv_event_callback(self, msg):
|
||||||
logging.debug("Recv Message from NsPanel: %s", msg)
|
logging.debug("Recv Message from NsPanel: %s", msg)
|
||||||
msg = msg.split(",")
|
msg = msg.split(",")
|
||||||
|
|||||||
Reference in New Issue
Block a user