diff --git a/HMI/README.md b/HMI/README.md
index 7950e59f..164155c8 100644
--- a/HMI/README.md
+++ b/HMI/README.md
@@ -94,9 +94,418 @@ change the page type:
### screensaver page
-`weatherUpdate~tMainIcon~tMainText~tForecast1~tF1Icon~tForecast1Val~tForecast2~tF2Icon~tForecast2Val~tForecast3~tF3Icon~tForecast3Val~tForecast4~tF4Icon~tForecast4Val~optionalLayoutIcon~optionalLayoutText~altIconFont~altIconFont`
+Example default layout: `weatherUpdate~~~A~21130~~-0.7C~~~B~63469~Sat~3.6C~~~C~35957~Sun~3.9C~~~D~31728~Mon~4.3C~~~E~35957~Tue~3.6C`
+Example alternative layout: `weatherUpdate~~~A~21130~~-0.7C~~~B~63469~Sat~3.6C~~~C~35957~Sun~3.9C~~~D~31728~Mon~4.3C~~~E~35957~Tue~3.6C~~~F~21130~~23.6C`
-`color~background~time~timeAMPM~date~tMainIcon~tMainText~tForecast1~tForecast2~tForecast3~tForecast4~tF1Icon~tF2Icon~tF3Icon~tF4Icon~tForecast1Val~tForecast2Val~tForecast3Val~tForecast4Val~bar~tMRIcon~tMR`
+
+
+
+ | Parameter Number |
+ Category |
+ Location |
+ Type |
+ Field |
+ Addional Information |
+
+
+
+
+ | 0 |
+ instruction |
+ |
+ instruction |
+ weatherupdate |
+ |
+
+
+ | 1 |
+ |
+ Main Icon |
+ Entity Definition |
+ type |
+ ignored |
+
+
+ | 2 |
+ |
+ intNameEntity |
+ ignored |
+
+
+ | 3 |
+ |
+ icon |
+ |
+
+
+ | 4 |
+ |
+ iconColor |
+ |
+
+
+ | 5 |
+ |
+ displayName |
+ ignored |
+
+
+ | 6 |
+ |
+ optionalValue |
+ |
+
+
+ | 7 |
+ |
+ First Forecast Icon |
+ Entity Definition |
+ type |
+ ignored |
+
+
+ | 8 |
+ |
+ intNameEntity |
+ ignored |
+
+
+ | 9 |
+ |
+ icon |
+ |
+
+
+ | 10 |
+ |
+ iconColor |
+ |
+
+
+ | 11 |
+ |
+ displayName |
+ |
+
+
+ | 12 |
+ |
+ optionalValue |
+ |
+
+
+ | 13 |
+ |
+ Second Forecast Icon |
+ Entity Definition |
+ type |
+ ignored |
+
+
+ | 14 |
+ |
+ intNameEntity |
+ ignored |
+
+
+ | 15 |
+ |
+ icon |
+ |
+
+
+ | 16 |
+ |
+ iconColor |
+ |
+
+
+ | 17 |
+ |
+ displayName |
+ |
+
+
+ | 18 |
+ |
+ optionalValue |
+ |
+
+
+ | 19 |
+ |
+ Third Forecast Icon |
+ Entity Definition |
+ type |
+ ignored |
+
+
+ | 20 |
+ |
+ intNameEntity |
+ ignored |
+
+
+ | 21 |
+ |
+ icon |
+ |
+
+
+ | 22 |
+ |
+ iconColor |
+ |
+
+
+ | 23 |
+ |
+ displayName |
+ |
+
+
+ | 24 |
+ |
+ optionalValue |
+ |
+
+
+ | 25 |
+ |
+ Fourth Forecast Icon |
+ Entity Definition |
+ type |
+ ignored |
+
+
+ | 26 |
+ |
+ intNameEntity |
+ ignored |
+
+
+ | 27 |
+ |
+ icon |
+ |
+
+
+ | 28 |
+ |
+ iconColor |
+ |
+
+
+ | 29 |
+ |
+ displayName |
+ |
+
+
+ | 30 |
+ |
+ optionalValue |
+ |
+
+
+ | 31 |
+ |
+ Alternative Layout Icon |
+ Entity Definition |
+ type |
+ ignored |
+
+
+ | 32 |
+ |
+ intNameEntity |
+ ignored |
+
+
+ | 33 |
+ |
+ icon |
+ |
+
+
+ | 34 |
+ |
+ iconColor |
+ |
+
+
+ | 35 |
+ |
+ displayName |
+ ignored |
+
+
+ | 36 |
+ |
+ optionalValue |
+ |
+
+
+
+
+`color~background~tTime~timeAMPM~tDate~tMainText~tForecast1~tForecast2~tForecast3~tForecast4~tForecast1Val~tForecast2Val~tForecast3Val~tForecast4Val~bar~tMainTextAlt2~tMR~tTimeAdd`
+
+
+
+
+ | Parameter Number |
+ Category |
+ Location |
+ Type |
+ Field |
+ Addional Information |
+
+
+
+
+ | 0 |
+ instruction |
+ color |
+ |
+
+
+ | 1 |
+ |
+ |
+ |
+ background |
+ |
+
+
+ | 2 |
+ |
+ |
+ |
+ tTime |
+ |
+
+
+ | 3 |
+ |
+ |
+ |
+ timeAMPM |
+ |
+
+
+ | 4 |
+ |
+ |
+ |
+ tDate |
+ |
+
+
+ | 5 |
+ |
+ |
+ |
+ tMainText |
+ |
+
+
+ | 6 |
+ |
+ |
+ |
+ tForecast1 |
+ |
+
+
+ | 7 |
+ |
+ |
+ |
+ tForecast2 |
+ |
+
+
+ | 8 |
+ |
+ |
+ |
+ tForecast3 |
+ |
+
+
+ | 9 |
+ |
+ |
+ |
+ tForecast4 |
+ |
+
+
+ | 10 |
+ |
+ |
+ |
+ tForecast1Val |
+ |
+
+
+ | 11 |
+ |
+ |
+ |
+ tForecast2Val |
+ |
+
+
+ | 12 |
+ |
+ |
+ |
+ tForecast3Val |
+ |
+
+
+ | 13 |
+ |
+ |
+ |
+ tForecast4Val |
+ |
+
+
+ | 14 |
+ |
+ |
+ |
+ bar |
+ |
+
+
+ | 15 |
+ |
+ |
+ |
+ tMainTextAlt2 |
+ |
+
+
+ | 16 |
+ |
+ |
+ |
+ tMR |
+ |
+
+
+ | 17 |
+ |
+ |
+ |
+ tTimeAdd |
+ |
+
+
+
`notify~heading~text`
diff --git a/HMI/code_gen/pages/out.txt b/HMI/code_gen/pages/out.txt
new file mode 100644
index 00000000..307a2fe3
--- /dev/null
+++ b/HMI/code_gen/pages/out.txt
@@ -0,0 +1,402 @@
+
+// data available
+if(usize>1)
+{
+ bufferPos=0
+ while(bufferPos= fid:
- up = we.attributes.forecast[fid]['datetime']
- up = dp.parse(up).astimezone()
- if babel_spec is not None:
- if same_day:
- up = babel.dates.format_time(up, "H:mm", locale=self._locale)
- else:
- up = babel.dates.format_date(up, "E", locale=self._locale)
- else:
- if same_day:
- up = up.strftime('%H:%M')
- else:
- up = up.strftime('%a')
- icon = get_icon_ha(we_name, stateOverwrite=we.attributes.forecast[fid]['condition'])
- if i == 1:
- state["tF1Icon"] = we.attributes.forecast[fid]['condition']
- elif i == 2:
- state["tF2Icon"] = we.attributes.forecast[fid]['condition']
- elif i == 3:
- state["tF3Icon"] = we.attributes.forecast[fid]['condition']
- elif i == 4:
- state["tF4Icon"] = we.attributes.forecast[fid]['condition']
- down = convert_temperature(we.attributes.forecast[fid]['temperature'], unit)
- else:
- up = ""
- icon = ""
- down = ""
- else:
- apis.ha_api.log(f"Forecast {i} is overriden with {wOF}")
- icon = wOF.get("icon")
- name = wOF.get("name")
- entity = apis.ha_api.get_entity(wOF.get("entity"))
- up = name if name is not None else entity.attributes.friendly_name
- icon = get_icon_ha(wOF.get("entity"), overwrite=icon)
- if "color" in wOF:
- if theme is None:
- theme = {}
- color = wOF.get("color")
- if type(color) is dict:
- for overwrite_state, overwrite_val in color.items():
- if overwrite_state == entity.state:
- color = overwrite_val
- if i == 1:
- theme["tF1Icon"] = color
- elif i == 2:
- theme["tF2Icon"] = color
- elif i == 3:
- theme["tF3Icon"] = color
- elif i == 4:
- theme["tF4Icon"] = color
-
- unit_of_measurement = entity.attributes.get("unit_of_measurement", "")
- down = f"{entity.state} {unit_of_measurement}"
- weather_res+=f"~{up}~{icon}~{down}"
-
- altLayout = "~"
- if self._config._config_screensaver.raw_config.get("alternativeLayout", False):
- indoorTemp = self._config._config_screensaver.raw_config.get("indoorTemp")
- if indoorTemp is not None and apis.ha_api.entity_exists(indoorTemp.get("entity","")):
- entity = apis.ha_api.get_entity(indoorTemp.get("entity"))
- icon = get_icon_ha(indoorTemp.get("entity"), overwrite=indoorTemp.get("icon"))
- unit_of_measurement = entity.attributes.get("unit_of_measurement", "")
- altLayout = f"~{icon}{entity.state}{unit_of_measurement}"
- else:
- altLayout = f"~{get_icon_id('water-percent')}{we.attributes.humidity} %"
- self._send_mqtt_msg(f"weatherUpdate~{icon_cur}~{text_cur}{weather_res}{altLayout}")
+ self._send_mqtt_msg(f"weatherUpdate{item_str}")
def update_status_icons(self):
status_res = ""
@@ -397,6 +343,21 @@ class LuiPagesGen(object):
elif entityType == "timer":
entityTypePanel = "timer"
value = get_translation(self._locale, f"backend.component.timer.state._.{entity.state}")
+ elif entityType == "weather":
+ entityTypePanel = "text"
+ unit = get_attr_safe(entity, "temperature_unit", "")
+ if type(item.stype) == int and len(entity.attributes.forecast) >= item.stype:
+ fdate = dp.parse(entity.attributes.forecast[item.stype]['datetime']).astimezone()
+ global babel_spec
+ if babel_spec is not None:
+ name = babel.dates.format_date(fdate, "E", locale=self._locale)
+ else:
+ name = fdate.strftime('%a')
+ icon_id = get_icon_ha(entityId, stateOverwrite=entity.attributes.forecast[item.stype]['condition'])
+ value = f'{entity.attributes.forecast[item.stype].get("temperature", "")}{unit}'
+ color = self.get_entity_color(entity, ha_type=entityType, stateOverwrite=entity.attributes.forecast[item.stype]['condition'], overwrite=colorOverride)
+ else:
+ value = f'{get_attr_safe(entity, "temperature", "")}{unit}'
else:
name = "unsupported"
return f"~{entityTypePanel}~{entityId}~{icon_id}~{color}~{name}~{value}"
diff --git a/apps/nspanel-lovelace-ui/luibackend/theme.py b/apps/nspanel-lovelace-ui/luibackend/theme.py
index 48eda7aa..cdba1b9b 100644
--- a/apps/nspanel-lovelace-ui/luibackend/theme.py
+++ b/apps/nspanel-lovelace-ui/luibackend/theme.py
@@ -27,25 +27,6 @@ default_screensaver_color_mapping = {
"tTimeAdd": "65535"
}
-default_weather_icon_color_mapping = {
- #"item-per HA" "color in decimal RGB 565 (0-65535)"
- "clear-night": "35957", #50% grey
- "cloudy": "31728", #grey-blue
- "exceptional": "63488", #red
- "fog": "21130", #75% grey
- "hail": "65535", #white
- "lightning": "65120", #golden-yellow
- "lightning-rainy": "50400", #dark-golden-yellow
- "partlycloudy": "35957", #50% grey
- "pouring": "249", #blue
- "rainy": "33759", #light-blue
- "snowy": "65535", #white
- "snowy-rainy": "44479", #light-blue-grey
- "sunny": "63469", #bright-yellow
- "windy": "35957", #50% grey
- "windy-variant": "35957" #50% grey
-}
-
def get_screensaver_color_output(theme, state=None):
color_output = "color"
for key in default_screensaver_color_mapping:
@@ -66,8 +47,6 @@ def map_color(key, theme, state=None):
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"
return config_color