mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-28 18:34:19 +01:00
implement appdaemon side for #438
This commit is contained in:
@@ -101,6 +101,7 @@ class LuiBackendConfig(object):
|
||||
'dateAdditionalTemplate': "",
|
||||
'timeAdditionalTemplate': "",
|
||||
'dateFormat': "%A, %d. %B %Y",
|
||||
'homeButton': False,
|
||||
'cards': [{
|
||||
'type': 'cardEntities',
|
||||
'entities': [{
|
||||
|
||||
@@ -228,7 +228,14 @@ class LuiController(object):
|
||||
else:
|
||||
self._current_card = self._config.getCard(0)
|
||||
self._pages_gen.render_card(self._current_card)
|
||||
|
||||
if button_type == "bHome":
|
||||
if self._previous_cards:
|
||||
self._current_card = self._previous_cards[0]
|
||||
self._previous_cards.clear()
|
||||
else:
|
||||
self._current_card = self._config.getCard(0)
|
||||
self._pages_gen.render_card(self._current_card)
|
||||
|
||||
if button_type == "bNext":
|
||||
card = self._config.getCard(self._current_card.pos+1)
|
||||
self._current_card = card
|
||||
|
||||
@@ -620,12 +620,17 @@ class LuiPagesGen(object):
|
||||
def render_card(self, card, send_page_type=True):
|
||||
apis.ha_api.log(f"Started rendering of page {card.pos} with type {card.cardType}")
|
||||
|
||||
l = 1
|
||||
r = 1
|
||||
if len(self._config._config_cards) == 1:
|
||||
navigation = "0|0"
|
||||
else:
|
||||
navigation = "1|1"
|
||||
l = 0
|
||||
r = 0
|
||||
if card.pos is None:
|
||||
navigation = "2|0"
|
||||
l = 2
|
||||
r = 0
|
||||
if self._config.get("homeButton"):
|
||||
r = 2
|
||||
navigation = f"{l}|{r}"
|
||||
|
||||
# Switch to page
|
||||
if send_page_type:
|
||||
|
||||
Reference in New Issue
Block a user