Compare commits

...

7 Commits

Author SHA1 Message Date
Johannes
735d017353 Update nspanel-lovelace-ui.py 2023-01-29 22:20:50 +01:00
Johannes Braun
e96b45e2ba fix theme 2023-01-29 22:20:03 +01:00
Johannes Braun
8d2e19aafb fix theme 2023-01-29 21:56:58 +01:00
Johannes Braun
b893cc07b4 fix theme 2023-01-29 21:29:44 +01:00
Johannes Braun
200a0f5330 implement #449 2023-01-29 20:16:19 +01:00
Johannes
1069939676 partly implement #389 2023-01-29 18:29:04 +01:00
Johannes
284b096c4c Update config-screensaver.md 2023-01-29 18:22:34 +01:00
19 changed files with 81 additions and 43 deletions

View File

@@ -348,7 +348,7 @@ Example alternative layout: `weatherUpdate~~~A~21130~~-0.7C~~~B~63469~Sat~3.6C~~
</tbody> </tbody>
</table> </table>
`color~background~tTime~timeAMPM~tDate~tMainText~tForecast1~tForecast2~tForecast3~tForecast4~tForecast1Val~tForecast2Val~tForecast3Val~tForecast4Val~bar~tMainTextAlt2~tMR~tTimeAdd` `color~background~tTime~timeAMPM~tDate~tMainText~tForecast1~tForecast2~tForecast3~tForecast4~tForecast1Val~tForecast2Val~tForecast3Val~tForecast4Val~bar~tMainTextAlt2~tTimeAdd`
<table> <table>
<thead> <thead>
@@ -493,14 +493,6 @@ Example alternative layout: `weatherUpdate~~~A~21130~~-0.7C~~~B~63469~Sat~3.6C~~
<td></td> <td></td>
<td></td> <td></td>
<td></td> <td></td>
<td>tMR</td>
<td></td>
</tr>
<tr>
<td>17</td>
<td></td>
<td></td>
<td></td>
<td>tTimeAdd</td> <td>tTimeAdd</td>
<td></td> <td></td>
</tr> </tr>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -385,6 +385,18 @@ class LuiController(object):
msg += f"- {apis.ha_api.get_entity(e).attributes.friendly_name}\r\n" msg += f"- {apis.ha_api.get_entity(e).attributes.friendly_name}\r\n"
self._pages_gen.send_message_page("opnSensorNotifyRes", "", msg, "", "") self._pages_gen.send_message_page("opnSensorNotifyRes", "", msg, "", "")
# for cardUnlock
if button_type == "cardUnlock-unlock":
curCard = self._config.get_card_by_uuid(entity_id.replace('navigate.',''))
if curCard is not None:
if int(curCard.raw_config.get("pin")) == int(value):
dstCard = self._config.search_card(curCard.raw_config.get("destination"))
if dstCard is not None:
if dstCard.hidden:
self._previous_cards.append(self._current_card)
self._current_card = dstCard
self._pages_gen.render_card(self._current_card)
if button_type == "mode-preset_modes": if button_type == "mode-preset_modes":
entity = apis.ha_api.get_entity(entity_id) entity = apis.ha_api.get_entity(entity_id)
preset_mode = entity.attributes.preset_modes[int(value)] preset_mode = entity.attributes.preset_modes[int(value)]

View File

@@ -121,6 +121,8 @@ class LuiPagesGen(object):
self._send_mqtt_msg(f"date~{date}{addDateText}") self._send_mqtt_msg(f"date~{date}{addDateText}")
def page_type(self, target_page): def page_type(self, target_page):
if target_page == "cardUnlock":
target_page = "cardAlarm"
self._send_mqtt_msg(f"pageType~{target_page}") self._send_mqtt_msg(f"pageType~{target_page}")
def update_screensaver_weather(self, theme): def update_screensaver_weather(self, theme):
@@ -137,6 +139,9 @@ class LuiPagesGen(object):
item_str += self.generate_entities_item(item, "cardEntities") item_str += self.generate_entities_item(item, "cardEntities")
self._send_mqtt_msg(f"weatherUpdate{item_str}") self._send_mqtt_msg(f"weatherUpdate{item_str}")
# send color if configured in screensaver
if theme is not None:
self._send_mqtt_msg(get_screensaver_color_output(theme=theme))
def update_status_icons(self): def update_status_icons(self):
status_res = "" status_res = ""
@@ -368,6 +373,8 @@ class LuiPagesGen(object):
ovalue = item.value ovalue = item.value
if ovalue is not None: if ovalue is not None:
value = apis.ha_api.render_template(ovalue) value = apis.ha_api.render_template(ovalue)
if self._locale == "he_IL" and any("\u0590" <= c <= "\u05EA" for c in name):
name = name[::-1]
return f"~{entityTypePanel}~{entityId}~{icon_id}~{color}~{name}~{value}" return f"~{entityTypePanel}~{entityId}~{icon_id}~{color}~{name}~{value}"
def generate_entities_page(self, navigation, heading, items, cardType, tempUnit): def generate_entities_page(self, navigation, heading, items, cardType, tempUnit):
@@ -593,6 +600,20 @@ class LuiPagesGen(object):
command = f"entityUpd~{title}~{navigation}~{item}{arm_buttons}~{icon}~{color}~{numpad}~{flashing}~{add_btn}" command = f"entityUpd~{title}~{navigation}~{item}{arm_buttons}~{icon}~{color}~{numpad}~{flashing}~{add_btn}"
self._send_mqtt_msg(command) self._send_mqtt_msg(command)
def generate_unlock_page(self, navigation, item, title, destination, pin):
color = rgb_dec565([255,0,0])
icon = get_icon_id("lock")
supported_modes = ["cardUnlock-unlock"]
# add padding to arm buttons
arm_buttons = ""
for b in supported_modes:
arm_buttons += f'~{get_translation(self._locale, "frontend.ui.card.lock.unlock")}~{b}'
if len(supported_modes) < 4:
arm_buttons += "~"*((4-len(supported_modes))*2)
numpad = "enable"
command = f"entityUpd~{title}~{navigation}~{item}{arm_buttons}~{icon}~{color}~{numpad}~disable~"
self._send_mqtt_msg(command)
def generate_qr_page(self, navigation, heading, items, cardType, qrcode): def generate_qr_page(self, navigation, heading, items, cardType, qrcode):
qrcode = apis.ha_api.render_template(qrcode) qrcode = apis.ha_api.render_template(qrcode)
@@ -677,6 +698,12 @@ class LuiPagesGen(object):
overwrite_supported_modes = card.raw_config.get("supportedModes") overwrite_supported_modes = card.raw_config.get("supportedModes")
self.generate_alarm_page(navigation, card.title, card.entity, overwrite_supported_modes, alarmBtn) self.generate_alarm_page(navigation, card.title, card.entity, overwrite_supported_modes, alarmBtn)
return return
if card.cardType == "cardUnlock":
pin = card.raw_config.get("pin", 3830)
destination = card.raw_config.get("destination")
item = card.uuid
self.generate_unlock_page(navigation, item, card.title, destination, pin)
return
if card.cardType == "screensaver": if card.cardType == "screensaver":
theme = card.raw_config.get("theme") theme = card.raw_config.get("theme")
self.update_screensaver_weather(theme) self.update_screensaver_weather(theme)
@@ -901,3 +928,4 @@ class LuiPagesGen(object):
def send_message_page(self, ident, heading, msg, b1, b2): def send_message_page(self, ident, heading, msg, b1, b2):
self._send_mqtt_msg(f"pageType~popupNotify") self._send_mqtt_msg(f"pageType~popupNotify")
self._send_mqtt_msg(f"entityUpdateDetail~{ident}~{heading}~65535~{b1}~65535~{b2}~65535~{msg}~65535~0") self._send_mqtt_msg(f"entityUpdateDetail~{ident}~{heading}~65535~{b1}~65535~{b2}~65535~{msg}~65535~0")

View File

@@ -7,46 +7,29 @@ default_screensaver_color_mapping = {
"time": "65535", "time": "65535",
"timeAMPM": "65535", "timeAMPM": "65535",
"date": "65535", "date": "65535",
"tMainIcon": "65535",
"tMainText": "65535", "tMainText": "65535",
"tForecast1": "65535", "tForecast1": "65535",
"tForecast2": "65535", "tForecast2": "65535",
"tForecast3": "65535", "tForecast3": "65535",
"tForecast4": "65535", "tForecast4": "65535",
"tF1Icon": "65535",
"tF2Icon": "65535",
"tF3Icon": "65535",
"tF4Icon": "65535",
"tForecast1Val": "65535", "tForecast1Val": "65535",
"tForecast2Val": "65535", "tForecast2Val": "65535",
"tForecast3Val": "65535", "tForecast3Val": "65535",
"tForecast4Val": "65535", "tForecast4Val": "65535",
"bar": "65535", "bar": "65535",
"tMRIcon": "65535", "tMainTextAlt2": "65535",
"tMR": "65535",
"tTimeAdd": "65535" "tTimeAdd": "65535"
} }
def get_screensaver_color_output(theme, state=None): def get_screensaver_color_output(theme, state=None):
color_output = "color" color_output = "color"
for key in default_screensaver_color_mapping: for key in default_screensaver_color_mapping:
color_output += f"~{map_color(key=key, theme=theme, state=state)}" color_output += f"~{map_color(key=key, theme=theme)}"
return color_output return color_output
def map_color(key, theme, state=None): def map_color(key, theme):
config_color = default_screensaver_color_mapping[key] config_color = default_screensaver_color_mapping[key]
# Use theme color if set # Use theme color if set
if key in theme: if key in theme:
config_color = rgb_dec565(theme[key]) config_color = rgb_dec565(theme[key])
# Use Autocolouring for weather return config_color
elif state is not None:
if key in ["tMainIcon", "tF1Icon", "tF2Icon", "tF3Icon", "tF4Icon"]:
config_color = map_weather_icon_color(key=key, theme=theme, state=state)
return config_color
def map_weather_icon_color(key, theme, state):
if key in state and state[key] in theme:
config_color = rgb_dec565(theme[state[key]])
else:
config_color = "65535"
return config_color

View File

@@ -28,7 +28,7 @@ class NsPanelLovelaceUIManager(hass.Hass):
desired_tasmota_driver_version = 8 desired_tasmota_driver_version = 8
desired_display_firmware_version = 49 desired_display_firmware_version = 49
version = "v3.9.0" version = "v3.9.3"
model = cfg.get("model") model = cfg.get("model")
if model == "us-l": if model == "us-l":

View File

@@ -13,7 +13,7 @@ List of supported config keys of this card:
key | optional | type | default | description key | optional | type | default | description
-- | -- | -- | -- | -- -- | -- | -- | -- | --
`type` | False | string | `None` | Used by navigate items `type` | False | string | `None` | Type of the card
`title` | True | string | `None` | Title of the Page `title` | True | string | `None` | Title of the Page
`entity` | False | string | `None` | contains the entity of the current card `entity` | False | string | `None` | contains the entity of the current card
`key` | True | string | `None` | Used by navigate items `key` | True | string | `None` | Used by navigate items

View File

@@ -12,7 +12,7 @@ List of supported config keys of this card:
key | optional | type | default | description key | optional | type | default | description
-- | -- | -- | -- | -- -- | -- | -- | -- | --
`type` | False | string | `None` | Used by navigate items `type` | False | string | `None` | Type of the card
`title` | True | string | `None` | Title of the Page `title` | True | string | `None` | Title of the Page
`entity` | False | string | `None` | contains the entity of the current card `entity` | False | string | `None` | contains the entity of the current card
`entities` | False | complex | `None` | contains a list of entities shown in the bottom row, supports all entities supported by cardGrid `entities` | False | complex | `None` | contains a list of entities shown in the bottom row, supports all entities supported by cardGrid

View File

@@ -29,7 +29,7 @@ List of supported config keys of this card:
key | optional | type | default | description key | optional | type | default | description
-- | -- | -- | -- | -- -- | -- | -- | -- | --
`type` | False | string | `None` | Used by navigate items `type` | False | string | `None` | Type of the card
`entities` | False | complex | `None` | contains entities of the card `entities` | False | complex | `None` | contains entities of the card
`title` | True | string | `None` | Title of the Page `title` | True | string | `None` | Title of the Page
`key` | True | string | `None` | Used by navigate items `key` | True | string | `None` | Used by navigate items

View File

@@ -20,7 +20,7 @@ List of supported config keys of this card:
key | optional | type | default | description key | optional | type | default | description
-- | -- | -- | -- | -- -- | -- | -- | -- | --
`type` | False | string | `None` | Used by navigate items `type` | False | string | `None` | Type of the card
`entities` | False | complex | `None` | contains entities of the card, only valid on cardEntities and cardGrid and cardQR `entities` | False | complex | `None` | contains entities of the card, only valid on cardEntities and cardGrid and cardQR
`title` | True | string | `None` | Title of the Page `title` | True | string | `None` | Title of the Page
`key` | True | string | `None` | Used by navigate items `key` | True | string | `None` | Used by navigate items

29
docs/card-unlock.md Normal file
View File

@@ -0,0 +1,29 @@
# Unlock Card (v4.0 and higher)
Can be used to navigate to create pin locked navigation to a hidden card.
![card-unlock](img/card-unlock.png)
```yaml
cards:
- type: cardUnlock
pin: 1234
title: Admin Page
destination: navigate.adminpage
hiddenCards:
- type: cardGrid
title: Admin Page
key: adminpage
entities:
- entity: light.schreibtischlampe
```
List of supported config keys of this card:
key | optional | type | default | description
-- | -- | -- | -- | --
`type` | False | string | `None` | Type of the card
`title` | True | string | `None` | Title of the Page
`destination` | False | string | `None` | contains the navigation entity this card should navigate to on unlock
`pin` | False | string | 3830 | pin to unlock
`key` | True | string | `None` | Used by navigate items

View File

@@ -12,7 +12,6 @@ key | optional | type | default | description
`key` | True | string | `None` | Used by navigate items `key` | True | string | `None` | Used by navigate items
Example for the a screensaver config with custom entities/overrides: Example for the a screensaver config with custom entities/overrides:
Using a 6th entity will automatically activate the alternative layout.
```yaml ```yaml
screensaver: screensaver:
@@ -38,8 +37,7 @@ Using a 6th entity will automatically activate the alternative layout.
- entity: weather.demo_weather_north - entity: weather.demo_weather_north
type: 1 type: 1
- entity: sensor.energy_usage - entity: sensor.energy_usage
- entity: weather.demo_weather_north - entity: delete
type: 2
- entity: sensor.indoor_temp - entity: sensor.indoor_temp
icon: mdi:home-thermometer-outline icon: mdi:home-thermometer-outline
``` ```
@@ -54,7 +52,6 @@ key | option | type | default | description
`time` | True | list | White | `[R, G, B]` `time` | True | list | White | `[R, G, B]`
`timeAMPM` | True | list | White | `[R, G, B]` `timeAMPM` | True | list | White | `[R, G, B]`
`date` | True | list | White | `[R, G, B]` `date` | True | list | White | `[R, G, B]`
`tMainIcon` | True | list | White | `[R, G, B]`
`tMainText` | True | list | White | `[R, G, B]` `tMainText` | True | list | White | `[R, G, B]`
`tForecast1` | True | list | White | `[R, G, B]` `tForecast1` | True | list | White | `[R, G, B]`
`tForecast2` | True | list | White | `[R, G, B]` `tForecast2` | True | list | White | `[R, G, B]`
@@ -65,13 +62,9 @@ key | option | type | default | description
`tForecast3Val` | True | list | White | `[R, G, B]` `tForecast3Val` | True | list | White | `[R, G, B]`
`tForecast4Val` | True | list | White | `[R, G, B]` `tForecast4Val` | True | list | White | `[R, G, B]`
`bar` | True | list | White | `[R, G, B]` `bar` | True | list | White | `[R, G, B]`
`tMainIconAlt` | True | list | White | `[R, G, B]`
`tMainTextAlt` | True | list | White | `[R, G, B]` `tMainTextAlt` | True | list | White | `[R, G, B]`
`tMRIcon` | True | list | White | `[R, G, B]`
`tMR` | True | list | White | `[R, G, B]`
`tTimeAdd` | True | list | White | `[R, G, B]` `tTimeAdd` | True | list | White | `[R, G, B]`
Specify colours as red green and blue values from 0-255 e.g. `[255, 0, 0]` for red or `[0, 0, 255]` for blue. These are translated internally to RGB565 (note that this has lower color depth so the colours may not appear the same). Also note that the screen has a low contrast ratio, so colors look sigificantly different at full display brightness and lowest brightness. Specify colours as red green and blue values from 0-255 e.g. `[255, 0, 0]` for red or `[0, 0, 255]` for blue. These are translated internally to RGB565 (note that this has lower color depth so the colours may not appear the same). Also note that the screen has a low contrast ratio, so colors look sigificantly different at full display brightness and lowest brightness.
Example for the theme config: Example for the theme config:

BIN
docs/img/card-unlock.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -82,6 +82,7 @@ nav:
- "Alarm Card": card-alarm.md - "Alarm Card": card-alarm.md
- "Wifi/QR Card": card-qr.md - "Wifi/QR Card": card-qr.md
- "Power Card": card-power.md - "Power Card": card-power.md
- "Unlock Card": card-unlock.md
- "Special Settings for Entities": entities.md - "Special Settings for Entities": entities.md
- "Subpages": subpages.md - "Subpages": subpages.md
- "Notifications": notifications.md - "Notifications": notifications.md