Attribute ID

Hi,

I’m having difficulty displaying a sensor attribute in a custom button card. The sensor is as follows:

and i’d like to return the attribute ‘warnings - title’ or short_title

my code is as follows:

type: custom:button-card
name: Warnings go here
show_name: false
color: red
color_type: card
show_label: true
show_icon: false
entity: sensor.aldgate_warnings


label: >
  [[[  return states['sensor.aldgate_warnings'].attributes.warnings; ]]]


Any help much appreciated!

Since it’s the first item in the list warnings you would use the index for that position [0] followed by the ID of the sub-attribute:

 [[[  return states['sensor.aldgate_warnings'].attributes.warnings[0].title; ]]]
1 Like

Thanks so much! worked perfectly