Hello,
I would like to send the friendly name of the condition via message. I know the trigger.to_state.name
", but it’s not the trigger I want to get the name of when the automation is executed.
Ideas?
alias: SIGNAL - Fensterwarnung bei Regen/Schnee/Sturm
description: ""
trigger:
- platform: numeric_state
entity_id: sensor.openweathermap_weather_code
below: "532"
above: "499"
- platform: numeric_state
entity_id: sensor.openweathermap_weather_code
below: "322"
above: "299"
- platform: numeric_state
entity_id: sensor.openweathermap_weather_code
below: "623"
above: "599"
- platform: numeric_state
entity_id: sensor.openweathermap_weather_code
above: "199"
below: "233"
condition:
- condition: or
conditions:
- type: is_open
condition: device
device_id: 4007aaf80558f2dc178af38628f91eae
entity_id: >-
binary_sensor.lumi_lumi_sensor_magnet_aq2_acd2e401_on_off_wohnzimmer_velux
domain: binary_sensor
- type: is_open
condition: device
device_id: d6973fa533a0b291b1cb6076b73ac15d
entity_id: >-
binary_sensor.lumi_lumi_sensor_magnet_aq2_acd2e401_on_off_badezimmer_velux
domain: binary_sensor
- type: is_on
condition: device
device_id: 077a9e6b98a31d479c6935299a36a046
entity_id: binary_sensor.lumi_lumi_magnet_acn001_ias_zone_arbeitszimmer_velux
domain: binary_sensor
- type: is_on
condition: device
device_id: b8e8313505500909ec28fd4b61846ddd
entity_id: >-
binary_sensor.lumi_lumi_magnet_acn001_ias_zone_kinderzimmer_fenster_rechts
domain: binary_sensor
- type: is_on
condition: device
device_id: 2a48532229dc793d52863a97c5b11600
entity_id: binary_sensor.lumi_lumi_magnet_acn001_ias_zone_kueche_fenster
domain: binary_sensor
- type: is_open
condition: device
device_id: 0873fc6935ae1cbfc34974738e296aee
entity_id: >-
binary_sensor.lumi_lumi_sensor_magnet_aq2_acd2e401_on_off_schlafzimmerfenster_links
domain: binary_sensor
action:
- service: notify.signal_alert
data:
message: Fenster offen. Openweathermap Sturm/Schnee/Regen
mode: single
123
(Taras)
January 17, 2023, 9:42pm
3
An entity has a friendly_name
attribute. The value of an entity’s attribute is accessible via the trigger
variable (if the entity was part of the automation’s trigger).
Conditions don’t have attributes.
Don’t use conditions. Use a choose and make each condition its own choose block.
You still can’t get the friendly name of a condition because that’s impossible. But you can then send a different message depending on which condition is true.
123
(Taras)
January 17, 2023, 10:15pm
5
Perhaps this meets your requirements.
alias: SIGNAL - Fensterwarnung bei Regen/Schnee/Sturm
description: ""
variables:
windows:
- binary_sensor.lumi_lumi_sensor_magnet_aq2_acd2e401_on_off_wohnzimmer_velux
- binary_sensor.lumi_lumi_sensor_magnet_aq2_acd2e401_on_off_badezimmer_velux
- binary_sensor.lumi_lumi_magnet_acn001_ias_zone_arbeitszimmer_velux
- binary_sensor.lumi_lumi_magnet_acn001_ias_zone_kinderzimmer_fenster_rechts
- binary_sensor.lumi_lumi_magnet_acn001_ias_zone_kueche_fenster
- binary_sensor.lumi_lumi_sensor_magnet_aq2_acd2e401_on_off_schlafzimmerfenster_links
windows_open: "{{ expand(windows) | selectattr('state', 'eq', 'on') | map(attribute='name') | list }}"
trigger:
- platform: numeric_state
entity_id: sensor.openweathermap_weather_code
below: "532"
above: "499"
- platform: numeric_state
entity_id: sensor.openweathermap_weather_code
below: "322"
above: "299"
- platform: numeric_state
entity_id: sensor.openweathermap_weather_code
below: "623"
above: "599"
- platform: numeric_state
entity_id: sensor.openweathermap_weather_code
above: "199"
below: "233"
condition: "{{ windows_open | count > 0 }}"
action:
- service: notify.signal_alert
data:
message: "Fenster offen. Openweathermap Sturm/Schnee/Regen. Fensters: {{ windows_open | join(', ') }}"
mode: single
Thanks guys.
I also played a bit. Seems I forgot compeltely about this “new functionality”.
I solved it now like this:
alias: SIGNAL - Schnee, Regen, Wetter und Fenster offen TEST
description: ""
trigger:
- platform: numeric_state
entity_id: sensor.openweathermap_weather_code
below: "532"
above: "499"
- platform: numeric_state
entity_id: sensor.openweathermap_weather_code
below: "322"
above: "299"
- platform: numeric_state
entity_id: sensor.openweathermap_weather_code
below: "623"
above: "599"
- platform: numeric_state
entity_id: sensor.openweathermap_weather_code
above: "199"
below: "233"
condition:
- condition: or
conditions:
- type: is_open
condition: device
device_id: 4007aaf80558f2dc178af38628f91eae
entity_id: >-
binary_sensor.lumi_lumi_sensor_magnet_aq2_acd2e401_on_off_wohnzimmer_velux
domain: binary_sensor
- type: is_open
condition: device
device_id: d6973fa533a0b291b1cb6076b73ac15d
entity_id: >-
binary_sensor.lumi_lumi_sensor_magnet_aq2_acd2e401_on_off_badezimmer_velux
domain: binary_sensor
- type: is_on
condition: device
device_id: 077a9e6b98a31d479c6935299a36a046
entity_id: binary_sensor.lumi_lumi_magnet_acn001_ias_zone_arbeitszimmer_velux
domain: binary_sensor
- type: is_on
condition: device
device_id: b8e8313505500909ec28fd4b61846ddd
entity_id: >-
binary_sensor.lumi_lumi_magnet_acn001_ias_zone_kinderzimmer_fenster_rechts
domain: binary_sensor
- type: is_on
condition: device
device_id: 2a48532229dc793d52863a97c5b11600
entity_id: binary_sensor.lumi_lumi_magnet_acn001_ias_zone_kueche_fenster
domain: binary_sensor
- type: is_open
condition: device
device_id: 0873fc6935ae1cbfc34974738e296aee
entity_id: >-
binary_sensor.lumi_lumi_sensor_magnet_aq2_acd2e401_on_off_schlafzimmerfenster_links
domain: binary_sensor
action:
- if:
- condition: state
entity_id: binary_sensor.lumi_lumi_magnet_acn001_ias_zone_arbeitszimmer_velux
state: "on"
then:
- service: notify.signal_alert
data:
message: Schnee, Regen oder Sturm und Arbeitszimmerfenster offen
- if:
- condition: state
entity_id: >-
binary_sensor.lumi_lumi_sensor_magnet_aq2_acd2e401_on_off_badezimmer_velux
state: "on"
then:
- service: notify.signal_alert
data:
message: Schnee, Regen oder Sturm und Badezimmerfenster offen
- if:
- condition: state
entity_id: >-
binary_sensor.lumi_lumi_magnet_acn001_ias_zone_kinderzimmer_fenster_rechts
state: "on"
then:
- service: notify.signal_alert
data:
message: Schnee, Regen oder Sturm und Kinderzimmerfenster (rechts) offen
- if:
- condition: state
entity_id: binary_sensor.lumi_lumi_magnet_acn001_ias_zone_kueche_fenster
state: "on"
then:
- service: notify.signal_alert
data:
message: Schnee, Regen oder Sturm und Küchenfenster offen
- if:
- condition: state
entity_id: >-
binary_sensor.lumi_lumi_sensor_magnet_aq2_acd2e401_on_off_schlafzimmerfenster_links
state: "on"
then:
- service: notify.signal_alert
data:
message: Schnee, Regen oder Sturm und Schlafzimmerfenster (links) offen
- if:
- condition: state
entity_id: >-
binary_sensor.lumi_lumi_sensor_magnet_aq2_acd2e401_on_off_wohnzimmer_velux
state: "on"
then:
- service: notify.signal_alert
data:
message: Schnee, Regen oder Sturm und Wohnzimmerfenster (Velux) offen
mode: single
Not so elegant. But it also works Guess I will use the example of 123 taras, as this is more flexible and elegant.
123
(Taras)
January 19, 2023, 10:10pm
7
Let me know if my suggested example meets your requirements.