Showing diiferent attributes on UI

Hi, so I just imported some devices from VERA. In some cases, like my motion detectors I want to show the last trip time on the UI without having to click around. I’d prefer to show it in “time since” (e.g. 5 minutes ago), but would take even showing the raw datetime.

I found this link

but I’m not convinced this is the simplest way. Any tips are appreciated.

I have a similar situation with my Nest thermostat. I want to show “Away-Mode” from my lake house nest thermostat on the main GUI page. I do it by creating a template sensor, based on the nest thermostat data like this:

  - platform: template
    sensors:
      lake_house_away:
        value_template: '{{ states.climate.lake_house.attributes.away_mode }}'
        friendly_name: 'Lake House Away Mode' 

Now, assuming the last_tripped time is an attribute on your particular sensor

sensor:
  - platform: template
      sensors:
        detector1_tripped:
            value_template: '{{ states.sensors.detector1.attributes.last_tripped }}'

If instead you to show the elapsed time (in seconds) you would do it like this:
sensor:
- platform: template
sensors:
detector1_tripped:
value_template: {{as_timestamp(now()) - as_timestamp(states.sensors.detector1.attributes.last_tripped)}}

Finally, if your sensor doesn’t export a last_tripped attribute, you can always use the last update state like this:

{{as_timestamp(now()) - as_timestamp(states.sensors.detector1.last_updated)}}

Learn to use the templates developer tool in home assistant. It is your friend.