I’m working on a new version, but it’s not ready yet.
This is a work in progress and I would appreciate having a couple of users testing it and reporting back!
# sensor.krisinformation
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.
## Installation:
1. Install this component by copying to your /custom_components/sensor/
folder.
2. Add the code to your configuration.yaml
using the config options below.
3. You will need to restart after installation for the component to start working.
* If you’re having issues, ask for help on the forums or post an issue.
Configuration variables:
key | type | description
:— | :— | :—
platform (Required) | string | krisinformation
latitude (Required) | sring | The latitude of the position from which the sensor should look for messages.
longitude (Required) | string | The longitude of the position from which the sensor should look for messages.
name (Optional) | string | Custom name for the sensor. Default krisinformation
radius (Optional) | number | The radius in km from your position that the sensor should look for messages. Default 50
Example configuration.yaml:
yaml</s> <s>sensor:</s> <s> - platform: krisinformation</s> <s> name: Krisinformation Stockholm</s> <s> latitude: !secret lat_coord</s> <s> longitude: !secret long_coord</s> <s> radius: 100</s> <s>
***
## Usage
Example automation for getting a notification when the sensor has an alert:
yaml</s> <s>automation:</s> <s> - alias: 'Krisinformation Alert'</s> <s> initial_state: 'on'</s> <s> trigger:</s> <s> platform: state</s> <s> entity_id: sensor.krisinformation</s> <s> to: "Alert"</s> <s> action:</s> <s> - service: notify.my_phone</s> <s> data_template:</s> <s> message: ></s> <s> {{states.sensor.krisinformation_stockholm.attributes.messages[0].Headline}} - {{states.sensor.krisinformation_stockholm.attributes.messages[0].Message}} {{states.sensor.krisinformation_stockholm.attributes.messages[0].Web}}</s> <s>