home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.56k stars 30.73k forks source link

NINA integration: attribute "Headline" is also needed while binary sensor is "off" #66467

Closed niwi-hh closed 2 years ago

niwi-hh commented 2 years ago

The problem

I want to write an automation that turns my air ventilation system off, whenever NINA is warning of air pollution. Since the integration is only offering unspecific warning sensors, my automation cannot be triggered alone by an sensor turned on. As condition I also have to use some key words inside of the attribute "Headline" in order to know, that air pollution is the danger.

Currently such an automation cannot be written by the GUI, because the attribute "Headline" is only offered by the integration while the status of a binary sensor is "on". This means, that while the status is off, the GUI is not offering the option to use words from the headline inside of a condition.

If the NINA integration would offer a blank headline information while a binary sensor is off, this problem should be gone.

Additionally it would be great if the whole NINA message would be available via the integration. This would make it much easier to find reliable conditions.

What version of Home Assistant Core has the issue?

core-2022.2.6

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

NINA

Link to integration documentation on our website

https://www.home-assistant.io/integrations/nina/

Diagnostics information

No response

Example YAML snippet

Here you can find a not fully tested first attempt of my automation (written mostly without the GUI because of the problem described in this bug report):

alias: Nina-Warnung -> Hauslüftung aus
description: ''
trigger:
  - platform: state
    entity_id: binary_sensor.warning_hamburg_freie_und_hansestadt_1
    from: 'off'
    to: 'on'
condition:
  - condition: or
    conditions:
      - condition: state
        entity_id: binary_sensor.warning_hamburg_freie_und_hansestadt_1
        state: Fenster
        attribute: Headline
      - condition: state
        entity_id: binary_sensor.warning_hamburg_freie_und_hansestadt_1
        state: Großbrand
        attribute: Headline
      - condition: state
        entity_id: binary_sensor.warning_hamburg_freie_und_hansestadt_1
        state: Feuer
        attribute: Headline
      - condition: state
        entity_id: binary_sensor.warning_hamburg_freie_und_hansestadt_1
        state: Rauch
        attribute: Headline
      - condition: state
        entity_id: binary_sensor.warning_hamburg_freie_und_hansestadt_1
        state: Qualm
        attribute: Headline
      - condition: state
        entity_id: binary_sensor.warning_hamburg_freie_und_hansestadt_2
        state: Fenster
        attribute: Headline
      - condition: state
        entity_id: binary_sensor.warning_hamburg_freie_und_hansestadt_2
        state: Großbrand
        attribute: Headline
      - condition: state
        entity_id: binary_sensor.warning_hamburg_freie_und_hansestadt_2
        state: Feuer
        attribute: Headline
      - condition: state
        entity_id: binary_sensor.warning_hamburg_freie_und_hansestadt_2
        state: Rauch
        attribute: Headline
      - condition: state
        entity_id: binary_sensor.warning_hamburg_freie_und_hansestadt_2
        state: Qualm
        attribute: Headline
action:
  - service: script.turn_on
    data: {}
    target:
      entity_id: script.1643537062146
  - service: notify.alexa_media_echo_kuche
    data:
      message: >-
        Es gibt eine Warnmeldung von Nina. Bitte prüfe, ob du die Fenster
        schließen musst. Die Hauslüftung ist schon aus.
      data:
        type: tts
mode: single

Anything in the logs that might be useful for us?

No response

Additional information

No response

probot-home-assistant[bot] commented 2 years ago

nina documentation nina source (message by IssueLinks)

probot-home-assistant[bot] commented 2 years ago

Hey there @deermaximum, mind taking a look at this issue as it has been labeled with an integration (nina) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

DeerMaximum commented 2 years ago

Thanks for the feedback.

The empty attributes were removed during the intergration to Home Assistant as they were deemed unnecessary (See https://github.com/home-assistant/core/pull/56647#discussion_r756713675). When creating the automation, the attribute can also be entered into the field by hand. To solve the problem I will add a list of attributes to the documentation.

Also, it is planned to make the entire warning available.