Hello,
I am currently working on a Roborock integration that can expose the date of the last cleaning as a timestamp.
The goal is then to be able to build a scene of the type:
When the house becomes empty
→ retrieve the last cleaning of the robot
→ continue only if no cleaning has been done today
→ start cleaning
The integration can easily expose:
Last clean start = 1786958400
The problem is that at the scene engine level, it does not seem possible to simply compare this value with a relative date such as:
beginning of today
today
now
yesterday
X hours ago
A condition like this would be particularly useful:
Last clean < beginning of today
or, more ergonomically:
Last clean
→ is not today
The idea would therefore be to add generic support for dates/timestamps in scene conditions.
timestamp < now
timestamp > startOfDay
timestamp > now - 24h
timestamp isToday
timestamp isYesterday
This could eventually go through scene variables/formulas, for example by exposing values or functions like:
now()
today()
startOfDay()
endOfDay()
The need is not specific to Roborock. This would also allow working with:
- date of the last movement;
- last opening of a door;
- last startup of a device;
- last recharge;
- last event from an integration;
- any device exposing a timestamp.
In my specific case, this would avoid adding a feature cleaned_today in the Roborock integration, while the generic information last_clean_start is normally sufficient.
Would this be something that could fit in the scene engine?