mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-19 22:24:15 +01:00
implements #1350
This commit is contained in:
@@ -383,10 +383,18 @@ class LuiPagesGen(object):
|
|||||||
entityTypePanel = "text"
|
entityTypePanel = "text"
|
||||||
unit = get_attr_safe(entity, "temperature_unit", "")
|
unit = get_attr_safe(entity, "temperature_unit", "")
|
||||||
if type(item.stype) == int:
|
if type(item.stype) == int:
|
||||||
|
bits = get_attr_safe(entity, "supported_features", 0b0)
|
||||||
|
rt = "daily"
|
||||||
|
if bits & 0b001: #FORECAST_DAILY
|
||||||
|
rt = "daily"
|
||||||
|
elif bits & 0b010: #FORECAST_HOURLY
|
||||||
|
rt = "hourly"
|
||||||
|
elif bits & 0b100: #FORECAST_TWICE_DAILY
|
||||||
|
rt = "twice_daily"
|
||||||
|
|
||||||
results = apis.ha_api.call_service(
|
results = apis.ha_api.call_service(
|
||||||
"weather/get_forecasts", target={"entity_id": entityId}, service_data={"type": "daily"}
|
"weather/get_forecasts", target={"entity_id": entityId}, service_data={"type": rt}
|
||||||
)
|
) forecast = results.get("result", {}).get("response", {}).get(entityId, {}).get('forecast') or entity.attributes.get('forecast', [])
|
||||||
forecast = results.get("result", {}).get("response", {}).get(entityId, {}).get('forecast') or entity.attributes.get('forecast', [])
|
|
||||||
if len(forecast) >= item.stype:
|
if len(forecast) >= item.stype:
|
||||||
day_forecast = forecast[item.stype]
|
day_forecast = forecast[item.stype]
|
||||||
fdate = dp.parse(day_forecast['datetime'])
|
fdate = dp.parse(day_forecast['datetime'])
|
||||||
|
|||||||
Reference in New Issue
Block a user