mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-20 22:47:01 +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")
|
||||
|
||||
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):
|
||||
try:
|
||||
@@ -41,10 +42,8 @@ def on_message(client, userdata, msg):
|
||||
if msg.topic == "tele/tasmota_nspdev2/RESULT":
|
||||
data = json.loads(msg.payload.decode('utf-8'))
|
||||
if "CustomRecv" in data:
|
||||
# print(data["CustomRecv"])
|
||||
if parts[1] in panels:
|
||||
panels[parts[1]].customrecv_event_callback(
|
||||
data["CustomRecv"])
|
||||
panels[parts[1]].customrecv_event_callback(data["CustomRecv"])
|
||||
else:
|
||||
logging.error(
|
||||
"Got message for unknown panel: %s - %s", parts[1], data["CustomRecv"])
|
||||
|
||||
@@ -91,6 +91,11 @@ class LovelaceUIPanel:
|
||||
if iid in self.hidden_cards:
|
||||
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):
|
||||
logging.debug("Recv Message from NsPanel: %s", msg)
|
||||
msg = msg.split(",")
|
||||
|
||||
Reference in New Issue
Block a user