mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-20 14:37:01 +01:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
acdba468b3 | ||
|
|
54c8d302a8 | ||
|
|
8059905579 |
@@ -334,6 +334,11 @@ class LuiController(object):
|
||||
apis.ha_api.get_entity(entity_id).call_service("return_to_base")
|
||||
elif entity_id.startswith('service'):
|
||||
apis.ha_api.call_service(entity_id.replace('service.', '', 1).replace('.','/', 1), **entity_config.data)
|
||||
elif entity_id.startswith('valve'):
|
||||
if apis.ha_api.get_entity(entity_id).state == "open":
|
||||
apis.ha_api.get_entity(entity_id).call_service("close_valve")
|
||||
else:
|
||||
apis.ha_api.get_entity(entity_id).call_service("open_valve")
|
||||
|
||||
# for media page
|
||||
if button_type == "media-next":
|
||||
|
||||
@@ -159,8 +159,8 @@ alarm_control_panel_mapping = {
|
||||
}
|
||||
|
||||
climate_mapping = {
|
||||
'auto': 'calendar-sync',
|
||||
'heat_cool': 'calendar-sync',
|
||||
'auto': 'fan-auto',
|
||||
'heat_cool': 'sun-snowflake-variant',
|
||||
'heat': 'fire',
|
||||
'off': 'power',
|
||||
'cool': 'snowflake',
|
||||
|
||||
@@ -382,8 +382,14 @@ class LuiPagesGen(object):
|
||||
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'])
|
||||
if type(item.stype) == int:
|
||||
results = apis.ha_api.call_service(
|
||||
"weather/get_forecasts", target={"entity_id": entityId}, service_data={"type": "daily"}
|
||||
)
|
||||
forecast = results.get("result", {}).get("response", {}).get(entityId, {}).get('forecast') or entity.attributes.get('forecast', [])
|
||||
if len(forecast) >= item.stype:
|
||||
day_forecast = forecast[item.stype]
|
||||
fdate = dp.parse(day_forecast['datetime'])
|
||||
global babel_spec
|
||||
if babel_spec is not None:
|
||||
dateformat = "E" if item.nameOverride is None else item.nameOverride
|
||||
@@ -391,11 +397,20 @@ class LuiPagesGen(object):
|
||||
else:
|
||||
dateformat = "%a" if item.nameOverride is None else item.nameOverride
|
||||
name = fdate.astimezone().strftime(dateformat)
|
||||
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)
|
||||
icon_id = get_icon_ha(entityId, stateOverwrite=day_forecast['condition'])
|
||||
value = f'{day_forecast.get("temperature", "")}{unit}'
|
||||
color = self.get_entity_color(entity, ha_type=entityType, stateOverwrite=day_forecast['condition'], overwrite=colorOverride)
|
||||
else:
|
||||
value = f'{get_attr_safe(entity, "temperature", "")}{unit}'
|
||||
else:
|
||||
value = f'{get_attr_safe(entity, "temperature", "")}{unit}'
|
||||
elif entityType == "valve":
|
||||
entityTypePanel = "valve"
|
||||
value = get_translation(self._locale, f"backend.component.binary_sensor.state.door.{entity.state}")
|
||||
if entity.state == "open":
|
||||
icon_id = get_icon_id("valve-open")
|
||||
else:
|
||||
icon_id = get_icon_id("valve-closed")
|
||||
else:
|
||||
name = "unsupported"
|
||||
# Overwrite for value
|
||||
|
||||
Reference in New Issue
Block a user