Hi there!
I am trying to do an automation for the vacuum that triggers when no one is home but only works if the latest cleaning was more than 1 day ago. For that I am using a template condition that compares the last cleaning time to the present. This renders True in the development tools but fails the condition in the automation. I don’t understand what is happening. Can anyone point me in the right direction? Thank you!
Here is the automation as yaml but I configured in the UI.
- id: '1637149994764'
alias: Aspirador cuando no hay nadie en casa
description: ''
trigger:
- platform: state
entity_id: group.home
to: not_home
condition:
- condition: template
value_template: '''{{ (as_timestamp(now()) - as_timestamp(states(''sensor.robot_aspirador_last_clean_end''))
| int > 86400)}}'''
action:
- service: vacuum.start
target:
entity_id: vacuum.robot_aspirador