How to get last_updated and last_changed from api back into HA?

I noticed that the HA api gives last_updated and last_changed to the device trackers but I can’t find away to find those values in HA. I will need to write a python script to access HA api and return those values to a HA command line sensor. Is there a better way to get these values into HA for automation / frontend?

Do you mean like this?

Exactly, thank you.

Is there a way to turn a WARNING into a notification?
I just realized some of my automations were not working and I looked at “INFO” and found:
2017-09-02 18:16:53 WARNING (MainThread) [homeassistant.components.sensor] Updating scrape sensor took longer than the scheduled update interval 0:00:clock1030:
This happens regularly with the Scrape Sensor. Is there a way to turn this into a notification?

Spent an hour to conclude that this Jinja2 style check
‘{{(as_timestamp(now())-as_timestamp(states.sensor.target_temp_stue.last_updated)) > 900}}’
is impossible to make in python_scripts because hass object is super sandboxed:

  1. can not get last_updated attribute, actually get does not work at all
  2. as_timestamp als no available from utils package

After debug of python_scripts in HA I can glue the wallpaper through the keyhole. :slight_smile: