Custom weather and sensor platform that extracts weather data from Finnish Meteorological Institute (FMI) Open-Data API (https://en.ilmatieteenlaitos.fi/open-data).
Platforms
Currently this supports Weather and Sensor platforms.
Sensor platform also provides a type Best Time of the Day, based on user preferences that can perhaps be used to trigger notifications for outdoor activities.
Installation Instructions
Code Repository
Do give this a shot and let me know your feedback.
Just installed and looks good! Great stuff. I’m planning on integrating this with my automower to avoid unnecessary mowing when likelihood of rain is high. And as a Finn this info is definitely more reliable than Dark Sky or other platforms. So highly appreciated!
Couple of questions though; when you use this yourself do you get same forecast data from the fmi platform that you get from Ilmatieteenlaitos.fi? I’m getting different hourly forecast for some reason … though the location might be the key here as the web page is not per my latitude/longitude but the general area I would assume.
Secondly more related to the weather platform; any idea how to extract the forecast attributes? I would be interested in picking up the forecasted condition but as there are multiple in the attributes I dont really have a clue how to formulate the template.With quick search on Google came up short.
I also noticed that Ilmatieteenlaitos.fi observations/forecast differ from the one available via their Open-Data API. I am not sure if it’s due to the location or if it’s due to the frequency of forecast data updated at this API. On their web page it says forecast models are updated more than once per day, but that’s the only detail I could find. Probably the web service has more frequent updates than the Open-Data API.
The weather sensor produces an array of forecast objects. One possible template example to extract today’s condition and temperature for an action, could be:
{% for forecast in state_attr("weather.fmi", "forecast") %}
{% if forecast.datetime.day == now().day %}
Condition is {{ forecast.condition }} and temperature is {{ forecast.temperature }}
{% if forecast.temperature > 15 %}
Do something!!
{% endif %}
{% endif %}
{% endfor %}
If I try this in Developer Tools --> Template Editor, I get:
Condition is sunny and temperature is 17.5
Do something!!
Do you see it feasible to add an attribute to the FMI sensor of the distance to closest lightning strike based on the location set - and when that occured? I understood that FMI has the the data but not sure if its there in the same db that you pull this forecast info from?
Finally I got some time to get this working. Please check the latest commit. I tested this with current HASS version and develop branch and it works fine. Do let me know if you face any issues.
I can’t seem to get this to work. I’ve downloaded the files under /custom_components/fmi and added the example sensor config to configuration.yaml (also tried the weather platform, same results).
Home Assistant says “Platform error sensor.fmi - Integration ‘fmi’ not found.”
Any ideas? Tried multiple restarts.
I’m running Home Assistant Supervised, version 0.114.4.
I have 0.115 and not seeing any issues. Do you have the detailed logs, that shows some kind of tracepath? One of the constant values - UNIT_PERCENTAGE was replaced with PERCENTAGE in the core hass module. This was a breaking change which made fmi non-functional in 0.115. That was fixed in latest fmi version to get it working for 0.115. I believe this is what is causing the issue in your environment.
It may be a good idea to upgrade to 0.115, or else I can try to avoid the core hass dependency to make this backwards compatible. That may take some time. Let’s see.
I upgraded to the newest version, no help there :S
Here’s a paste from the HA logs section:
Logger: homeassistant.setup
Source: custom_components/fmi/__init__.py:171
First occurred: September 24, 2020, 9:22:24 PM (1 occurrences)
Last logged: September 24, 2020, 9:22:24 PM
Error during setup of component fmi
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 213, in _async_setup_component
result = await task
File "/config/custom_components/fmi/__init__.py", line 171, in async_setup
for index, entity in enumerate(config[DOMAIN], start=0):
KeyError: 'fmi'
When I downloaded the master.zip and unzipped it to the /fmi directory, the zip had a directory inside it. I removed that and the files are directly under /fmi. Is this okay?
I have a feeling that this is a really stupid user error, but my knowledge of these custom integrations are close to none and therefore can’t avoid those errors
Hi and thanks for FMI integration. I’ve installed as told and end result looks just like it should. However sensor platform is not updating? I think it worked in 2020.12 but not sure since last value keeps on for a while.
Now I’m running 20.10.2 and weather works fine but sensors not?
@vesatakomo: Thanks for trying this out! There was a bug in the refresh calls. And I am not sure what changed between the releases, but it requires a manual call to the update functions now. Either way I have tested this now and seems to be working fine. Please do try the latest version and let me know how it goes.
@anand-p-r I installed this today and it’s working fine. One question though: by default, it’s showing the hourly forecast. I would like to see daily forecast (like the default integration does). How can I change that? I’m using this with the Weather Forecast card.
Another question: may I now completely remove the Met.no integration?
Hi @Jay_Jay: You can find the FMI integration under the Configuration → Integrations page. On the FMI card, there is a link that says OPTIONS. Click that and you will find a menu to update forecast interval and other goodies as well.
However if you choose the forecast interval as 24hrs, by default the FMI python client library that this integration uses, only fetches the forecast for the next 2 days. Hope this helps.