Get attribute form entity


I’m using a picture card as a floor plan to show the state of entities such as lights etc. The following is a snip from the code:

type: picture-elements
  - type: state-badge
    entity: light.living_room
      top: 80%
      left: 70%

I would like to show the temperature from one of the sensors but I can’t find the appropriate syntax to do so.

The following is from the dev tools> states (mill integration), and I’m interested in displaying current_temperature:

  - heat
  - 'off'
min_temp: 5
max_temp: 35
target_temp_step: 1
  - 'on'
  - 'off'
current_temperature: 21
temperature: 16
fan_mode: 'off'
hvac_action: idle
open_window: null
heating: 0
controlled_by_tibber: 1
heater_generation: 2
room: Kontor
avg_room_temp: 22
friendly_name: Kontor
supported_features: 9


Use a template sensor:

1 Like

Try {{state_attr('ENTITY_ID', 'current_temperature') }} as your template.

1 Like

Thanks to @Danielhiversen and @brg468. You guys are genius’s. Never used templates before, so this was new to me. Following documentation and threads helped:
How to display template sensor attributes in HA home page?

The final solution ended up like this and could then be referenced like: sensor.office_temperature:

- platform: template
      entity_id: climate.kontor
      friendly_name: "Office temperature"
      unit_of_measurement: 'degrees'
      value_template: "{{state_attr('climate.kontor', 'current_temperature') }}"
1 Like