SvenVJ
(Sven)
March 14, 2024, 8:52am
1
Hello there,
I am quite new to HA, so forgive me my possible stupid question. I have an Automation with multiple conditions which works as it should. But at the end of the Automation I want to send a telegram message which contains the condition alias that was triggered. How can I reference it?
Thank you very much!
Sven
tom_l
March 14, 2024, 9:59am
2
Conditions don’t trigger, triggers do. Conditions pass or fail, after a trigger has occurred.
Please share your automation correctly formatted for the forum .
SvenVJ
(Sven)
March 14, 2024, 11:59am
3
Oh sorry, I meant that I want to notify, which Condition was met/passed.
Here is my “code”:
alias: Licht Wohnzimmer
description: ""
trigger:
- platform: state
entity_id:
- binary_sensor.wohnzimmer_prasenz_anwesenheit
- type: power
platform: device
device_id: ae3c029c24c9f25c227a7ddeedf940dd
entity_id: 53e8e753ee839a1cca70da44c27aca8e
domain: sensor
enabled: true
above: 0
condition: []
action:
- choose:
- conditions:
- type: is_present
condition: device
device_id: badc477ea8dc1e58bf117de3ae133a73
entity_id: 671c9490447955f3ed598d5dba22de4f
domain: binary_sensor
- type: is_power
condition: device
device_id: ae3c029c24c9f25c227a7ddeedf940dd
entity_id: 53e8e753ee839a1cca70da44c27aca8e
domain: sensor
below: 10
- type: is_illuminance
condition: device
device_id: badc477ea8dc1e58bf117de3ae133a73
entity_id: 38f55ca8509453491a26e70927343aa6
domain: sensor
below: 12
sequence:
- type: turn_on
device_id: c13ebd6489a895a5ccf38f4c434d36f5
entity_id: c023b235c5e334b19457fe466ed52074
domain: light
brightness_pct: 90
- type: turn_on
device_id: 34ade1b9f028b7f19ac7518a6d6226b7
entity_id: 7a80e3b6a8a3a8d6f9f1abb814409dc0
domain: light
brightness_pct: 90
- type: turn_on
device_id: c88e8db9579212e5e0bbdff44c17e4b7
entity_id: fdf4da6b9aa6531a47bd297a9e47c00a
domain: light
alias: Goldene Wand an_Dunkel genug_TV aus
- conditions:
- type: is_present
condition: device
device_id: badc477ea8dc1e58bf117de3ae133a73
entity_id: 671c9490447955f3ed598d5dba22de4f
domain: binary_sensor
- type: is_power
condition: device
device_id: ae3c029c24c9f25c227a7ddeedf940dd
entity_id: 53e8e753ee839a1cca70da44c27aca8e
domain: sensor
above: 10
- type: is_illuminance
condition: device
device_id: badc477ea8dc1e58bf117de3ae133a73
entity_id: 38f55ca8509453491a26e70927343aa6
domain: sensor
below: 12
sequence:
- type: turn_off
device_id: c13ebd6489a895a5ccf38f4c434d36f5
entity_id: c023b235c5e334b19457fe466ed52074
domain: light
- type: turn_off
device_id: 34ade1b9f028b7f19ac7518a6d6226b7
entity_id: 7a80e3b6a8a3a8d6f9f1abb814409dc0
domain: light
- type: turn_on
device_id: c88e8db9579212e5e0bbdff44c17e4b7
entity_id: fdf4da6b9aa6531a47bd297a9e47c00a
domain: light
- type: turn_on
device_id: 3f689ac01793957ddf35c66766efef69
entity_id: e65106a2bb97608f40671f794d482f37
domain: light
- type: turn_on
device_id: d7bdbc4c168bee00050a3173c928786f
entity_id: 26c6ecadaf6ccc7bb8a535cbe9c5c8b5
domain: light
alias: TV an_dunkel genug_ Wand an
- conditions:
- type: is_not_present
condition: device
device_id: badc477ea8dc1e58bf117de3ae133a73
entity_id: 671c9490447955f3ed598d5dba22de4f
domain: binary_sensor
for:
hours: 0
minutes: 5
seconds: 0
- type: is_power
condition: device
device_id: ae3c029c24c9f25c227a7ddeedf940dd
entity_id: 53e8e753ee839a1cca70da44c27aca8e
domain: sensor
below: 10
sequence:
- type: turn_off
device_id: c13ebd6489a895a5ccf38f4c434d36f5
entity_id: c023b235c5e334b19457fe466ed52074
domain: light
- type: turn_off
device_id: 34ade1b9f028b7f19ac7518a6d6226b7
entity_id: 7a80e3b6a8a3a8d6f9f1abb814409dc0
domain: light
- type: turn_off
device_id: c88e8db9579212e5e0bbdff44c17e4b7
entity_id: fdf4da6b9aa6531a47bd297a9e47c00a
domain: light
- type: turn_off
device_id: 3f689ac01793957ddf35c66766efef69
entity_id: e65106a2bb97608f40671f794d482f37
domain: light
- type: turn_off
device_id: d7bdbc4c168bee00050a3173c928786f
entity_id: 26c6ecadaf6ccc7bb8a535cbe9c5c8b5
domain: light
alias: Präsenz niemand mehr da, alles aus
- service: telegram_bot.send_message
data:
message: Test
enabled: false
mode: single
set a trigger id for each like this:
alias: Licht Wohnzimmer
description: ""
trigger:
- platform: state
entity_id:
- binary_sensor.wohnzimmer_prasenz_anwesenheit
id: first_trigger
- device_id: ""
domain: ""
entity_id: ""
platform: device
id: device_trigger
then send it like this:
- service: telegram_bot.send_message
data:
message: {{ trigger.id }}
enabled: false