From a8db975fc07bbe7120a2b1d1800a841e36ce25ef Mon Sep 17 00:00:00 2001 From: illuzn <57167030+illuzn@users.noreply.github.com> Date: Wed, 25 May 2022 11:08:09 +0930 Subject: [PATCH 1/6] Enable Override of autoWeather Default Colors --- apps/nspanel-lovelace-ui/luibackend/theme.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/nspanel-lovelace-ui/luibackend/theme.py b/apps/nspanel-lovelace-ui/luibackend/theme.py index 33ff7b10..7ac070e6 100644 --- a/apps/nspanel-lovelace-ui/luibackend/theme.py +++ b/apps/nspanel-lovelace-ui/luibackend/theme.py @@ -61,11 +61,13 @@ def map_color(key, theme, state=None): # Use Autocolouring for weather elif state is not None: if key in ["tMainIcon", "tF1Icon", "tF2Icon", "tF3Icon", "tF4Icon"]: - config_color = map_weather_icon_color(key=key, state=state) + config_color = map_weather_icon_color(key=key, theme=theme, state=state) return config_color -def map_weather_icon_color(key, state): - if key in state and state[key] in default_weather_icon_color_mapping: +def map_weather_icon_color(key, theme, state): + if key in state and state[key] in theme: + config_color = rgb_dec565(theme[state[key]]) + elif key in state and state[key] in default_weather_icon_color_mapping: config_color = default_weather_icon_color_mapping[state[key]] else: config_color = "65535" From de525758f498835cdd764c6e7be76798d6bb913e Mon Sep 17 00:00:00 2001 From: illuzn <57167030+illuzn@users.noreply.github.com> Date: Wed, 25 May 2022 11:11:53 +0930 Subject: [PATCH 2/6] Update docs --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 1f3ed3d4..08cb806e 100644 --- a/README.md +++ b/README.md @@ -500,6 +500,8 @@ key | option | type | default | description `tMR` | True | list | White | `[R, G, B]` `autoWeather` | True | string | None | Set to `true` to enable weather icons to change depending on state e.g. blue for rainy. Any custom colors in `tMainIcon` `tF1Icon` `tF2Icon` `tF3Icon` `tF4Icon` take precedence. +If `autoWeather: true` is set. You may also override the default color mapping for any valid weather state provided by homeassistant e.g. `rainy: [50, 50, 255]` or `sunny: [255, 255, 0]` + 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. #### Schedule sleep brightness From 53097cdb68251241d2962adf1191eeee35b28a4c Mon Sep 17 00:00:00 2001 From: illuzn <57167030+illuzn@users.noreply.github.com> Date: Wed, 25 May 2022 11:20:36 +0930 Subject: [PATCH 3/6] Update example config. Put this here because of how verbose it is. --- appdaemon/apps.yaml | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/appdaemon/apps.yaml b/appdaemon/apps.yaml index bb61f3b1..aabd85f6 100644 --- a/appdaemon/apps.yaml +++ b/appdaemon/apps.yaml @@ -21,6 +21,44 @@ nspanel-1: name: name icon: lightbulb alternativeLayout: True + theme: + background: [0, 0, 0] + time: [220, 0, 255] + timeAMPM: [220, 0, 255] + date: [220, 0, 255] + tMainIcon: [220, 0, 255] + tMainText: [220, 0, 255] + tForecast1: [220, 0, 255] + tForecast2: [220, 0, 255] + tForecast3: [220, 0, 255] + tForecast4: [220, 0, 255] + tF1Icon: [220, 0, 255] + tF2Icon: [220, 0, 255] + tF3Icon: [220, 0, 255] + tF4Icon: [220, 0, 255] + tForecast1Val: [220, 0, 255] + tForecast2Val: [220, 0, 255] + tForecast3Val: [220, 0, 255] + tForecast4Val: [220, 0, 255] + bar: [220, 0, 255] + tMRIcon: [220, 0, 255] + tMR: [220, 0, 255] + autoWeather: true + clear-night: [220, 0, 255] + cloudy: [220, 0, 255] + exceptional: [220, 0, 255] + fog: [220, 0, 255] + hail: [220, 0, 255] + lightning: [220, 0, 255] + lightning-rainy: [220, 0, 255] + partlycloudy: [220, 0, 255] + pouring: [220, 0, 255] + rainy: [50, 50, 255] + snowy: [220, 0, 255] + snowy-rainy: [100, 100, 255] + sunny: [220, 0, 255] + windy: [220, 0, 255] + windy-variant: [220, 0, 255] cards: - type: cardEntities entities: From 9ea37e70e6181cbc3a56aa0c137143fa4fd536c7 Mon Sep 17 00:00:00 2001 From: illuzn <57167030+illuzn@users.noreply.github.com> Date: Wed, 25 May 2022 11:44:12 +0930 Subject: [PATCH 4/6] Fixes US p layout Remove redundant references to `tMainIconAlt` and `tMainTextAlt` --- apps/nspanel-lovelace-ui/luibackend/theme.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/apps/nspanel-lovelace-ui/luibackend/theme.py b/apps/nspanel-lovelace-ui/luibackend/theme.py index 7ac070e6..b344bee9 100644 --- a/apps/nspanel-lovelace-ui/luibackend/theme.py +++ b/apps/nspanel-lovelace-ui/luibackend/theme.py @@ -22,8 +22,6 @@ default_screensaver_color_mapping = { "tForecast3Val": "65535", "tForecast4Val": "65535", "bar": "65535", - "tMainIconAlt": "65535", - "tMainTextAlt": "65535", "tMRIcon": "65535", "tMR": "65535" } From 14a95887ae4918d876c17d003c0c2875bc62a572 Mon Sep 17 00:00:00 2001 From: illuzn Date: Thu, 26 May 2022 00:30:19 +0930 Subject: [PATCH 5/6] Better handling of screensaver-theme. --- README.md | 2 ++ appdaemon/README.md | 3 +++ appdaemon/appdaemon.yaml | 1 + appdaemon/apps.yaml | 39 +-------------------------- appdaemon/screensaver-theme.yaml | 46 ++++++++++++++++++++++++++++++++ 5 files changed, 53 insertions(+), 38 deletions(-) create mode 100644 appdaemon/screensaver-theme.yaml diff --git a/README.md b/README.md index 08cb806e..dc6c16de 100644 --- a/README.md +++ b/README.md @@ -504,6 +504,8 @@ If `autoWeather: true` is set. You may also override the default color mapping f 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. +For complex theme setups, you may configure `theme: !include /config/appdaemon/apps/screensaver-theme.yaml` and download `screensaver-theme.yaml` from the appdaemon folder and place it in the same folder as `apps.yaml`. Note: this will cause AppDaemon to throw a warning that `screensaver-theme.yaml` is not a valid yaml file - this warning can be safely ignored or you can configure `invalid_yaml_warnings: 1` (see appdaemon.yaml in the appdaemon folder). + #### Schedule sleep brightness It is possible to schedule a brightness change for the screen at specific times. diff --git a/appdaemon/README.md b/appdaemon/README.md index 230a0804..b7599987 100644 --- a/appdaemon/README.md +++ b/appdaemon/README.md @@ -10,3 +10,6 @@ Example config for appademon itself "Simple" Example Config with all possible entity types +## screensaver-theme.yaml + +Example screensaver theme configuration. All entries are commented out but you can uncomment as appropriate to enable. \ No newline at end of file diff --git a/appdaemon/appdaemon.yaml b/appdaemon/appdaemon.yaml index 567a072b..c979b64e 100644 --- a/appdaemon/appdaemon.yaml +++ b/appdaemon/appdaemon.yaml @@ -5,6 +5,7 @@ appdaemon: longitude: 4.0 elevation: 2 time_zone: Europe/Berlin +# invalid_yaml_warnings: 1 plugins: HASS: type: hass diff --git a/appdaemon/apps.yaml b/appdaemon/apps.yaml index aabd85f6..8746a424 100644 --- a/appdaemon/apps.yaml +++ b/appdaemon/apps.yaml @@ -21,44 +21,7 @@ nspanel-1: name: name icon: lightbulb alternativeLayout: True - theme: - background: [0, 0, 0] - time: [220, 0, 255] - timeAMPM: [220, 0, 255] - date: [220, 0, 255] - tMainIcon: [220, 0, 255] - tMainText: [220, 0, 255] - tForecast1: [220, 0, 255] - tForecast2: [220, 0, 255] - tForecast3: [220, 0, 255] - tForecast4: [220, 0, 255] - tF1Icon: [220, 0, 255] - tF2Icon: [220, 0, 255] - tF3Icon: [220, 0, 255] - tF4Icon: [220, 0, 255] - tForecast1Val: [220, 0, 255] - tForecast2Val: [220, 0, 255] - tForecast3Val: [220, 0, 255] - tForecast4Val: [220, 0, 255] - bar: [220, 0, 255] - tMRIcon: [220, 0, 255] - tMR: [220, 0, 255] - autoWeather: true - clear-night: [220, 0, 255] - cloudy: [220, 0, 255] - exceptional: [220, 0, 255] - fog: [220, 0, 255] - hail: [220, 0, 255] - lightning: [220, 0, 255] - lightning-rainy: [220, 0, 255] - partlycloudy: [220, 0, 255] - pouring: [220, 0, 255] - rainy: [50, 50, 255] - snowy: [220, 0, 255] - snowy-rainy: [100, 100, 255] - sunny: [220, 0, 255] - windy: [220, 0, 255] - windy-variant: [220, 0, 255] +# theme: !include /config/appdaemon/apps/screensaver-theme.yaml cards: - type: cardEntities entities: diff --git a/appdaemon/screensaver-theme.yaml b/appdaemon/screensaver-theme.yaml new file mode 100644 index 00000000..89e17b50 --- /dev/null +++ b/appdaemon/screensaver-theme.yaml @@ -0,0 +1,46 @@ +#Uncomment by deleting the '#' and configure as you see fit. +#Colors are in the format [Red, Green, Blue] and can be numbers from 0-255 +#The items shoud be self-explanatory but tMRIcon affects the humidity icon and tMR affects the humidity text. + +#background: [220, 0, 0] +#time: [220, 0, 255] +#timeAMPM: [220, 0, 255] +#date: [220, 0, 255] +#tMainIcon: [220, 0, 255] +#tMainText: [220, 0, 255] +#tForecast1: [220, 0, 255] +#tForecast2: [220, 0, 255] +#tForecast3: [220, 0, 255] +#tForecast4: [220, 0, 255] +#tF1Icon: [220, 0, 255] +#tF2Icon: [220, 0, 255] +#tF3Icon: [220, 0, 255] +#tF4Icon: [220, 0, 255] +#tForecast1Val: [220, 0, 255] +#tForecast2Val: [220, 0, 255] +#tForecast3Val: [220, 0, 255] +#tForecast4Val: [220, 0, 255] +#bar: [220, 0, 255] +#tMRIcon: [220, 0, 255] +#tMR: [220, 0, 255] + +#autoWeather automatically colors the screensaver weather icons based upon weather. Uncomment the following line to enable. +#autoWeather: true + +#If you have enabled autoWeather, the following options allow you to customise the colors used for autoWeather. + +#clear-night: [150, 150, 100] +#cloudy: [75, 75, 75] +#exceptional: [255, 50, 50] +#fog: [150, 150, 150] +#hail: [200, 200, 200] +#lightning: [200, 200, 0] +#lightning-rainy: [200, 200, 150] +#partlycloudy: [150, 150, 150] +#pouring: [50, 50, 255] +#rainy: [100, 100, 255] +#snowy: [150, 150, 150] +#snowy-rainy: [150, 150, 255] +#sunny: [255, 255, 0] +#windy: [150, 150, 150] +#windy-variant: [255, 125, 125] \ No newline at end of file From 1ca17a123d2dbc9d8ac9fbce8cb74c210f96e100 Mon Sep 17 00:00:00 2001 From: illuzn Date: Thu, 26 May 2022 00:31:29 +0930 Subject: [PATCH 6/6] Typo fix for error --- appdaemon/screensaver-theme.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appdaemon/screensaver-theme.yaml b/appdaemon/screensaver-theme.yaml index 89e17b50..77cf2ced 100644 --- a/appdaemon/screensaver-theme.yaml +++ b/appdaemon/screensaver-theme.yaml @@ -43,4 +43,4 @@ #snowy-rainy: [150, 150, 255] #sunny: [255, 255, 0] #windy: [150, 150, 150] -#windy-variant: [255, 125, 125] \ No newline at end of file +#windy-variant: [255, 125, 125]