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

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

HI,

there aren’t many template sensors really, the binary_sensor has attributes, and those are displayed using the code in the card using Markdown.

In my card, I use the sensor.weer_alarm, which is a template sensor:

      weer_alarm:
        friendly_name: Weeralarm
        value_template: >
          {% if is_state('binary_sensor.meteoalarm_brabant','on') %}
          {% set code = state_attr('binary_sensor.meteoalarm_brabant','awareness_level').split(';')[1] %}
          {{code|title}}
          {% else %} Green
          {% endif %}
        icon_template: >
          {% if is_state('binary_sensor.meteoalarm_brabant','on') %}
          {% set code = state_attr('binary_sensor.meteoalarm_brabant','awareness_level').split(';')[0] %}
          {% else %} {% set code = '0' %} 
          {% endif %}
          {{'mdi:numeric-' + code + '-box'}}

I customize both sensors using:

homeassistant:
  customize:
    sensor.weer_alarm:
      templates:
        icon_color: >
          return state;

    binary_sensor.meteoalarm_brabant:
      friendly_name: Meteoalarm Brabant
      templates:
        icon_color: >
          return entities['sensor.weer_alarm'].state;

the above customizations need custom-ui.

1 Like

Thanks for showing me your config. I got something to do again. :+1:

I followed your indications and coded those templates regarding my needs and i get this:

45

Actually there is no alarm, but how to change the word ‘undefined’ in something else? And where is the related icon?

My template is:

- platform: template
  sensors:
    severita_meteo_abruzzo:
      friendly_name: Allarme Meteo Abruzzo
      value_template: >
        {% if is_state('binary_sensor.allarme_meteo_abruzzo','on') %}
        {% set param = state_attr('binary_sensor.allarme_meteo_abruzzo','severity') %}
          {% if param == 'Moderate' %} Yellow
          {% elif param == 'Severe' %} Orange
          {% elif param == 'Dangerous' %} Red
          {% else %} White
          {% endif %}
        {% else %} Grey
        {% endif %}
      icon_template: >
        {% set state = states('sensor.allarme_meteo_abruzzo') %}
        {% if state == 'Yellow' %} {% set code = '2' %}
        {% elif state == 'Orange' %} {% set code = '3' %}
        {% elif state == 'Red' %} {% set code = '4' %}
        {% else %} {% set code = '0' %} 
        {% endif %}
        {{'mdi:numeric-' + code + '-box'}}

Hey Marius,
Are you still using this?

You mean this?

Yes exactly.
Can you posted the latest lovelace code?