How much time has passed since you cleaned the room

Hello! I need help with my code. I need to know how many hours ago a particular room was cleaned. Cleaning the room is done using a script, so it’s about the last triggered attribute. I’ve made a template but it gives a weird result that I don’t know how to set as a trigger. I thought I’d be able to run the automation based on the status of the entity after 48 hours, for example. My code below.

{{ now() - state_attr('script.sprzatanie_lazienki_na_gorze', 'last_triggered') }}

The code produces the result “1 day, 0:01:47.631858”.
The result is absolutely correct, although the ending itself is incomprehensible to me.
And how such a result can be a trigger.

I’d appreciate your suggestions.

trigger:
  - platform: template
    value_template: |
      {{ now() - state_attr('script.sprzatanie_lazienki_na_gorze', 'last_triggered') 
      > timedelta(hours=48)}}

1 Like

Everything works. Thanks