mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-23 07:54:25 +01:00
Update pages.py
This commit is contained in:
@@ -62,6 +62,7 @@ class LuiPagesGen(object):
|
|||||||
global babel_spec
|
global babel_spec
|
||||||
we_name = self._config._config_screensaver.entity.entityId
|
we_name = self._config._config_screensaver.entity.entityId
|
||||||
unit = self._config._config_screensaver.raw_config.get("weatherUnit", "celsius")
|
unit = self._config._config_screensaver.raw_config.get("weatherUnit", "celsius")
|
||||||
|
state = {}
|
||||||
|
|
||||||
if self._ha_api.entity_exists(we_name):
|
if self._ha_api.entity_exists(we_name):
|
||||||
we = self._ha_api.get_entity(we_name)
|
we = self._ha_api.get_entity(we_name)
|
||||||
@@ -70,6 +71,7 @@ class LuiPagesGen(object):
|
|||||||
return
|
return
|
||||||
|
|
||||||
icon_cur = get_icon_id_ha("weather", state=we.state)
|
icon_cur = get_icon_id_ha("weather", state=we.state)
|
||||||
|
state["tMainIcon"] = we.state
|
||||||
text_cur = convert_temperature(we.attributes.temperature, unit)
|
text_cur = convert_temperature(we.attributes.temperature, unit)
|
||||||
|
|
||||||
forecastSkip = self._config._config_screensaver.raw_config.get(f"forecastSkip")+1
|
forecastSkip = self._config._config_screensaver.raw_config.get(f"forecastSkip")+1
|
||||||
@@ -96,6 +98,14 @@ class LuiPagesGen(object):
|
|||||||
else:
|
else:
|
||||||
up = up.strftime('%a')
|
up = up.strftime('%a')
|
||||||
icon = get_icon_id_ha("weather", state=we.attributes.forecast[fid]['condition'])
|
icon = get_icon_id_ha("weather", state=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)
|
down = convert_temperature(we.attributes.forecast[fid]['temperature'], unit)
|
||||||
else:
|
else:
|
||||||
up = ""
|
up = ""
|
||||||
@@ -117,6 +127,15 @@ class LuiPagesGen(object):
|
|||||||
altLayout = f"~{get_icon_id('water-percent')}~{we.attributes.humidity} %"
|
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~{icon_cur}~{text_cur}{weather_res}{altLayout}")
|
||||||
|
|
||||||
|
# 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:
|
||||||
|
state = None
|
||||||
|
self._send_mqtt_msg(get_screensaver_color_output(theme=theme, state=state))
|
||||||
|
|
||||||
def generate_entities_item(self, entity, cardType):
|
def generate_entities_item(self, entity, cardType):
|
||||||
entityId = entity.entityId
|
entityId = entity.entityId
|
||||||
|
|||||||
Reference in New Issue
Block a user