When using Automation trigger variables the data in the this
state object for an automation with a state
trigger is as follows:
{
'entity_id': 'automation.my_automation',
'state': 'on',
'attributes': {
'id': 'my_automation',
'last_triggered': datetime.datetime(2024, 2, 17, 10, 41, 27, 507745, tzinfo=datetime.timezone.utc),
'mode': 'queued',
'current': 0,
'max': 50,
'friendly_name': 'My Automation'
},
'last_changed': '2024-02-17T08:56:11.505558+00:00',
'last_updated': '2024-02-17T10:41:28.521367+00:00',
'context': {
'id': '01HPVAG7XYMW9HW9X',
'parent_id':
'01HPVAG7LBRTQRGVR',
'user_id': None
}
}
There seems to be no way to make any use of this data in a template because the last_triggered
item does not get past the intepreter.
(To see what I mean, simply copy and past it into the template dev tools and try to assign it to a variable).
'last_triggered': datetime.datetime(2024, 2, 17, 10, 41, 27, 507745, tzinfo=datetime.timezone.utc)
What does the datetime.datetime
do/mean?
And why is it presented this way in the first place?
The last_changed
and last_updated
are standard date time format.
Ok, so yes, this post has shameless cross over with this one, but now I think it is more than just me not understanding how to use it (but of course I am happy to be shown I’m wrong).