Thanks for creating this integration. For the most part it is working well for me. However I’m having an issue when trying to use this with the “Template Weather Provider”. My location for the Tempest unit doesn’t allow for very accurate wind information so I wanted to use the Template Weather to use my Tempest for most things but use NWS from my local airport for wind speed and direction. The issue is with the forecast (the other sensors work just fine with the Weather Template). If I set the forecast template within the Weather Template to use Accuweather, for example, it is all good and this templated weather can be displayed in a weather card. If I change it to use the Weatherflow weather forecast , the creation of the templated weather fails.
Logger: homeassistant.components.weather
Source: components/weather/__init__.py:251
Integration: Weather (documentation, issues)
First occurred: 7:41:04 PM (4 occurrences)
Last logged: 10:00:56 PM
Error adding entities for domain weather with platform template
Error while setting up template platform for weather
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 613, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 747, in add_to_platform_finish
await self.async_added_to_hass()
File "/usr/src/homeassistant/homeassistant/components/template/weather.py", line 284, in async_added_to_hass
await super().async_added_to_hass()
File "/usr/src/homeassistant/homeassistant/components/template/template_entity.py", line 357, in async_added_to_hass
await self._async_template_startup()
File "/usr/src/homeassistant/homeassistant/components/template/template_entity.py", line 334, in _async_template_startup
result_info.async_refresh()
File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 895, in async_refresh
self._refresh(None)
File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 1072, in _refresh
self.hass.async_run_hass_job(self._job, event, updates)
File "/usr/src/homeassistant/homeassistant/core.py", line 433, in async_run_hass_job
hassjob.target(*args)
File "/usr/src/homeassistant/homeassistant/components/template/template_entity.py", line 306, in _handle_results
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 505, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 540, in _async_write_ha_state
attr.update(self.state_attributes or {})
File "/usr/src/homeassistant/homeassistant/components/weather/__init__.py", line 251, in state_attributes
forecast_entry = dict(forecast_entry)
ValueError: dictionary update sequence element #0 has length 1; 2 is required
I’m suspecting the problem is the addition of the sunrise and sunset fields included in each forecast attribute of the Weatherflow data; that is the only significant thing that is different when I look at the Weatherflow state vs. Accuweather via the Developer Tools state viewer (Accuweather doesn’t have it). [Seems like sunrise and sunset are redundant anyway since they are available in sun.sun]. Also looking at the forecast dict definition in components/weather/__init__.py
trying to figure out what is wrong, it seems like the sunrise and sunset aren’t there either. I’m not a Home Assistant developer, so I may be totally off base on my assumption but thought I would pass along my investigation.
The forecast line I used in configuring the Weather Template is
forecast_template: "{{ state_attr('weather.weatherflow_day_based_forecast', 'forecast') }}"