mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-20 14:37:01 +01:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8e349d1452 | ||
|
|
8b41bfa066 | ||
|
|
5a93dca172 | ||
|
|
fd002dcc29 | ||
|
|
e35436a375 | ||
|
|
e72014e60e | ||
|
|
6c3049493e | ||
|
|
149f327408 | ||
|
|
75fad417a4 | ||
|
|
17648b3fd3 |
@@ -76,6 +76,7 @@ class LuiBackendConfig(object):
|
|||||||
'sleepBrightness': 20,
|
'sleepBrightness': 20,
|
||||||
'screenBrightness': 100,
|
'screenBrightness': 100,
|
||||||
'sleepTracking': None,
|
'sleepTracking': None,
|
||||||
|
'sleepTrackingZones': ["not_home", "off"],
|
||||||
'sleepOverride': None,
|
'sleepOverride': None,
|
||||||
'locale': "en_US",
|
'locale': "en_US",
|
||||||
'timeFormat': "%H:%M",
|
'timeFormat': "%H:%M",
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ class LuiController(object):
|
|||||||
sleepBrightness = 0
|
sleepBrightness = 0
|
||||||
brightness = self.calc_current_brightness(self._config.get("screenBrightness"))
|
brightness = self.calc_current_brightness(self._config.get("screenBrightness"))
|
||||||
|
|
||||||
if bst is not None and self._ha_api.entity_exists(bst) and self._ha_api.get_entity(bst).state in ["not_home", "off"]:
|
if bst is not None and self._ha_api.entity_exists(bst) and self._ha_api.get_entity(bst).state in self._config.get("sleepTrackingZones"):
|
||||||
self._ha_api.log(f"sleepTracking setting brightness to 0")
|
self._ha_api.log(f"sleepTracking setting brightness to 0")
|
||||||
sleepBrightness = 0
|
sleepBrightness = 0
|
||||||
|
|
||||||
@@ -137,15 +137,14 @@ class LuiController(object):
|
|||||||
sorted_timesets = sorted(sleep_brightness_config, key=lambda d: self._ha_api.parse_time(d['time']))
|
sorted_timesets = sorted(sleep_brightness_config, key=lambda d: self._ha_api.parse_time(d['time']))
|
||||||
# calc current screensaver brightness
|
# calc current screensaver brightness
|
||||||
found_current_dim_value = False
|
found_current_dim_value = False
|
||||||
for index, timeset in enumerate(sorted_timesets):
|
for i in range(len(sorted_timesets)):
|
||||||
self._ha_api.log("Current time %s", self._ha_api.get_now().time())
|
found = self._ha_api.now_is_between(sorted_timesets[i-1]['time'], sorted_timesets[i]['time'])
|
||||||
if self._ha_api.parse_time(timeset["time"]) > self._ha_api.get_now().time() and not found_current_dim_value:
|
if found:
|
||||||
# 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
|
found_current_dim_value = True
|
||||||
|
current_screensaver_brightness = sorted_timesets[i-1]['value']
|
||||||
# still no dim value
|
# still no dim value
|
||||||
if not found_current_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"]
|
current_screensaver_brightness = sorted_timesets[0]["value"]
|
||||||
return current_screensaver_brightness
|
return current_screensaver_brightness
|
||||||
|
|
||||||
@@ -289,6 +288,8 @@ class LuiController(object):
|
|||||||
self._ha_api.get_entity(entity_id).call_service("lock")
|
self._ha_api.get_entity(entity_id).call_service("lock")
|
||||||
elif entity_id.startswith('button') or entity_id.startswith('input_button'):
|
elif entity_id.startswith('button') or entity_id.startswith('input_button'):
|
||||||
self._ha_api.get_entity(entity_id).call_service("press")
|
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
|
# for media page
|
||||||
if button_type == "media-next":
|
if button_type == "media-next":
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ class LuiPagesGen(object):
|
|||||||
if item.condStateNot is not None and item.condState != entity.state:
|
if item.condStateNot is not None and item.condState != entity.state:
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
name = name if name is not None else entity.attributes.friendly_name
|
name = name if name is not None else entity.attributes.get("friendly_name","unknown")
|
||||||
if entityType == "cover":
|
if entityType == "cover":
|
||||||
|
|
||||||
device_class = entity.attributes.get("device_class", "window")
|
device_class = entity.attributes.get("device_class", "window")
|
||||||
@@ -282,15 +282,19 @@ class LuiPagesGen(object):
|
|||||||
icon_color = self.get_entity_color(entity, overwrite=colorOverride)
|
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")
|
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}"
|
return f"~button~{entityId}~{icon_id}~{icon_color}~{name}~{text}"
|
||||||
if entityType == "number":
|
if entityType in ["number", "input_number"]:
|
||||||
icon_id = get_icon_id_ha("number", overwrite=icon)
|
icon_id = get_icon_id_ha("number", state=entity.state, overwrite=icon)
|
||||||
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}"
|
||||||
if entityType == "input_text":
|
if entityType == "input_text":
|
||||||
icon_id = get_icon_id_ha("input_text", overwrite=icon)
|
icon_id = get_icon_id_ha("input_text", state=entity.state, overwrite=icon)
|
||||||
value = entity.state
|
value = entity.state
|
||||||
return f"~text~{entityId}~{icon_id}~17299~{name}~{value}"
|
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~"
|
return f"~text~{entityId}~{get_icon_id('alert-circle-outline')}~17299~unsupported~"
|
||||||
|
|
||||||
def generate_entities_page(self, navigation, heading, items, cardType):
|
def generate_entities_page(self, navigation, heading, items, cardType):
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ class NsPanelLovelaceUIManager(hass.Hass):
|
|||||||
|
|
||||||
controller = LuiController(self, cfg, send_mqtt_msg)
|
controller = LuiController(self, cfg, send_mqtt_msg)
|
||||||
|
|
||||||
desired_display_firmware_version = 39
|
desired_display_firmware_version = 38
|
||||||
version = "v3.2.0"
|
version = "v3.1.0"
|
||||||
|
|
||||||
model = cfg.get("model")
|
model = cfg.get("model")
|
||||||
if model == "us-l":
|
if model == "us-l":
|
||||||
|
|||||||
@@ -31,11 +31,13 @@ List of supported entitiy types for this page:
|
|||||||
- sensor
|
- sensor
|
||||||
- button
|
- button
|
||||||
- number
|
- number
|
||||||
|
- input_number
|
||||||
- scenes
|
- scenes
|
||||||
- script
|
- script
|
||||||
- input_button
|
- input_button
|
||||||
- light
|
- light
|
||||||
- input_text (read-only)
|
- input_text (read-only)
|
||||||
|
- input_select
|
||||||
- lock
|
- lock
|
||||||
- fan
|
- fan
|
||||||
- automation
|
- automation
|
||||||
|
|||||||
@@ -37,11 +37,14 @@ List of supported entitiy types for this page:
|
|||||||
- sensor
|
- sensor
|
||||||
- button
|
- button
|
||||||
- number
|
- number
|
||||||
|
- input_number
|
||||||
- scenes
|
- scenes
|
||||||
- script
|
- script
|
||||||
- input_button
|
- input_button
|
||||||
- light
|
- light
|
||||||
- input_text (read-only)
|
- input_text (read-only)
|
||||||
|
- input_select
|
||||||
- lock
|
- lock
|
||||||
|
- fan
|
||||||
- automation
|
- automation
|
||||||
- iText
|
- iText
|
||||||
@@ -36,6 +36,7 @@ List of supported entitiy types for this page:
|
|||||||
- scenes
|
- scenes
|
||||||
- script
|
- script
|
||||||
- input_button
|
- input_button
|
||||||
|
- input_select
|
||||||
- light
|
- light
|
||||||
- input_text (read-only)
|
- input_text (read-only)
|
||||||
- lock
|
- lock
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ key | optional | type | default | description
|
|||||||
`sleepBrightness` | True | integer/complex | `20` | Brightness for the screen on the screensaver, see example below for complex/scheduled config.
|
`sleepBrightness` | True | integer/complex | `20` | Brightness for the screen on the screensaver, see example below for complex/scheduled config.
|
||||||
`screenBrightness` | True | integer/complex | `100` | Brightness for the screen during usage, config format is the same as sleepBrightness.
|
`screenBrightness` | True | integer/complex | `100` | Brightness for the screen during usage, config format is the same as sleepBrightness.
|
||||||
`sleepTracking` | True | string | None | Forces screensaver brightness to 0 in case entity state is not_home or off, can be a group, person or device_tracker entity.
|
`sleepTracking` | True | string | None | Forces screensaver brightness to 0 in case entity state is not_home or off, can be a group, person or device_tracker entity.
|
||||||
|
`sleepTrackingZones` | True | list | `["not_home", "off"]` | Allows you to set your own states for sleepTracking
|
||||||
`sleepOverride` | True | complex | None | Allows overriding of the sleepBrightness if entity state is on, true or home. Overrides sleepBrightness but sleepTracking takes precedence.
|
`sleepOverride` | True | complex | None | Allows overriding of the sleepBrightness if entity state is on, true or home. Overrides sleepBrightness but sleepTracking takes precedence.
|
||||||
`locale` | True | string | `en_US` | Used by babel to determinante Date format on screensaver, also used for localization.
|
`locale` | True | string | `en_US` | Used by babel to determinante Date format on screensaver, also used for localization.
|
||||||
`dateFormatBabel` | True | string | `full` | formatting options on https://babel.pocoo.org/en/latest/dates.html?highlight=name%20of%20day#date-fields
|
`dateFormatBabel` | True | string | `full` | formatting options on https://babel.pocoo.org/en/latest/dates.html?highlight=name%20of%20day#date-fields
|
||||||
|
|||||||
@@ -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:
|
Send Message to the Panel combined with a buzzer sound:
|
||||||
|
|
||||||
```
|
```
|
||||||
nspanel_popup_notification:
|
nspanel_popup_notification:
|
||||||
alias: Popup Notification
|
alias: Popup Notification
|
||||||
sequence:
|
sequence:
|
||||||
@@ -25,11 +25,11 @@ nspanel_popup_notification:
|
|||||||
title }}~65535~~~~~{{ message }}~65535~{{ timeout }}; Buzzer 2,2,2
|
title }}~65535~~~~~{{ message }}~65535~{{ timeout }}; Buzzer 2,2,2
|
||||||
mode: single
|
mode: single
|
||||||
icon: mdi:message-badge
|
icon: mdi:message-badge
|
||||||
```
|
```
|
||||||
|
|
||||||
Send Message to the Panel:
|
Send Message to the Panel:
|
||||||
|
|
||||||
```
|
```
|
||||||
nspanel_popup_notification:
|
nspanel_popup_notification:
|
||||||
alias: Popup Notification
|
alias: Popup Notification
|
||||||
sequence:
|
sequence:
|
||||||
@@ -40,7 +40,7 @@ nspanel_popup_notification:
|
|||||||
title }}~65535~~~~~{{ message }}~65535~{{ timeout }}
|
title }}~65535~~~~~{{ message }}~65535~{{ timeout }}
|
||||||
mode: single
|
mode: single
|
||||||
icon: mdi:message-badge
|
icon: mdi:message-badge
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Notification on screensaver
|
## 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:
|
Send Message to the Screensaver combined with a buzzer sound:
|
||||||
|
|
||||||
```
|
```
|
||||||
nspanel_screensaver_notification:
|
nspanel_screensaver_notification:
|
||||||
alias: Screensaver Notification
|
alias: Screensaver Notification
|
||||||
sequence:
|
sequence:
|
||||||
@@ -60,11 +60,11 @@ nspanel_screensaver_notification:
|
|||||||
payload: CustomSend notify~{{ heading }}~{{ message }}; Buzzer 2,2,2
|
payload: CustomSend notify~{{ heading }}~{{ message }}; Buzzer 2,2,2
|
||||||
mode: single
|
mode: single
|
||||||
icon: mdi:message-badge
|
icon: mdi:message-badge
|
||||||
```
|
```
|
||||||
|
|
||||||
Send Message to the Screensaver:
|
Send Message to the Screensaver:
|
||||||
|
|
||||||
```
|
```
|
||||||
nspanel_screensaver_notification:
|
nspanel_screensaver_notification:
|
||||||
alias: Screensaver Notification
|
alias: Screensaver Notification
|
||||||
sequence:
|
sequence:
|
||||||
@@ -74,5 +74,5 @@ nspanel_screensaver_notification:
|
|||||||
payload: CustomSend notify~{{ heading }}~{{ message }}
|
payload: CustomSend notify~{{ heading }}~{{ message }}
|
||||||
mode: single
|
mode: single
|
||||||
icon: mdi:message-badge
|
icon: mdi:message-badge
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user