Skip to content

Commit

Permalink
send dimmode and timeout only on startup and update
Browse files Browse the repository at this point in the history
  • Loading branch information
joBr99 committed Nov 24, 2023
1 parent 99ebaa0 commit 9a4a42f
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions nspanel-lovelace-ui/rootfs/usr/bin/mqtt-manager/panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def searchCard(self, iid):
return self.hidden_cards[iid]

def ha_event_callback(self, entity_id):
#logging.debug(f"{entity_id} updated/state changed")
logging.debug(f"{self.name} {entity_id} updated/state changed")
if entity_id in self.current_card.get_entities():
self.render_current_page(requested=True)

Expand Down Expand Up @@ -128,11 +128,11 @@ def render_current_page(self, switchPages=False, requested=False):
if requested:
self.current_card.render()
# send sleepTimeout
sleepTimeout = self.settings.get("sleepTimeout", 20)
if self.current_card.config.get("sleepTimeout"):
sleepTimeout = self.current_card.config.get("sleepTimeout")
libs.panel_cmd.timeout(self.sendTopic, sleepTimeout)
self.dimmode()
#sleepTimeout = self.settings.get("sleepTimeout", 20)
#if self.current_card.config.get("sleepTimeout"):
# sleepTimeout = self.current_card.config.get("sleepTimeout")
#libs.panel_cmd.timeout(self.sendTopic, sleepTimeout)
#self.dimmode()

def dimmode(self):
# send dimmode
Expand Down Expand Up @@ -169,6 +169,14 @@ def customrecv_event_callback(self, msg):

self.current_card = Screensaver(self.settings["locale"], self.settings["screensaver"], self)
self.render_current_page(switchPages=True)

# send sleepTimeout
sleepTimeout = self.settings.get("sleepTimeout", 20)
if self.current_card.config.get("sleepTimeout"):
sleepTimeout = self.current_card.config.get("sleepTimeout")
libs.panel_cmd.timeout(self.sendTopic, sleepTimeout)

self.dimmode()
if msg[1] == "sleepReached":
self.privious_cards.append(self.current_card)
self.current_card = Screensaver(self.settings["locale"], self.settings["screensaver"], self)
Expand Down

0 comments on commit 9a4a42f

Please sign in to comment.