Getting Started with NINA Integration

Find a test region with actual alarm notifications in Aktuelle Warnmeldung. Chose your test region in the NINA setup. In my case, it was the county “Solingen, Klingenstadt”. After completion of setup, find the binary_sensors in “Developer Tools”.

Here you see a list of (all) attributes. I’m only interested in the attribute “Headline”.

My Lovelace approach for up to three alarms: Create three conditional cards, one for each binary_sensor (style may be provided by HACS and can be omitted):

type: conditional
conditions:
  - entity: binary_sensor.warning_solingen_klingenstadt_1
    state: 'on'
card:
  type: entities
  style: |
    ha-card {
      background-color: red
    }
  entities:
    - type: attribute
      entity: binary_sensor.warning_solingen_klingenstadt_1
      attribute: Headline
      name: NINA 1
      icon: mdi:hazard-lights

Currently only one sensor is active. But all three are visible, while in the Editor.


Final test result after leaving the editor:

After feeling comfortable with your test setup, delete NINA and start over again with your target home county/city.

(edit) My seamless deployment:

My NINA has the same behaviour as Notifications (custom:home-feed-card) and DWD warnings (custom:meteoalarm-card): They consume display space only when needed.

Final tweaks:

type: conditional
conditions:
  - entity: binary_sensor.warning_berlin_stadt_1
    state: 'on'
card:
  type: entities
  style: |
    ha-card {
      background-color: red;
      font-size: 16px
    }
  entities:
    - type: attribute
      entity: binary_sensor.warning_berlin_stadt_1
      attribute: Headline
      name: Berlin
      image: local/images/nina-icon.png
4 Likes

looks awsome!
would you share your nina icon?

https://de.wikipedia.org/wiki/NINA_(App)

Does anyone know if it’s possible to combine the Nina integration and it’s multiple binary_sensors with the custom:auto-entities card? I have set up 5 binary_sensors and want to have the output of your entities card for each warning. You can easily filter all binary_sensors created by the integration but it displays the state unsafe and not the attribute Headline. How do I get the value of Heading as primary info?

type: custom:auto-entities
card:
  type: entities
  title: Nina Warn App
entities: null
filter:
  include:
    - entity_id: binary_sensor.warning_berlin_stadt_*
      state: 'on'
show_empty: false
sort:
  method: name

I use it with auto entities and a custom:button-card. Maybe this is helpful:

type: custom:auto-entities
card:
  type: grid
  square: false
  columns: 1
card_param: cards
filter:
  include:
    - domain: binary_sensor
      entity_id: "*warning_YOURCITYHERE*"
      state: "on"
      options:
        type: custom:button-card
        name: "[[[ return entity.attributes.Headline; ]]]"
        template:
          - card_binary_sensor

With this example it should look like this (untested):

type: custom:auto-entities
card:
  type: grid
  square: false
  columns: 1
card_param: cards
filter:
  include:
    - domain: binary_sensor
      entity_id: "*warning_YOUR_CITY_HERE*"
      state: "on"
      options:
        type: entities
        style: |
          ha-card {
            background-color: red
          }
        entities:
          - type: attribute
            attribute: Headline
            name: NINA 1
            icon: mdi:hazard-lights

Would there be possibility to include text in other languages (user selected), it’s available in the official application, so I guess there is a feed for that as well?

I see the official json contains not only German but also translations, if translation not available it would need to fallback to DE.

 {
    "id": "dwd.2.49.0.0.276.0.DWD.PVW.1645004640000.68654e53-ca58-48c5-882b-a9e1ba20e7f8.MUL",
    "payload": {
      "version": 2,
      "type": "ALERT",
      "id": "dwd.2.49.0.0.276.0.DWD.PVW.1645004640000.68654e53-ca58-48c5-882b-a9e1ba20e7f8.MUL",
      "hash": "096cb614293037cb9f9966e0b34819f82066dc676c5f5a8d9e3fb85456352c01",
      "data": {
        "headline": "Amtliche UNWETTERWARNUNG vor ORKANARTIGEN BÖEN",
        "provider": "DWD",
        "severity": "Severe",
        "msgType": "Update",
        "area": {
          "type": "ZGEM",
          "data": "1,38+137,243,246,248,254,256,258+2,268+2,276+59,347+3,354+320,676,678+8,695+4,725,731+1,735,737,740+17,760+61,823+12,837+159,998+418,1427+3,1435+14,1463,1478+35,1516+181,1721+10,1737+17,1770,1782+42,1829+250"
        }
      }
    },
    "i18nTitle": {
      "de": "Amtliche UNWETTERWARNUNG vor ORKANARTIGEN BÖEN",
      "en": "Official SEVERE WEATHER WARNING of VIOLENT STORM GUSTS",
      "ar": "تحذير رسمي من عواصف إعصارية",
      "es": "AVISO oficial de MAL TIEMPO por RACHAS DE TIPO HURACANADO",
      "fr": "ALERTE officielle FORTES INTEMPÉRIES pour RAFALES DE FORCE TEMPÊTE VIOLENTE",
      "pl": "Oficjalne OSTRZEŻENIE METEOROLOGICZNE (3. STOPNIA) przed WICHURAMI O SILE HURAGANU",
      "ru": "Официальное штормовое предупреждение: Шквалы мощного штормового ветра",
      "tr": "KASIRGA BENZERİ ESİNTİLERE karşı resmi KÖTÜ HAVA KOŞULLARI UYARISI"
    },
    "sent": "2022-02-16T10:43:24+01:00",
    "onset": "2022-02-16T22:00:00+01:00",
    "expires": "2022-02-17T18:00:00+01:00",
    "effective": "2022-02-16T10:44:00+01:00"
  },

Hallo :slight_smile:
this thread was very helpful for me to integrate NINA in my Dashboard. Thank you all very much for that. I was able to create a pretty nice card for myself. But I am having issues with the alignment. (see picture) somebordy has an idea how to align all the text in the same way?

Unbenannt

Could you please post your code? This is exactly what I was asking for and I cannot get it to work.

Sure I can share it. Its an conditional card just like the one heinrich did. only difference is that I used an rgba value to add a transperant effect. And I took the Nina logo from the official bbk website BBK Mediakit and edited it to fit my needs. I just uploaded it into the www folder to make it available under /local/nina_logo.png. I am not sure if I am legally allowed to share my altered icon?
I hope that helps you.

type: conditional
conditions:
  - entity: binary_sensor.warning_bremen_stadt_1
    state: 'on'
card:
  type: entities
  style: |
    ha-card {
      background-color: rgba(255, 80, 80, 0.2);
      font-size: 16px;
    }
  entities:
    - type: attribute
      entity: binary_sensor.warning_bremen_stadt_1
      attribute: Headline
      name: Bremen
      image: /local/nina_logo.png

If you want to add other atributes you can do it like this for example:

Sorry, I misunderstood. It’s not what I was searching for. When you add the NINA integration to HASS it’ll ask you how many sensors you’d like to add. In my example I added 3 and Hass creates 3 entities:

  • binary_sensor.warning_CITY_1
  • binary_sensor.warning_CITY_2
  • binary_sensor.warning_CITY_3

But there aren’t always 3 active warnings for these sensors. What I am looking for is an auto-entities card that creates a card like yours dynamically for all sensors that show an active warning.

Something like where I use placeholders like

    - type: attribute
      entity: binary_sensor.warning_CITY_*
      attribute: Headline
      name: CITY

If I have like 2 active warnings it shall automatically create 2 attributes cards like this:

entities:
    - type: attribute
      entity: binary_sensor.warning_CITY_1
      attribute: Headline
      name: CITY
    - type: attribute
      entity: binary_sensor.warning_CITY_2
      attribute: Headline
      name: CITY

so it should be like this?

the problem why the unused cards are not disappearing is that the data source nina is not having an empty “Headline” attribute when there is no warning. instead it seems to send a dash “-”

did I get you problem right now? :slight_smile:

Edit:

I think I got it working by adding this:

filter:
  exclude:
    - state: off

Yes! Thanks for your help.

Hey, nice integration and card.

I wonder how to display more information about the warning. The sensor does not have to much information beside “Bombenfund”. But with ID and Headline attributes an url pointing to the official warnung could be created:
https://warnung.bund.de/meldung/<ID>/<Headline>
https://warnung.bund.de/meldung/mow.DE-NW-K-SE031-20220331-31-000/Bombenfund

Any ideas how to modify the card to open that site when clicking the card?

Calculating the url does work in markdown cards, but that’s ugly.

Is there a way to calculate the url value in an entities card?

          url: >-
            https://warnung.bund.de/meldung/{{
            state_attr('binary_sensor.warning_koln_stadt_1','ID' ) }}/{{
            state_attr('binary_sensor.warning_koln_stadt_1', 'Headline' ) }})"

with the same syntax as in markdown does not work…

Meanwhile figured out, that more attributes are in the pipe: Nina - missing warning information · Issue #66926 · home-assistant/core · GitHub

1 Like

Wow, ist schon arm dass im Mediakit kein vernünftiges icon logo zu finden ist und sie wegen Rechten so ein Trallala machen obwohl öffentlich finanziert. Hier gibts ein brauchbares logo https://upload.wikimedia.org/wikipedia/commons/thumb/d/da/Nina_app.png/200px-Nina_app.png

Can you post your complete code for copy and paste?
Somehow mine does not use the Headline correctly just shows up empty although the warnings are there and have the attribute Headline.


type: custom:auto-entities
card:
  type: entities
  title: Warnmeldungen München
filter:
  exclude:
    - state: 'off'
entities:
  - type: attribute
    entity: binary_sensor.warning_munchen_landeshauptstadt_1
    attribute: Headline
    name: München
    image: /local/Nina_app.png
  - type: attribute
    entity: binary_sensor.warning_munchen_landeshauptstadt_2
    attribute: Headline
    name: München
    image: /local/Nina_app.png
  - type: attribute
    entity: binary_sensor.warning_munchen_landeshauptstadt_3
    attribute: Headline
    name: München
    image: /local/Nina_app.png
  - type: attribute
    entity: binary_sensor.warning_munchen_landeshauptstadt_4
    attribute: Headline
    name: München
    image: /local/Nina_app.png
  - type: attribute
    entity: binary_sensor.warning_munchen_landeshauptstadt_5
    attribute: Headline
    name: München
    image: /local/Nina_app.png

Try headline in lower case.

1 Like

I started using explicit sensor templates to handle severity and duplicates with Deutscher Wetterdienst.

sensor .. 
      nina_berlin1_headline:
         value_template:  "{{ state_attr('binary_sensor.warning_berlin_stadt_1','headline') }}"
      nina_berlin1_severity:
         value_template:  "{{ state_attr('binary_sensor.warning_berlin_stadt_1','severity') }}"         
      nina_berlin1_sender:
         value_template:  "{{ state_attr('binary_sensor.warning_berlin_stadt_1','sender') }}"      

binary_sensor   ... 
      nina_berlin1_sender_is_dwd:
        value_template: "{{ states('sensor.nina_berlin1_sender')  == 'Deutscher Wetterdienst' }}"
1 Like

Hey! I have just released MeteoalarmCard 2.0 which brings support for NINA integration. You can configure the card like so:

type: custom:meteoalarm-card
integration: nina
entities:
  - entity: binary_sensor.warning_baden_baden_stadt_1
  - entity: binary_sensor.warning_baden_baden_stadt_2
  - entity: binary_sensor.warning_baden_baden_stadt_3
  - entity: binary_sensor.warning_baden_baden_stadt_4
  - entity: binary_sensor.warning_baden_baden_stadt_5

You can download it here:

4 Likes

Sorry I was not here for a while.
Yeah maybe I was a little bit overly careful with the rights for the image.
I am legally not allowed to share my altered version here thats a fact.
But of course I don’t think anything would ever happen if I did share it you are right with that.

If you still need it this is my complete code for the card:

type: custom:auto-entities
card:
  type: entities
  style: |
    ha-card {
      background-color: rgba(255, 80, 80, 0.2);
      font-size: 16px;
      text-align: auto;
    }
entities:
  - type: attribute
    entity: >-
      binary_sensor.warning_cuxhaven_stadt_cuxhaven_niedersachsen_beverstedt_cuxhaven_niedersachsen_1
    attribute: Headline
    name: Nordholz
    image: /local/nina_logo.png
  - type: attribute
    entity: >-
      binary_sensor.warning_cuxhaven_stadt_cuxhaven_niedersachsen_beverstedt_cuxhaven_niedersachsen_2
    attribute: Headline
    name: []
    icon: []
  - type: attribute
    entity: >-
      binary_sensor.warning_cuxhaven_stadt_cuxhaven_niedersachsen_beverstedt_cuxhaven_niedersachsen_3
    attribute: Headline
    name: []
    icon: []
  - type: attribute
    entity: >-
      binary_sensor.warning_cuxhaven_stadt_cuxhaven_niedersachsen_beverstedt_cuxhaven_niedersachsen_4
    attribute: Headline
    name: []
    icon: []
  - type: attribute
    entity: >-
      binary_sensor.warning_cuxhaven_stadt_cuxhaven_niedersachsen_beverstedt_cuxhaven_niedersachsen_5
    attribute: Headline
    name: []
    icon: []
filter:
  exclude:
    - state: 'off'
show_empty: false
sort:
  method: none

have a nice day :slight_smile:

1 Like

That looks great.

that makes all these workarrounds obsolete I gonna try it :slight_smile:

1 Like