I am trying to calculate the number of minutes since the state of a switch has been changed. First of all, I calulate the delta like this
{% set delta= (now()-states.switch.lights_kitchen.last_changed) %}
That seems to give me a datetime with the difference. But now I like to know hoe many minutes this is. So I tried this:
{{ delta.strftime("%M")| int(0) }}
That gives me an error saying ‘datetime.timedelta object’ has no attribute ‘strftime’. So it seems that the resulting opbject is not a datetime but a timedelta object. I can’t find how to deal with that.