Krisinformation Sensor is a custom component for Home Assistant that retrieves crisis alerts (VMA) from Sveriges Radio's API for Important Public Announcements. It allows you to filter alerts by municipalities, county or Sweden to view all alerts for the entire country.
There is also a dashboard card specifically for this integration, which can be found here: Krisinformation Alert Card.
You can install this integration as a custom repository by following one of these guides:
To install the custom component using HACS:
- Click on the three dots in the top right corner of the HACS overview menu.
- Select Custom repositories.
- Add the repository URL:
https://github.com/Nicxe/krisinformation
. - Select type: Integration.
- Click the ADD button.
Without HACS
- Download the latest release of the SMHI Alert integration from GitHub Releases.
- Extract the downloaded files and place the
smhi_alerts
folder in your Home Assistantcustom_components
directory (usually located in theconfig/custom_components
directory). - Restart your Home Assistant instance to load the new integration.
To add the integration to your Home Assistant instance, use the button below:
Tip
You can easily set up multiple sensors for different locations by clicking Add Entry on the Krisinformation integration page in Home Assistant. No YAML configuration is required, and each sensor can have its own unique setup.
If the button above does not work, you can also perform the following steps manually:
- Browse to your Home Assistant instance.
- Go to Settings > Devices & Services.
- In the bottom right corner, select the Add Integration button.
- From the list, select Krisinformation.
- Follow the on-screen instructions to complete the setup.
This example demonstrates how to use the sensor.krisinformation_norrbotten to send a notification containing the Headline and PushMessage from the first alert in the sensor’s alerts attribute.
The following Jinja2 template extracts the Headline and PushMessage from the sensor’s alerts attribute:
{% set alert = state_attr('sensor.krisinformation_hela_sverige', 'alerts')[0] %}
{{ alert['event'] }}: {{ alert['description'] }}
To send this as a notification via Home Assistant, you can use the following automation configuration:
automation:
- alias: "Krisinformation Alert Notification"
trigger:
- platform: state
entity_id: sensor.krisinformation_hela_sverige
condition: []
action:
- service: notify.mobile_app_your_phone
data:
title: "{{ state_attr('sensor.krisinformation_hela_sverige', 'alerts')[0]['alerts'] }}"
message: "{{ state_attr('sensor.krisinformation_hela_sverige', 'alerts')[0]['description'] }}"
Explanation:
- Trigger: The automation is triggered whenever the state of sensor.krisinformation_norrbotten changes.
- Action: The notify service sends a notification with:
- Title: The Headline from the first alert in the alerts attribute.
- Message: The PushMessage from the same alert.
This automation ensures you are immediately informed about important updates in the sensor.
Note
Replace mobile_app_your_phone with the name of your mobile app notification service. If the alerts attribute contains multiple alerts and you want to handle them differently, you can modify the template to iterate over the list or select specific items.
Using the Krisinformation Alert Card
Contributions, bug reports, and feedback are welcome. Please feel free to open issues or pull requests on GitHub.