DTM450
September 12, 2023, 5:51am
1
I’m trying to get this Automation to detect what triggered the light on.
I have read through these threads:
I have an automation, which is triggered when any of two sensors changes his state.
In the action-part I want to distinguish between the triggering sensor has no value (empty string) or has some value (string).
To avoid some nested and / or conditions I want to use the trigger.entity_id:
action:
- if:
- condition: template
value_template: "{{ is_state('trigger.entity_id ', '') }}"
then:
But this doesn’t work! Then automation executes always the else-path, even when the va…
Hi,
seems I’m to stupid to understand how to work with trigger.id
An example stub:
- id: 'someone_awake' ## awake
mode: queued
alias: 'People - someone - awake'
initial_state: 'on'
trigger:
- platform: state
entity_id: sensor.whatever_click
to: 'double'
id: 'person1'
- platform: state
entity_id: sensor.whatever_click2
to: 'double'
id: 'person2'
condition:
- condition: template
value_template: "{{ i…
You do. All automation triggers change the context.
What you need to do is store the context when the switch turns on. You need to check all three contexts as per the table:
[Screenshot 2022-06-21 081430]
Then use that when your no-motion automation runs.
e.g. this triggered template sensor will save the switch context when it turns on:
(configuration.yaml)
template:
- trigger:
- platform: state
entity_id: switch.shelly_1pm_garage_switch_0
to: "on"
sensor:
- na…
and some of the documentation but I’m missing something.
This is what I want to achieve:
What I have currently
alias: Wiz Light Trigger
description: Check what triggered the light on
trigger:
- platform: state
entity_id:
- light.wiz_rgbw_tunable_de5c9e
to: "on"
condition:
- condition: template
value_template: "{{ trigger.to_state.context.user_id == none }}"
- condition: template
value_template: "{{ trigger.to_state.context.parent_id == none }}"
- condition: template
value_template: "{{ trigger.to_state.context.id != none }}"
action:
- service: scene.turn_on
target:
entity_id: scene.rgb_1_lux_2
metadata: {}
mode: restart
Edit:
So this works but it looks like Wiz bulbs are slow to report state changes to HA.
petwri
(Petwri)
January 2, 2024, 7:29am
2
So when you say the problem was the entities being too slow in reporting the status change, how did you end up solving this? Afaik, a delay won’t work in a trigger condition.