While I had this same template with now() working to before, it suddenly stopped, after editing it. cant find the error though, must have a black spot…
Yes, these are operators. You can’t add or subtract types that arn’t handled. Simple as that. Always been like this. You just have gotten lucky that those values have always been populated.
Also, attributes on the state objects are NOT equivalent to attributes in the attribute section. You’re messing that up as well seeing as you are trying to compare last_changed to attributes.last_triggered.
I know i’ve said this before but you REALLY need to take basic python tutorials. You keep bum rushing your code and you continually run into these basic issues. (when i say basic, i’m talking basic for the level you should be at with the amount of work you put into this stuff, I wouldn’t expect beginners to consider this basic).
No, I am aware of that, was simply trying to give another example of the use of the now() template.
Lol, never heard of that before either … will look that up too
so, one more question then before I take that extra class: if I wouldn’t use state_atrr() but states.entity_id.attributes.last_triggered, would that go?
As a matter of fact it was designed like that…to be populated after getting called, and stays like that during runtime of course. I havent run into operational issues. I only noticed just now, because of some change in the logic of my setup… So you’re right.
Well, it looks like that one is a datetime object. Not sure why they are different. Anyways, if you see a T in your return or it is multiplied by 2 as in you see the date twice, it’s a string. You can also just check the type
{{ state_attr('automation.boiler_switch','last_triggered') is string }}