Reading a single attribute from attribute "list"

I am stuck reading an attribute from a sensor. It is an Aqara vibration sensor which also senses the orientation of the sensor. It has a “list” of attributes for it’s orientation, namely xyz coordinates (I guess :smiley: ).
This is what the developer tools tell me for the sensor’s attributes:

'on': true
temperature: 7
orientation:
  - 5
  - -76
  - 13
tiltangle: 7
vibrationstrength: 5
friendly_name: Vibrationssensor
device_class: vibration

How do I get one of the numbers isolated from the three values under orientation?
I want to use this sensor as an open/close sensor for my garage door, which changes y and z coordinate when closing.

2 Likes

Try this in the developer tools template editor:

{{ state_attr('sensor.vibrationssensor', 'orientation')[0] }}
{{ state_attr('sensor.vibrationssensor', 'orientation')[1] }}
{{ state_attr('sensor.vibrationssensor', 'orientation')[2] }}

Awesome, it works!
Now I just need to need to figure out my automation :wink:

Thanks a lot!