FMI Weather Data for Home Assistant

Best Time Of the Day!

Home Assistant has a number of weather integrations based on multiple open data weather sources. The default weather integration’s data source is MET. I live in Finland and have been using the default integration for weather updates. However as summer approaches, I wanted to derive a “Best Time Of The Day” parameter from the weather forecast. For instance, I would like to know the time of the day, when the temperature is at its highest, with relative humidity between 40–70% and no precipitation. I could plan some outdoor activities around this time. If the Home Assistant is integrated with a Smart Speaker such as Google Assistant or Alexa, it could also tell this time based on a user query.

The local weather service provider in Finland is FMI. However this does not have an integration for Home Assistant. Besides, the forecasts from MET were not as accurate as FMI which is understandable, given that MET predominantly caters to Norway. So I set aside some time to understand if a custom component can be developed for Home Assistant that draws it’s source from FMI. And if this component can be extended to provide the “Best Time Of The Day”. It looks like the developers of Home Assistant have spend considerable time to make the development process as smooth as possible. Even so, for a beginner the task can be daunting!

Nevertheless, I was able to develop a custom component that uses a python library — fmi-weather-client to pull weather observations and forecast from FMI’s Open-Data. Custom component contains integratoins for both the weather and sensor platforms. Here is the link to the code repository and the instructions to setup the custom component in Home Assistant:

Figure-1 is a screenshot of how this looks in Lovelace UI. Left side entity is the sensor platform and the right side entity with weather pictures is the weather platform. The entity on bottom of right side, is the “Best Time Of The Day” sensor.

Figure-1: FMI Weather and Sensor Integrations

Additionally, clicking on the the “Best Time Of The Day” sensor shows the attributes pertaining to the weather forecast of the selected time as shown in Figure-2.

Figure-2: Attributes of “Best Time Of Day” sensor

The sensor entity can be configured to specify user preferred temperature, humidity, wind speed and precipitation range. Accordingly the sensor entity identifies the time of the day satisfying those conditions and if such a time is found, it sets the state of the sensor as available. If such a time cannot be found, the sensor entity sets the state as unavailable and sets the attributes to the current weather conditions. With such state and attribute details quite many useful Automations can be developed in Home Assistant.

If time permits, I will try to submit a Pull Request to Home Automation repository on Github, that could be included in the upcoming releases. In the meantime, please do try the custom component and leave me feedback on GitHub.

Technology Enthusiast!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store