Merge pull request #227 from illuzn/illuzn-theme-patch-1

autoWeather Updates
This commit is contained in:
Johannes
2022-05-25 20:11:57 +02:00
committed by GitHub
6 changed files with 60 additions and 5 deletions

View File

@@ -500,8 +500,12 @@ 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.
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.

View File

@@ -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.

View File

@@ -5,6 +5,7 @@ appdaemon:
longitude: 4.0
elevation: 2
time_zone: Europe/Berlin
# invalid_yaml_warnings: 1
plugins:
HASS:
type: hass

View File

@@ -21,6 +21,7 @@ nspanel-1:
name: name
icon: lightbulb
alternativeLayout: True
# theme: !include /config/appdaemon/apps/screensaver-theme.yaml
cards:
- type: cardEntities
entities:

View File

@@ -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]

View File

@@ -22,8 +22,6 @@ default_screensaver_color_mapping = {
"tForecast3Val": "65535",
"tForecast4Val": "65535",
"bar": "65535",
"tMainIconAlt": "65535",
"tMainTextAlt": "65535",
"tMRIcon": "65535",
"tMR": "65535"
}
@@ -61,11 +59,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"