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