Deprecated - Custom Component Krisinformation (Sweden)

I had three different sensors configured and just put in three cards in my lovelace :slight_smile:

Oki then, may you share those 3 sensors.?

/Jerry

You just set up three ones in the same way you did the original one, if what you want is information from different places.

Hmm, i have this one in my config.yaml:

  • platform: krisinformation
    name: “Krisinformation Stockholm”
    county: “Stockholms län”
    latitude: my_latitude
    longitude: my_longitude
    radius: 100

This will display any “kris” within 100km radius? How do i set up a new one for sweden total, like yours in the youtube clip “krisinformation all”.?

/Jerry

That’s just one with a huge radius to cover all of Sweden!

Hi, yup got it :slight_smile:

Is there any changes to do in the .py file, because i dont get any alert messages, but all might be good in our country?

/Jerry

As long as you have the latest version all should be in order.

I installed it from the communtiy addon for hassio, so it must be the newest.

/Jerry

Nice component!

How can I test my automation for this? I’ve set the state to “Alert” and configured a state such as:

{
"messages": [
  "Headline:" "test",
  "Message": "test",
  "Web": "test"
]
}

But when I trigger the alarm I get:
Error rendering data template: UndefinedError: 'None' has no attribute 'attributes'

I’ve configured the action such as the example:

    - service: notify.email
      data_template:
         title: 'Krisinformation'
         message: '{{states.sensor.krisinformation.attributes.messages[0].Headline}} - {{states.sensor.krisinformation.attributes.messages[0].Message}} {{states.sensor.krisinformation.attributes.messages[0].Web}}'

I just want to make sure it works before it actually triggers :slight_smile:

It has to have the info in the trigger, won’t work if you trigger manually.

I’m a beginner to this. With this seems exciting. but what does the line look like in configuration.yaml?

! include sensor.pyn or perhaps sensor: !include sensor.py

HA notifies me "Config validating
Config error. See dev-info panel for details. " Maybe I miss something essential.

You don’t include the py-file. Read the instructions again :slight_smile: There’s an example configuration entry in the readme: https://github.com/isabellaalstrom/sensor.krisinformation#installation

1 Like

Many thanks, now I think it works / Stort tack!

1 Like

I like this component.

Any thoughts on a configurable limit of the age of the messages that are acquired from the feed? At the moment, I get a new notification that the power was returned to the hospital in Nyköping almost two weeks ago every time I restart HASS. (If not, I can change the automation that sends a notification, but that won’t fix the info displayed in the Lovelace card.)

That would be a good idea. I don’t however have the time to do this right now, but I will keep it in mind.

Hi! Did anyone else notice that the component reloads every ~20 minutes and send new notifications? Just woke up and have 22 notifications about the same alert. Or if it’s my local installation, but can’t see anything that would cause this. :sweat_smile:

I don’t have this problem at least. How does your automation look?

I’m trying to install this component for the first time but can’t manage to install it (manually). I used the instructions on Github. I saved sensor.py in raw format to
image
When I add the basic config (no areas) from the readme file on Github to configuration.yaml I get a message when checking the config in Home Assistant. If I try to restart through Home Assistant, nothing (!) happens except the button animation. If I remove the two lines from configuration.yaml I can restart as normal but no sensor is available in developer tools.

I’m running Home Assistant (formerly called hassio) version 106.5 (with Swedish translation).

Can this have location as device tracker position?
That would be great if you are on holiday within Sweden.

I have done a basic installation from HACS for both the sensor and the card. All files and the sensor seem to be in place, but I am not able to get the card working. Any idea whats wrong? When I set up a simple entity card I get “No new messages” so I assume there is a problem with the card. Do I need to add something in the Lovelace card?

No card type configured.

title: Krisinformation
resources:
  - url: /local/krisinfo-card.js
    type: module
views:
  title: Krisinformation Stockholm
  cards:
    - type: 'custom:krisinfo-card'
      entity: sensor.krisinformation