Hello!
I’ve had a rule setup on my OH3 for many months now that starts my Xiaomi Vacuum robot at 16h everyday if it didn’t already clean that day. But since I upgraded from OH3.0.1 to OH3.0.2, it doesn’t work anymore and I don’t understand why.
My rule is pretty straightforward:
rule "Vacuum"
when
Time cron "0 0 16 ? * *"
then
logInfo("VacuumRule", "Periodic");
val startOfDay = LocalDate.now().atStartOfDay(ZoneOffset.systemDefault()).toEpochSecond();
val lastCleaning = DateTimeType.valueOf(vac_lastStart.state.toString).getZonedDateTime().toEpochSecond();
logInfo("VacuumRule", lastCleaning + " < " + startOfDay);
if (lastCleaning < startOfDay) {
logInfo("VacuumRule", "Go!");
sendCommand(vac_actionControl, "vacuum")
} else {
logInfo("VacuumRule", "No Go!");
}
end
If I look at my logs of today (all day the same) I see:
2021-04-25 16:00:00.192 [INFO ] [openhab.core.model.script.VacuumRule] - Periodic
2021-04-25 16:00:00.205 [INFO ] [openhab.core.model.script.VacuumRule] - 1619274377 < 1619301600
2021-04-25 16:00:00.206 [INFO ] [openhab.core.model.script.VacuumRule] - Go
And in the events:
2021-04-25 16:00:00.209 [INFO ] [openhab.event.ItemCommandEvent ] - Item 'vac_actionControl' received command vacuum
2021-04-25 16:00:00.210 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'vac_actionControl' predicted to become vacuum
2021-04-25 16:00:00.211 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'vac_actionControl' changed from dock to vacuum
2021-04-25 16:00:15.254 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'vac_actionControl' changed from vacuum to dock
For some reason, everytime the rule sends the vacuum command, it switches back to “dock” after 15s without having the robot starting at all.
When I re-run the rule manually, it seems to work first try
2021-04-25 17:04:47.316 [INFO ] [openhab.core.model.script.VacuumRule] - Periodic
2021-04-25 17:04:47.328 [INFO ] [openhab.core.model.script.VacuumRule] - 1619274377 < 1619301600
2021-04-25 17:04:47.329 [INFO ] [openhab.core.model.script.VacuumRule] - Go!
2021-04-25 17:04:47.331 [INFO ] [openhab.event.ItemCommandEvent ] - Item 'vac_actionControl' received command vacuum
2021-04-25 17:04:47.334 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'vac_actionControl' predicted to become vacuum
2021-04-25 17:04:47.337 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'vac_actionControl' changed from dock to vacuum
# After I press pause on the robot:
2021-04-25 17:05:22.694 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'vac_actionControl' changed from vacuum to dock
Any idea what might be the issue here?
Also, can I safely downgrade from 3.0.2 to 3.0.1 to try if it really is the update that broke everything down, or will it mess up something?
Thanks!