Hi.
i am trying to use the following code to select an Arlo camera that has had it’s object detected sensor updated in the last 5 minutes. This will later be used for a custom entity as part of a larger automation.
My issue is that the aarlo API returns the date time in the following format
13-12 11:00
In the above example it would be 13th December 11:00am
Here is the partial code I am using to select the sensors that are active.
{% set time = now() - timedelta(minutes = 5) %}
{{ states.sensor
| rejectattr('attributes.brand', 'undefined')
| rejectattr('attributes.object_type', 'undefined')
| selectattr('attributes.brand', 'eq', 'Netgear Arlo')
| selectattr('state', '<', time)
| list
| count
}}
This throws an error because the state is returned as a string.
I was hoping to use something like this code to convert, but I don’t know how to use this in combination of the above code.
{{ strptime(states.sensor.aarlo_last_zone_1_floodlight_1.state, '%m - %d %-H : %M')}}