SMHI Alert for weather warnings (in Sweden)

I’ve created my first custom component and lovelace card for it, that I use to get weather warnings from SMHI in Sweden (using their open API).

It might be of interest to others, here is the repo:

2 Likes

Trevligt! Will try it out :wink:

1 Like

Nice! will also try this out! :slight_smile:

1 Like

No weather warnings yet, but works fine in HA! :+1::blush: thanks!

Nice, installing! And thanks for the mention in the repo.

Hi! Since a couple of days ago the component stoped working. Any info regarding this?

Strange, I will take a look.

So it seems to be caused by the fact that there are no current warnings in Sweden right now. So the API response is an empty JSON. I will have to add a fix for this. So it actually works, but just warns about this since there are nothing to parse.

Edit: New version at github

Ok, i have updated the file and now its working again! THX :slight_smile:

Hi! This component stoped working with the latest version of HA. HA complains about Rest data

Its working again.

I hope someone can help me. I want to display for exampel Område in markdown card. This content is under notice but i cannot get it to show on my dashboard. Any ideas?

notice: [Gul] (2023-01-29T15:30:27.324Z)
Område: Gävleborgs län
Nivå: Gul
Typ: Isbeläggning
Start: 2023-01-29T23:00:00.989Z
Slut: 2023-01-30T08:00:00.684Z
Beskrivning:
Vad händer: Natt mot måndag och måndag morgon rör sig regn åt sydost följt av sjunkande temperatur. På flera håll kan vägarna fortfarande vara blöta samtidigt som yttemperaturen sjunker till minusgrader och risk för ishalka med början från nordväst/väst.
Händelsebeskrivning: Natt mot måndag och måndag morgon följs regn av snabbt sjunkande temperatur på flera håll. Risk för plötslig ishalka då blöta vägar kan frysa till.
Hur kan det påverka mig: Trafiken går långsammare på grund av halka. 
Begränsad framkomlighet på vägar på grund av trafikolyckor. 
Risk för förseningar inom buss-, tåg- och flygtrafiken samt inställda avgångar.
Kommentar: Viss variation i nederbördsmängd och yttemperatur. Svårbedömt hur omfattande regnet blir och hur mycket fukt som finns på vägarna där temperaturen sjunker till minusgrader. Med det även hur omfattande ishalkan och konsekvenserna blir.
Var: På flera håll i delar av mellersta och norra Götaland, Svealand och allra sydligaste Norrland.

I cannot get this to work. I have followed the instructions, available here, to the point but the custom-card only prints an error as shown in the printscreen below.

image

Can somebody please point the in the right direction? I really want this integration and custom card to work (and the “Krisinformation” integration if there is a working fork?).

Did you get this to work?

Hi Mathias, I just noticed your message. Yes, I did get the sensor to work (can’t remember if I got the card to work as well but I believe I failed here).

I’m currently using the sensor for an automation script where it sends the information to a personal “external warnings” channel on telegram.

I followed, and modified the action part, in the first automation example on:
GitHub - Lallassu/smhialert: Home Assistant SMHI Warnings & Alerts

I had to make use of Swedish words instead of the English ones in the example. For instance: ‘Varning’ instead of ‘Alert’.

Below is an extract from my automation in yaml format:

alias: Extern information
description: ""
trigger:
  - platform: state
    entity_id: sensor.smhialert
    to: Varning
    id: smhivarning
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - smhivarning
        sequence:
          - service: notify.externa_varningar
            data:
              title: SMHI Varning!
              message: "{{ states.sensor.smhialert.attributes.notice }}"

Hi!

i got the integration to work as well. But are you able to use the SMHI Alert Card? My workaround now is a markdown card and a template.

Nope, did not get the card to work.

I’ve updated the SMHI Weather Warnings integration and dashboard card for Home Assistant. If you’re interested, you can check out the post here: SMHI Weather Warnings & Alerts