mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-23 16:04:25 +01:00
refactor
This commit is contained in:
@@ -131,9 +131,7 @@ class LuiPagesGen(object):
|
||||
# send color if configured in screensaver
|
||||
theme = self._config.get("theme")
|
||||
if theme is not None:
|
||||
if "AutoWeather" in theme and theme["AutoWeather"] == "auto":
|
||||
# do nothing
|
||||
else:
|
||||
if not ("AutoWeather" in theme and theme["AutoWeather"] == "auto"):
|
||||
state = None
|
||||
self._send_mqtt_msg(get_screensaver_color_output(theme=theme, state=state))
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
from helper import rgb_dec565
|
||||
|
||||
default_screensaver_color_mapping = {
|
||||
#"item": "color in decimal RGB565 (1-65535)"
|
||||
#"item": "color in decimal RGB565 (0-65535)"
|
||||
"background": "0",
|
||||
"time": "65535",
|
||||
"timeAMPM": "65535",
|
||||
@@ -29,7 +29,7 @@ default_screensaver_color_mapping = {
|
||||
}
|
||||
|
||||
default_weather_icon_color_mapping = {
|
||||
#"item-per HA" "color in decimal RGB 565 (1-65535)"
|
||||
#"item-per HA" "color in decimal RGB 565 (0-65535)"
|
||||
"clear-night": "35957", #50% grey
|
||||
"cloudy": "31728", #grey-blue
|
||||
"exceptional": "63488", #red
|
||||
@@ -60,11 +60,10 @@ def map_color(key, theme, state=None):
|
||||
config_color = rgb_dec565(theme[key])
|
||||
# Use Autocolouring for weather
|
||||
elif state is not None:
|
||||
if key == "tMainIcon" or key == "tF1Icon" or key == "tF2Icon" or key == "tF3Icon" or key == "tF4Icon":
|
||||
if key in ["tMainIcon", "tF1Icon", "tF2Icon", "tF3Icon", "tF4Icon"]:
|
||||
config_color = map_weather_icon_color(key=key, state=state)
|
||||
return config_color
|
||||
|
||||
|
||||
def map_weather_icon_color(key, state):
|
||||
if state[key] in default_weather_icon_color_mapping:
|
||||
config_color = default_weather_icon_color_mapping[state[key]]
|
||||
|
||||
Reference in New Issue
Block a user