I integrated my Roborock into Home Assistant. My automation should start when I leave home and last cleaning was ended at least 3 hours ago.
I have a sensor called “sensor.roborock_last_clean_end” which returns a datetime(?). How can I use this to check if its value is older than 3 hours? I want to use this as a condition to not clean my home every hour (if I leave my home every hour )
It’s working in the template editor. It returns true or false. This is only for testing purposes I think? But which type of condition do I add now to my automation and how to call this snippet?
If you use the Visual Automation Editor to compose your automations, just select “Template” in the Conditions section and paste the suggested template.
That’s because there’s a known problem with the ‘Test’ button; it doesn’t evaluate templates correctly. Until it’s fixed, avoid using it and rely on the Template Editor to validate a template.
What should the code look like if I want to know how many hours have passed? The above code works very well for true false. I can’t calculate the number of hours since the last cleaning.