Last_updated State and last-changed in Lovelave

There’s ways you can get around that too, just takes more code than the methods.

{% if states.light.living_room is defined %}
1 Like


Im new to HA, is there any way to show the last update subtitle if in my config, I use yaml mode?

  mode: yaml

Some cards allow you to display it via the an attribute. You gotta look through the cards configuration options and see if last-updated is an option for any of the fields. For example, the entities card has this ability.

Thank you for your reply.

That secondary_info is available in yaml mode? I tested in customized.yaml and it seems doesnt work.

My config is here:

configuration.yaml is the main file, it loads groups.yaml is the one I have for the UI.
it reads the sensors state from customize.yaml

I have no idea where to put secondary_info in.

it needs to be placed in the configuration for the card. This can be done in yaml mode or not. It goes in ui-lovelace.yaml.

Are you familiar with how the docs work? They essentially tell you where to place the information.

Yes I do, now I have to remove my groups.yaml, then creating new ui-lovelace.yaml to use this

Groups has nothing to do with lovelace, nor do they do anything with the interface. The used to do things with the interface back in 2018. Since then, they’ve been completely separate.

It seems that there is a bug when parsing sensor name:
Test with template in Developer Tool
{{ states.binary_sensor.0x00158d000273bbe4_contact.last_updated }}

Got this:

Error rendering template: TemplateSyntaxError: expected token 'end of print statement', got 'x00158d000273bbe4_contact'

Right, now I am converting groups.yaml, customize.yaml into new ui-lovelace.yaml and get rid of those old style.

Thats because your object_id starts with a number, which is a no-no. To access it…

{{ states.binary_sensor['0x00158d000273bbe4_contact'].last_updated }}

Thank you so much!

I got Unknown error when trying to convert timezone,

         {{ as_timestamp( states.binary_sensor['0x00158d000273bbe4_contact'].last_updated + '+06:00') | timestamp_custom('%a %b %-d %-I:%M%p')}}

Unknown error rendering template


This printed a UTC date time, but converting like above having error.

last updated is a datetime object. You can’t add a string to it.

{{ as_timestamp( states.binary_sensor['0x00158d000273bbe4_contact'].last_updated) | timestamp_custom('%a %b %-d %-I:%M%p', False)}}


I’m looking for to show the last changed of the sensor, but the “timestamp_custom” doesn’t work. This is my conf :

{{ states.binary_sensor.porte_entree.last_changed | timestamp_custom('%H %M',False) }}

The result :

2019-11-20 08:57:18.122862+00:00

The custom format isn’t apply (I just want 08:57), and, the local time isn’t correct, because I need to add 1 hour in more ( either 2019-11-20 09:57:18.122862+00:00 and when I try with the timestamp_local the time is incorrect ).

Do you have some idea why ?

I found a solution, I’m not sure is the good solution :

{{ as_timestamp(states.binary_sensor.porte_entree.last_changed) | timestamp_custom('%H %M',True)  }}

It is, if you look at the template I posted 14 days ago, you’ll notice that it uses as_timestamp()

This post was flagged by the community and is temporarily hidden.

This post was flagged by the community and is temporarily hidden.

This post was flagged by the community and is temporarily hidden.