Is there any difference to the three triggers below, with how the elevation is accessed? As far as I can tell, all 3 are trying to access the elevation attribute, why is there three different ways to do this? Is there an advantage that any of them? Obviously the top one is the cleanest and more clear, but I don’t see other people access attributes like this in hardly any examples, is there a reason for that? And between the later two, is there any difference?
The way the UI accesses the elevation attribute (what ends up in the YAML if I access the elevation attribute in the UI for creating an automation):
trigger:
- platform: numeric_state
entity_id: sun.sun
attribute: elevation
below: -4.0
From the HA documentation:
trigger:
platform: numeric_state
entity_id: sun.sun
value_template: "{{ state_attr('sun.sun', 'elevation') }}"
below: -4.0
From this blog post of the person that apparently added this elevation functionality:
trigger:
platform: numeric_state
entity_id: sun.sun
value_template: "{{ state.attributes.elevation }}"
below: -4.0