Compare commits

...

5 Commits

Author SHA1 Message Date
Johannes
8b7d196721 fix doubletap config location 2022-04-03 11:46:25 +02:00
Johannes
aadebf801a added default card after screensaver exit 2022-04-03 11:28:11 +02:00
Johannes
ab74c80ab2 Merge branch 'main' of https://github.com/joBr99/nspanel-lovelace-ui 2022-04-03 09:53:04 +02:00
Johannes
b9ddb24a6d bump version 2022-04-03 09:49:00 +02:00
Johannes
0df505a0eb fix media page 2022-04-03 09:47:44 +02:00
6 changed files with 51 additions and 42 deletions

View File

@@ -132,83 +132,83 @@ The following message can be used to update the content on the cardEntities Page
## Messages from Nextion Display ## Messages from Nextion Display
`event~buttonPress2~pageName~bNext` `event,buttonPress2,pageName,bNext`
`event~buttonPress2~pageName~bPrev` `event,buttonPress2,pageName,bPrev`
`event~buttonPress2~pageName~bExit~number_of_taps` `event,buttonPress2,pageName,bExit,number_of_taps`
`event~buttonPress2~pageName~sleepReached` `event,buttonPress2,pageName,sleepReached`
### startup page ### startup page
`event~startup~version~model` `event,startup,version,model`
### screensaver page ### screensaver page
`event~buttonPress2~screensaver~exit` - Touch Event on Screensaver `event,buttonPress2,screensaver,exit` - Touch Event on Screensaver
`event~screensaverOpen` - Screensaver has opened `event,screensaverOpen` - Screensaver has opened
### cardEntities Page ### cardEntities Page
`event~*eventName*~*entityName*~*actionName*~*optionalValue*` `event,*eventName*,*entityName*,*actionName*,*optionalValue*`
`event~buttonPress2~internalNameEntity~up` `event,buttonPress2,internalNameEntity,up`
`event~buttonPress2~internalNameEntity~down` `event,buttonPress2,internalNameEntity,down`
`event~buttonPress2~internalNameEntity~stop` `event,buttonPress2,internalNameEntity,stop`
`event~buttonPress2~internalNameEntity~OnOff~1` `event,buttonPress2,internalNameEntity,OnOff,1`
`event~buttonPress2~internalNameEntity~button` `event,buttonPress2,internalNameEntity,button`
### popupLight Page ### popupLight Page
`event~pageOpenDetail~popupLight~internalNameEntity` `event,pageOpenDetail,popupLight,internalNameEntity`
`event~buttonPress2~internalNameEntity~OnOff~1` `event,buttonPress2,internalNameEntity,OnOff,1`
`event~buttonPress2~internalNameEntity~brightnessSlider~50` `event,buttonPress2,internalNameEntity,brightnessSlider,50`
`event~buttonPress2~internalNameEntity~colorTempSlider~50` `event,buttonPress2,internalNameEntity,colorTempSlider,50`
`event~buttonPress2~internalNameEntity~colorWheel~x|y` `event,buttonPress2,internalNameEntity,colorWheel,x|y`
### popupShutter Page ### popupShutter Page
`event~pageOpenDetail~popupShutter~internalNameEntity` `event,pageOpenDetail,popupShutter,internalNameEntity`
`event~buttonPress2~internalNameEntity~positionSlider~50` `event,buttonPress2,internalNameEntity,positionSlider,50`
### popupNotify Page ### popupNotify Page
`event~buttonPress2~*internalName*~notifyAction~yes` `event,buttonPress2,*internalName*,notifyAction,yes`
`event~buttonPress2~*internalName*~notifyAction~no` `event,buttonPress2,*internalName*,notifyAction,no`
### cardThermo Page ### cardThermo Page
`event~buttonPress2~*entityName*~tempUpd~*temperature*` `event,buttonPress2,*entityName*,tempUpd,*temperature*`
`event~buttonPress2~*entityName*~hvac_action~*hvac_action*` `event,buttonPress2,*entityName*,hvac_action,*hvac_action*`
### cardMedia Page ### cardMedia Page
`event~buttonPress2~internalNameEntity~media-back` `event,buttonPress2,internalNameEntity,media-back`
`event~buttonPress2~internalNameEntity~media-pause` `event,buttonPress2,internalNameEntity,media-pause`
`event~buttonPress2~internalNameEntity~media-next` `event,buttonPress2,internalNameEntity,media-next`
`event~buttonPress2~internalNameEntity~volumeSlider~75` `event,buttonPress2,internalNameEntity,volumeSlider,75`
### cardAlarm Page ### cardAlarm Page
`event~buttonPress2~internalNameEntity~actionName~code` `event,buttonPress2,internalNameEntity,actionName,code`
# Icons IDs # Icons IDs
@@ -218,7 +218,7 @@ Please see Icon's int the [icons.md file](icons.md)
# Design Guidelines for Nextion HMI Project # Design Guidelines for Nextion HMI Project
Background Color is Background Color is
- RGB565: 6371 [18e3] (HEX: #1C1C1C~ RGB: 28~28~28) - RGB565: 6371 [18e3] (HEX: #1C1C1C, RGB: 28,28,28)
Source for Icons is the Material Design Font~ used by HASPone Source for Icons is the Material Design Font, used by HASPone
https://github.com/HASwitchPlate/HASPone https://github.com/HASwitchPlate/HASPone

View File

@@ -371,6 +371,7 @@ key | optional | type | default | description
`weatherOverrideForecast4` | True | complex | `None` | sensor entity from home assistant here to override the forth weather forecast item on the screensaver `weatherOverrideForecast4` | True | complex | `None` | sensor entity from home assistant here to override the forth weather forecast item on the screensaver
`doubleTapToUnlock` | True | boolean | `False` | requires to tap screensaver two times `doubleTapToUnlock` | True | boolean | `False` | requires to tap screensaver two times
`alternativeLayout` | True | boolean | `False` | alternative layout with humidity `alternativeLayout` | True | boolean | `False` | alternative layout with humidity
`defaultCard` | True | string | `None` | default page after exiting screensaver; only works with top level cards defined in cards
`key` | True | string | `None` | Used by navigate items `key` | True | string | `None` | Used by navigate items
Example for the weatherOverride config options: Example for the weatherOverride config options:

View File

@@ -84,7 +84,8 @@ class LuiBackendConfig(object):
'weatherOverrideForecast3': None, 'weatherOverrideForecast3': None,
'weatherOverrideForecast4': None, 'weatherOverrideForecast4': None,
'doubleTapToUnlock': False, 'doubleTapToUnlock': False,
'alternativeLayout': False 'alternativeLayout': False,
'defaultCard': None
}, },
'hiddenCards': [] 'hiddenCards': []
} }

View File

@@ -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)
@@ -132,9 +133,16 @@ class LuiController(object):
LOGGER.info(f"Button Press Event; entity_id: {entity_id}; button_type: {button_type}; value: {value} ") LOGGER.info(f"Button Press Event; entity_id: {entity_id}; button_type: {button_type}; value: {value} ")
# internal buttons # internal buttons
if entity_id == "screensaver" and button_type == "bExit": if entity_id == "screensaver" and button_type == "bExit":
if self._config.get("doubleTapToUnlock") and int(value) >= 2: # get default card if there is one
if self._config.get("screensaver.defaultCard") is not None:
dstCard = self._config.searchCard(self._config.get("screensaver.defaultCard"))
if dstCard is not None:
self._previous_cards = []
self._current_card = dstCard
# check for duouble tap if configured and render current page
if self._config.get("screensaver.doubleTapToUnlock") and int(value) >= 2:
self._pages_gen.render_card(self._current_card) self._pages_gen.render_card(self._current_card)
elif not self._config.get("doubleTapToUnlock"): elif not self._config.get("screensaver.doubleTapToUnlock"):
self._pages_gen.render_card(self._current_card) self._pages_gen.render_card(self._current_card)
return return
@@ -145,8 +153,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 +192,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'):

View File

@@ -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):

View File

@@ -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":