core: Met.no fails to setup
The problem
Setup of Met.no fails through the UI. Weather domain and entities are not created.
Environment
- Home Assistant Core release with the issue: 0.115.2 (same issue on 0.115.1)
- Last working Home Assistant Core release (if known): Don’t know. Previously had the yr integration through yaml.
- Operating environment (OS/Container/Supervised/Core): Core ( on an Ubuntu 20.04.1 LTS box)
- Integration causing this issue: Met.no
- Link to integration documentation on our website: https://www.home-assistant.io/integrations/met/
Problem-relevant configuration.yaml
(no yaml config)
Traceback/Error logs
Logger: homeassistant.components.weather
Source: components/met/weather.py:218
Integration: Weather (documentation, issues)
First occurred: 7:19:15 PM (2 occurrences)
Last logged: 7:21:55 PM
Error while setting up met platform for weather
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/entity_platform.py", line 201, in _async_setup_platform
await asyncio.gather(*pending)
File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/entity_platform.py", line 310, in async_add_entities
await asyncio.gather(*tasks)
File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/entity_platform.py", line 481, in _async_add_entity
await entity.add_to_platform_finish()
File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 522, in add_to_platform_finish
self.async_write_ha_state()
File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 296, in async_write_ha_state
self._async_write_ha_state()
File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 322, in _async_write_ha_state
attr.update(self.state_attributes or {})
File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/weather/__init__.py", line 177, in state_attributes
if self.forecast is not None:
File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/components/met/weather.py", line 218, in forecast
ha_item[ATTR_FORECAST_CONDITION]
KeyError: 'condition'
Additional information
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 21 (10 by maintainers)
@reven, While reading over the pyMetno code, I was wondering if it might be a time zone issue, so I tried setting my machine to SF time, but still no dice.
The only way I can replicate the issue is by moving the date on my machine forward a few days. pyMetno asks the API for a forecast that goes 5 days into the future from the computer’s current date. If your computer’s date is in the future, we might end up asking for dates that are not yet available, resulting in empty entries.
Could you check your computer’s date?
I think you’re missing a
.get()
: