Component to get Krisinformation for Home Assistant.
Will get all messages from Krisinformations api in a set radius from your coordinates. If one of the fetched messages is an alert as opposed to news, the state of the sensor will be "Alert". The sensor contains all fetched messages as objects.
Use together with custom card for Lovelace.
This component is supported by Custom updater and Tracker card.
- Install this component by creating a
custom_components
folder in the same folder as your configuration.yaml is, if you don't already have one. - Inside that folder, create another folder named
krisinformation
. Put the contents of the custom_components folder in there. - You will need to restart after installation for the component to start working.
- Add the integration in the Configuration GUI under integrations
- If you're having issues, ask for help on the forums or post an issue.
Example automation for getting a notification when the sensor has an alert: Make sure you change the sensor name if you didn't use the default name.
automation:
- alias: 'Krisinformation Alert'
initial_state: 'on'
trigger:
platform: state
entity_id: sensor.krisinformation
to: "Alert"
action:
- service: notify.my_phone
data_template:
message: >
{{states.sensor.krisinformation.attributes.messages[0].Headline}} - {{states.sensor.krisinformation.attributes.messages[0].Message}} {{states.sensor.krisinformation.attributes.messages[0].Web}}
Like my work and want to say thanks? Do it here: