This custom integration for Home Assistant provides alerts from the Swedish VMA (Viktigt Meddelande till Allmänheten) system.
- Real-time updates of VMA alerts
- Count of active VMA alerts
- Last update time sensor
- Test mode switch for using the test API
- Ensure you have HACS installed in your Home Assistant instance.
- In the Home Assistant UI, go to HACS.
- Click on "Integrations".
- Click the three dots in the top right corner and select "Custom repositories".
- Add this repository URL:
https://github.com/erikarenhill/vma-alert-hass
- Select "Integration" as the category.
- Click "ADD".
- Close the custom repositories window.
- You should now see "VMA Alert" in the list of integrations. Click on it.
- Click "INSTALL" and then "INSTALL" again in the pop-up window.
- Restart Home Assistant.
- Copy the
custom_components/vma_alert_hass
directory to your Home Assistant'scustom_components
directory. - Restart Home Assistant.
- In the Home Assistant UI, go to "Configuration" -> "Integrations".
- Click the "+" button to add a new integration.
- Search for "VMA Alert" and select it.
- Follow the configuration steps. You can set the polling interval (default is 5 seconds).
After installation and configuration, you'll have the following entities:
sensor.vma_alert
: Shows the latest VMA alert or "No active alerts".sensor.active_vma_alerts
: Shows the count of active VMA alerts.sensor.vma_last_update
: Shows the timestamp of the last update from the VMA API.switch.vma_test_mode
: Toggles between the live API and the test API.
You can use these entities in your automations, scripts, and Lovelace UI.
Set up a new automation with trigger EVENT, type in "vma_new_alert" and leave the data field empty.
On actions, add a notification, then move over to manual yaml editing mode and copy paste this:
data:
title: 'VMA Alert: {{ trigger.event.data.info[0].event }}'
message: >
{{ trigger.event.data.info[0].description }} Urgency: {{
trigger.event.data.info[0].urgency }} Severity: {{
trigger.event.data.info[0].severity }} Certainty: {{
trigger.event.data.info[0].certainty }} Affected Area: {{
trigger.event.data.info[0].area[0].areaDesc }}
action: notify.YOUR_NOTIFICATION_SERVICE_HERE # <--------- dont forget to change this
Go to developer tools, actions then trigger VMA Alert: simulate_vma_event this will send a fake event on the bus for the vma_new_alert
OR
Switch on the Test mode, exposed as a control switch on the device for the integration.