Love the new Meteoalarm - how do I put the alert in a card?

Hi all

I was looking at this, I really love the idea, but how do I place the output in a card?
I was thinking something like this:

card:
  message: "{{state_attr('binary_sensor.meteoalarm', 'description')}} is effective on {{state_attr('binary_sensor.meteoalarm', 'effective')}}"
  title: '{{state_attr('binary_sensor.meteoalarm', 'headline')}}'
conditions:
  - entity: binary_sensor.meteoalarm
    state_not: 'off'
type: conditional

This doesn’t work of course. Do I need to put the output in a template first, or are there any clever ways of doing this?

I use this:

  - type: custom:useful-markdown-card
    content: >
      # <font color= grey> Weer Alarm Brabant:  [[ binary_sensor.meteoalarm_brabant.state ]] </font>

      ___

      **Alarm code**

      <font color= [[ sensor.weer_alarm.state ]]> - [[ sensor.weer_alarm.state]] </font>

      <font color= [[ sensor.weer_alarm.state ]]> - [[ binary_sensor.meteoalarm_brabant.attributes.awareness_level]] </font>

      **Headline**

      <font color= #4caf50> - [[ binary_sensor.meteoalarm_brabant.attributes.headline ]] </font>

      **Event**

      <font color= #4caf50> - [[ binary_sensor.meteoalarm_brabant.attributes.event]] </font>

      **Status**

      <font color= #4caf50> - [[ binary_sensor.meteoalarm_brabant.attributes.description ]] </font>


      ___


which also uses a template sensor.weer_alarm, (filtering the awareness_level, because this card won’t accept things like .split(’;’)[0] yet …) but you get the idea:

01

1 Like

Ok, so you DID split the meteoalarm out in different sensors. That was what I was thinking was necessary as well.
You also make meteoalarm_brabant sensors as I can see it.
I guess that is the way forward then.

Thankyou @Mariusthvdb

you dont need to, you can also use only the binary_sensor, and its attributes directly as Ive done for event, status and headline

the brabant sensor is simply a matter of name: in the sensor config.

Can anyone help me set this up?

I can’t get it to work for this metro URL
https://www.meteoalarm.eu/en_UK/0/0/UK013-London%20&%20South%20East.html

I have tried

    country: 'UK'
    province: 'London & South East'

and

    country: 'UK'
    province: 'London%20&%20South%20East'

and even this (based on the RSS feed)

    country: 'UK'
    province: 'London South East'

Neither work, and yes there is a warning out :slight_smile:

image

not really clear is it…
can say my url is https://www.meteoalarm.eu/ne_NL/0/0/NL013-Noord-Brabant.html

and I use

binary_sensor:
  - platform: meteoalarm
    name: Meteoalarm Brabant
    country: 'NL'
    province: 'Noord-Brabant'

so maybe try dashes or even the + sign?

this url works:
https://www.meteoalarm.eu/en_UK/0/0/UK013-London+South+East.html as does this:
https://www.meteoalarm.eu/en_UK/0/0/UK013-London-South-East.html

Thanks but neither of those work and nor does

province: 'London+&+South+East'

I have a feeling there might be a bug in the code that doesn’t allow for the ‘&’.
Unfortunately my Python skill level is nowhere near high enough to check…

sorry to hear it doesn’t work. maybe the dev can help out, file an issue?

must say I had high expectations of this component, but it seems rather slow. Still showing the alarm code it did yesterday, and we had 2 serious weather changes in the past 24 hours… So either the meteoalarm is useless for actual and short term warnings (as many people complain all the time) or the card should be updated more frequently. Suspect the former, since checking the national weather authority shows the exact same code…

hhmmm…
Sounds like I am not missing too much then. That is a shame as I was quite excited by it too.

I’ll raise an issue and see how it goes…

I think meteoalarm is merely compiling the national weather authorities, so if they don’t update properly, meteoalarm won’t either.

yes, that’s how I understood it also. Had been looking for a open api to the dutch KNMI weeralarm for a longer time, which seems to not be available. That why I welcomed the meteoalarm initiative and component integration.

Maybe its use is specifically longer term, and we should complement that with current weather sensors/integrations

If you open your province on the meteoalarm site and don’t see the red ATOM icon near the RSS feed,
20190619_14%3A21%3A35_001
this component will not work for you.

check this thread: Is meteoalarm.eu down?

today, the meteoalarm integration and sensor finally changed state. It is Off. However, the markdown card I made, based on its attributes is useless now:
11

the binary_sensor has no attributes in the Off state, which I would classify as an issue, maybe even a bug?
11

the integration should/could easily be made aware of the ‘safe’ situation, and replace the attributes with some default ‘Nothing to report’ text, rather then no attributes at all…

also, since it is off, the device_class: safety should take care of the icon being mdi:shield-check, which it obviously doesn’t.

Nevermind the icon_color template I made myself, which is based on the attribute awareness_level. This faults now too, since that attribute is no longer populated, and the template is still in the last state…

So I got the meteoalarm thing to show up properly now, by adding the custom card mod, I was able to get the attributes showing the way I wanted to in a card.
The ‘event’ attribute holds a colour and a type, like ‘yellow rain’.
I would like extract the first word, and use that as some sort of colour, and then keep the second word for the type of alert.
But how do I extract a single word from an attribute?

Hahaaaa, got it:
{{ state_attr(‘binary_sensor.meteoalarm’,‘event’).split(’ ‘)[0] }}
That will extract the first word
{{ state_attr(‘binary_sensor.meteoalarm’,‘event’).split(’ ')[1] }}
the second.

Weeheee

And the result is looking good:
I had to pull out the colour and type via two new sensors, as I couldn’t get the jinja split to work directly in the lovelace ui.
meteoalarm
I couldn’t make it change the background with the sensor value, but it looks great with just changing the text.

card:
  content: >
    # <font color=[[ sensor.meteo_colour ]]>[[
    binary_sensor.meteoalarm.attributes.headline ]] </font>

    <table>
      <tbody>
        <tr>
          <td><b>Alvorlighed</b></td>
          <td><font color=[[ sensor.meteo_colour ]]> [[
    binary_sensor.meteoalarm.attributes.severity ]]</font></td>
        </tr><tr>
        <td><b>Type</b></td>
        <td><font color= #4caf50>[[ sensor.meteo_type ]]</font></td>
        </tr><tr>
        <td><b>Beskrivelse</b></td>
        <td><font color= #4caf50>[[
    binary_sensor.meteoalarm.attributes.description ]]</font></td>
        </tr><tr>
        <td><b>Start</b></td>
        <td><font color= #4caf50>[[
    binary_sensor.meteoalarm.attributes.onset ]]</font></td>
        </tr><tr>
        <td><b>Slut</b></td>
        <td><font color= #4caf50> [[
    binary_sensor.meteoalarm.attributes.expires ]]</font></td>
        </tr>
      </tbody>
    </table>
  type: markdown
conditions:
  - entity: binary_sensor.meteoalarm
    state: 'on'
type: conditional

Now I need to improve the automation, as we went from yellow to orange here in denmark, with a new warning, and the warning was never sent out via the automation, as that checks for ‘off’.
So I will store the ‘description’ in a variable, and have the automation check against that instead I think, if I can make it work.

Looks good! I will try your lovelace conf out and wait for another weather incident :slight_smile:

I found out that using a table is not good if you want the card to be invisible when there is no alerts, so I’ve changed the card to:

card:
  content: >
    # <font color=[[ sensor.meteo_colour ]]>[[
    binary_sensor.meteoalarm.attributes.headline ]]
    </font><br/><b>Alvorlighed</b> <font color=[[ sensor.meteo_colour ]]> [[
    binary_sensor.meteoalarm.attributes.severity ]]</font><br/><b>Type</b> <font
    color= #4caf50>[[ sensor.meteo_type ]]</font><br/><b>Beskrivelse</b> <font
    color= #4caf50>[[ binary_sensor.meteoalarm.attributes.description
    ]]</font><br/> <b>Start</b> <font color= #4caf50>[[
    binary_sensor.meteoalarm.attributes.onset ]]</font><br/><b>Slut</b> <font
    color= #4caf50> [[ binary_sensor.meteoalarm.attributes.expires ]]</font>
  type: markdown
conditions:
  - entity: binary_sensor.meteoalarm
    state: 'on'
type: conditional

It isn’t as pretty, but now it’s invisible when no alert is active.
I’ve also changed the automation to simply react on ‘state change’, and not just from off to something else. I did add a condition that it shouldn’t change to off, but that doesn’t seem to work for me yet (I got a ‘none’ alert when the latest alert timed out).

yes,
have something alike:

  - type: custom:vertical-stack-in-card
    cards:
      - type: entities
        title: Weeralarm
        show_header_toggle: false
        entities:
          - binary_sensor.meteoalarm_brabant
          - sensor.weer_alarm
      - type: markdown
        content: >
          <font color= grey> Info:  [[ binary_sensor.meteoalarm_brabant.attributes.attribution ]] </font>
      - type: conditional
        conditions:
          - entity: binary_sensor.meteoalarm_brabant
            state: 'on'
        card:
          type: markdown
          content: >
            # <font color= grey> Weer Alarm Brabant:  [[ binary_sensor.meteoalarm_brabant.state ]] </font>

            ___

            **Alarm code**

            <font color= [[ sensor.weer_alarm.state ]]> - [[ sensor.weer_alarm.state ]] </font>

            <font color= [[ sensor.weer_alarm.state ]]> - [[ binary_sensor.meteoalarm_brabant.attributes.awareness_level ]] </font>

            <font color= [[ sensor.weer_alarm.state ]]> - [[ binary_sensor.meteoalarm_brabant.attributes.awareness_type ]] </font>

            **Headline**

            <font color= #4caf50> - [[ binary_sensor.meteoalarm_brabant.attributes.headline ]] </font>

            **Event**

            <font color= #4caf50> - [[ binary_sensor.meteoalarm_brabant.attributes.event ]] </font>

            **Status**

            <font color= #4caf50> - [[ binary_sensor.meteoalarm_brabant.attributes.description ]] </font>

            ___

showing this in no-alert state:

13

if an alert is on, all fields are populated.
could template the font colors also, but this works for now.

Hey guys,

I really like the way you configured the Meteoalarm sensor to show in a card and like to do it myself
I’m very new to all this and don’t now how you made those template_sensors?
How did you extract those attributes into a new sensor?
Could one of you show me how to start?

Thanx