Get last updated time of sensor

I want to find the last updated value of my temperature sensor, but for some reason it does not seem to work.

When i use the below yaml as action:

service: notify.mobile_app_telefoon_niels
data:
  message: test {{ states.sensor.0x00158d0006e3c641_temperature.last_updated }}

I get:

Message malformed: template value should be a string for dictionary value @ data['action'][0]['data']

This is the sensor:
image

Try this:

message: test {{ states.sensor['0x00158d0006e3c641_temperature'].last_updated }}
3 Likes