mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-21 15:04:24 +01:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ab74c80ab2 | ||
|
|
b9ddb24a6d | ||
|
|
0df505a0eb |
@@ -15,6 +15,7 @@ class LuiController(object):
|
|||||||
|
|
||||||
# first card (default, after startup)
|
# first card (default, after startup)
|
||||||
self._current_card = self._config.getCard(0)
|
self._current_card = self._config.getCard(0)
|
||||||
|
self._previous_cards = []
|
||||||
|
|
||||||
self._pages_gen = LuiPagesGen(ha_api, config, send_mqtt_msg)
|
self._pages_gen = LuiPagesGen(ha_api, config, send_mqtt_msg)
|
||||||
|
|
||||||
@@ -145,8 +146,8 @@ class LuiController(object):
|
|||||||
if button_type == "bExit":
|
if button_type == "bExit":
|
||||||
self._pages_gen.render_card(self._current_card)
|
self._pages_gen.render_card(self._current_card)
|
||||||
if button_type == "bUp":
|
if button_type == "bUp":
|
||||||
self._current_card = self._previous_card
|
self._current_card = self._previous_cards.pop()
|
||||||
self._pages_gen.render_card(self._previous_card)
|
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)
|
||||||
@@ -184,7 +185,7 @@ class LuiController(object):
|
|||||||
if button_type == "button":
|
if button_type == "button":
|
||||||
if entity_id.startswith('navigate'):
|
if entity_id.startswith('navigate'):
|
||||||
# internal for navigation to nested pages
|
# internal for navigation to nested pages
|
||||||
self._previous_card = self._current_card
|
self._previous_cards.append(self._current_card)
|
||||||
self._current_card = self._config.searchCard(entity_id)
|
self._current_card = self._config.searchCard(entity_id)
|
||||||
self._pages_gen.render_card(self._current_card)
|
self._pages_gen.render_card(self._current_card)
|
||||||
elif entity_id.startswith('scene'):
|
elif entity_id.startswith('scene'):
|
||||||
|
|||||||
@@ -64,8 +64,6 @@ class LuiPagesGen(object):
|
|||||||
we_name = self._config._config_screensaver.entity.entityId
|
we_name = self._config._config_screensaver.entity.entityId
|
||||||
unit = self._config._config_screensaver.raw_config.get("weatherUnit", "celsius")
|
unit = self._config._config_screensaver.raw_config.get("weatherUnit", "celsius")
|
||||||
|
|
||||||
LOGGER.info(f"test123 {we_name}")
|
|
||||||
|
|
||||||
if self._ha_api.entity_exists(we_name):
|
if self._ha_api.entity_exists(we_name):
|
||||||
we = self._ha_api.get_entity(we_name)
|
we = self._ha_api.get_entity(we_name)
|
||||||
else:
|
else:
|
||||||
@@ -167,6 +165,7 @@ class LuiPagesGen(object):
|
|||||||
min_v = entity.attributes.get("min", 0)
|
min_v = entity.attributes.get("min", 0)
|
||||||
max_v = entity.attributes.get("max", 100)
|
max_v = entity.attributes.get("max", 100)
|
||||||
return f"~number~{entityId}~{icon_id}~17299~{name}~{entity.state}|{min_v}|{max_v}"
|
return f"~number~{entityId}~{icon_id}~17299~{name}~{entity.state}|{min_v}|{max_v}"
|
||||||
|
return f"~text~{entityId}~{get_icon_id('alert-circle-outline')}~17299~error~"
|
||||||
|
|
||||||
def generate_entities_page(self, navigation, heading, items):
|
def generate_entities_page(self, navigation, heading, items):
|
||||||
command = f"entityUpd~{heading}~{navigation}"
|
command = f"entityUpd~{heading}~{navigation}"
|
||||||
@@ -266,7 +265,7 @@ class LuiPagesGen(object):
|
|||||||
onoffbutton = 1374
|
onoffbutton = 1374
|
||||||
else:
|
else:
|
||||||
onoffbutton = rgb_dec565([255,255,255])
|
onoffbutton = rgb_dec565([255,255,255])
|
||||||
command = f"entityUpd~|{heading}|{navigation}|{item}|{icon}|{title}|{author}|{volume}|{iconplaypause}|{source}|{speakerlist[:200]}|{onoffbutton}"
|
command = f"entityUpd~{heading}~{navigation}~{item}~{icon}~{title}~{author}~{volume}~{iconplaypause}~{source}~{speakerlist[:200]}~{onoffbutton}"
|
||||||
self._send_mqtt_msg(command)
|
self._send_mqtt_msg(command)
|
||||||
|
|
||||||
def generate_alarm_page(self, navigation, entity):
|
def generate_alarm_page(self, navigation, entity):
|
||||||
|
|||||||
@@ -63,8 +63,8 @@ class NsPanelLovelaceUIManager(hass.Hass):
|
|||||||
|
|
||||||
controller = LuiController(self, cfg, send_mqtt_msg)
|
controller = LuiController(self, cfg, send_mqtt_msg)
|
||||||
|
|
||||||
desired_display_firmware_version = 27
|
desired_display_firmware_version = 28
|
||||||
version = "v2.4.6"
|
version = "v2.5.0"
|
||||||
|
|
||||||
model = cfg.get("model")
|
model = cfg.get("model")
|
||||||
if model == "us-l":
|
if model == "us-l":
|
||||||
|
|||||||
Reference in New Issue
Block a user