Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 105817

States working but state_attr not

$
0
0

Hi all,

I want to get a state attribute based on a variable (for example hard coded) with the entity_id.

              {{ state_attr('switch.shellyplug_1', 'last_changed') }}
              {{ states.switch.shellyplug_1.last_changed }}

The states function return the value, but state_attr not. I’m I doing something wrong?

UPDATE:

Okay I’ve read last_changed is a property and not an attribute. What is the difference between states and state_attr - #6 by tom_l

How can I use a variable in this line then?

{{ states.switch.shellyplug_1.last_changed }}

5 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 105817

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>