Compare commits

..

3 Commits

Author SHA1 Message Date
Johannes
8b57a120ea Update pages.py 2022-07-30 12:12:30 +02:00
Johannes
5a59dd777d Update notifications.md 2022-07-29 22:19:25 +02:00
Johannes
19814bf987 Update nspanel-lovelace-ui.py 2022-07-29 17:29:14 +02:00
7 changed files with 26 additions and 37 deletions

View File

@@ -137,14 +137,15 @@ class LuiController(object):
sorted_timesets = sorted(sleep_brightness_config, key=lambda d: self._ha_api.parse_time(d['time']))
# calc current screensaver brightness
found_current_dim_value = False
for i in range(len(sorted_timesets)):
found = self._ha_api.now_is_between(sorted_timesets[i-1]['time'], sorted_timesets[i]['time'])
if found:
for index, timeset in enumerate(sorted_timesets):
self._ha_api.log("Current time %s", self._ha_api.get_now().time())
if self._ha_api.parse_time(timeset["time"]) > self._ha_api.get_now().time() and not found_current_dim_value:
# first time after current time, set dim value
current_screensaver_brightness = sorted_timesets[index-1]["value"]
self._ha_api.log("Setting dim value to %s", sorted_timesets[index-1])
found_current_dim_value = True
current_screensaver_brightness = sorted_timesets[i-1]['value']
# still no dim value
if not found_current_dim_value:
self._ha_api.log("Chooseing %s as fallback", sorted_timesets[0])
current_screensaver_brightness = sorted_timesets[0]["value"]
return current_screensaver_brightness
@@ -288,8 +289,6 @@ class LuiController(object):
self._ha_api.get_entity(entity_id).call_service("lock")
elif entity_id.startswith('button') or entity_id.startswith('input_button'):
self._ha_api.get_entity(entity_id).call_service("press")
elif entity_id.startswith('input_select'):
self._ha_api.get_entity(entity_id).call_service("select_next")
# for media page
if button_type == "media-next":

View File

@@ -179,7 +179,7 @@ class LuiPagesGen(object):
if item.status is not None and self._ha_api.entity_exists(item.status):
status_entity = self._ha_api.get_entity(item.status)
icon_res = get_icon_id_ha(item.status.split(".")[0], state=status_entity.state, device_class=status_entity.attributes.get("device_class", "_"), overwrite=icon)
icon_color = self.get_entity_color(entity, overwrite=colorOverride)
icon_color = self.get_entity_color(status_entity, overwrite=colorOverride)
if item.status.startswith("sensor") and cardType == "cardGrid":
icon_res = status_entity.state[:4]
if icon_res[-1] == ".":
@@ -205,7 +205,7 @@ class LuiPagesGen(object):
if item.condStateNot is not None and item.condState != entity.state:
return ""
name = name if name is not None else entity.attributes.get("friendly_name","unknown")
name = name if name is not None else entity.attributes.friendly_name
if entityType == "cover":
device_class = entity.attributes.get("device_class", "window")
@@ -282,19 +282,15 @@ class LuiPagesGen(object):
icon_color = self.get_entity_color(entity, overwrite=colorOverride)
text = get_translation(self._locale, "frontend.ui.card.lock.lock") if entity.state == "unlocked" else get_translation(self._locale, "frontend.ui.card.lock.unlock")
return f"~button~{entityId}~{icon_id}~{icon_color}~{name}~{text}"
if entityType in ["number", "input_number"]:
icon_id = get_icon_id_ha("number", state=entity.state, overwrite=icon)
if entityType == "number":
icon_id = get_icon_id_ha("number", overwrite=icon)
min_v = entity.attributes.get("min", 0)
max_v = entity.attributes.get("max", 100)
return f"~number~{entityId}~{icon_id}~17299~{name}~{entity.state}|{min_v}|{max_v}"
if entityType == "input_text":
icon_id = get_icon_id_ha("input_text", state=entity.state, overwrite=icon)
icon_id = get_icon_id_ha("input_text", overwrite=icon)
value = entity.state
return f"~text~{entityId}~{icon_id}~17299~{name}~{value}"
if entityType == "input_select":
icon_id = get_icon_id_ha("button", state=entity.state, overwrite=icon)
text = entity.state
return f"~button~{entityId}~{icon_id}~17299~{name}~{text}"
return f"~text~{entityId}~{get_icon_id('alert-circle-outline')}~17299~unsupported~"
def generate_entities_page(self, navigation, heading, items, cardType):

View File

@@ -24,8 +24,8 @@ class NsPanelLovelaceUIManager(hass.Hass):
controller = LuiController(self, cfg, send_mqtt_msg)
desired_display_firmware_version = 38
version = "v3.1.0"
desired_display_firmware_version = 39
version = "v3.2.0"
model = cfg.get("model")
if model == "us-l":

View File

@@ -31,13 +31,11 @@ List of supported entitiy types for this page:
- sensor
- button
- number
- input_number
- scenes
- script
- input_button
- light
- input_text (read-only)
- input_select
- lock
- fan
- automation

View File

@@ -37,14 +37,11 @@ List of supported entitiy types for this page:
- sensor
- button
- number
- input_number
- scenes
- script
- input_button
- light
- input_text (read-only)
- input_select
- lock
- fan
- automation
- iText

View File

@@ -36,7 +36,6 @@ List of supported entitiy types for this page:
- scenes
- script
- input_button
- input_select
- light
- input_text (read-only)
- lock

View File

@@ -14,7 +14,7 @@ It is possible to exit from the page by sending `exitPopup`
Send Message to the Panel combined with a buzzer sound:
```
```
nspanel_popup_notification:
alias: Popup Notification
sequence:
@@ -25,11 +25,11 @@ nspanel_popup_notification:
title }}~65535~~~~~{{ message }}~65535~{{ timeout }}; Buzzer 2,2,2
mode: single
icon: mdi:message-badge
```
```
Send Message to the Panel:
```
```
nspanel_popup_notification:
alias: Popup Notification
sequence:
@@ -40,7 +40,7 @@ nspanel_popup_notification:
title }}~65535~~~~~{{ message }}~65535~{{ timeout }}
mode: single
icon: mdi:message-badge
```
```
## Notification on screensaver
@@ -50,7 +50,7 @@ The screensaver can display Notifications by sending this command to the CustomS
Send Message to the Screensaver combined with a buzzer sound:
```
```
nspanel_screensaver_notification:
alias: Screensaver Notification
sequence:
@@ -60,11 +60,11 @@ nspanel_screensaver_notification:
payload: CustomSend notify~{{ heading }}~{{ message }}; Buzzer 2,2,2
mode: single
icon: mdi:message-badge
```
```
Send Message to the Screensaver:
```
```
nspanel_screensaver_notification:
alias: Screensaver Notification
sequence:
@@ -74,5 +74,5 @@ nspanel_screensaver_notification:
payload: CustomSend notify~{{ heading }}~{{ message }}
mode: single
icon: mdi:message-badge
```
```