Hi,
I am looking for some advice please as to how to refer to fields/attributes when used in Yaml eg for logging, comparison etc.
Its probably easiest to explain by example. The following works but my choice of trigger.event.data.command probably came from an obscure example.
alias: Z-Test UPB scene change
description: Z-Test UPB scene change
trigger:
- platform: event
event_type: upb.scene_changed
event_data:
command: deactivated
address: "5_7"
action:
- service: system_log.write
data:
level: debug
message: triggered -Z-Test UPB scene change cmd={{ trigger.event.data.command }} address={{ trigger.event.data.address }}
logger: jc_debug
mode: single
But this is not a generic structure because I cannot make the next one work.
alias: Z-Log states
description: ""
trigger:
- platform: state
entity_id:
- light.entry_light
condition: []
action:
- service: system_log.write
data:
level: debug
message: Z-Log states triggered address={{ trigger.state.state }}
logger: jc_debug
mode: single
In this case light.entry_light is a template based entity of type light.
‘trigger.state.state’ does not work, nor does trigger.state or state.state nor any number of other combinations.
I am tired of trying to guess these so am asking how the quilification works or where I can find the documentation of the overall structure.
Thanks
JC