I have been learning Python while developing this component. It has been an interesting project and I have reformatted all the code several times while learning different ways to do it, but I guess it is now ready to share with you and of course get all your feedback.
To use this component in your HA you will need to obtain a personal API KEY from AEMET Open Data.
This is the Spanish Weather & Forecast agency so you will find all the information in Spanish. You can only obtain weather info for Spanish locations.
Configuration:
Copy files in aemet directory from GitHub to your custom_component folder.
On your configuration.yaml file you need to enter:
This component obtains location automatically from location defined on HA. But you can also specify your location by adding latitude and longitude parameters.
Forecast information is retrieved, but you need the weather card to see the information. It contains several “objects” with date, temperature, humidity… those objects are json data.
It is possible to see the information by clicking on button
Hi, is this still working? I have some errors. Thanks for the help!
aemet: Error on device update!
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 312, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 476, in async_device_update
await self.hass.async_add_executor_job(self.update)
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 240, in wrapper
result = method(*args, **kwargs)
File "/config/custom_components/aemet/weather.py", line 396, in update
self._aemet.update()
File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 240, in wrapper
result = method(*args, **kwargs)
File "/config/custom_components/aemet/aemet.py", line 1139, in update
api_client=self.api_client,
File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 240, in wrapper
result = method(*args, **kwargs)
File "/config/custom_components/aemet/aemet.py", line 860, in update
data = self._update_forecast()
File "/config/custom_components/aemet/aemet.py", line 848, in _update_forecast
clean_data = self._refactor_forecast(raw_data)
File "/config/custom_components/aemet/aemet.py", line 789, in _refactor_forecast
transformed_data[fecha][horas] = value
KeyError: '2020-04-02T00:00:00'