romedtino / simple-wyze-vac

Home Assistant Custom Component for Wyze Vacuum
48 stars 8 forks source link

Query History? #60

Open ulek opened 1 year ago

ulek commented 1 year ago

Is there any way to query the run history of the vacuum? I would like to set up an automation that would vacuum my at least every three days. If the cleaning gets triggered within the HA but at I don't see a way to account for manually triggered cleanings through an app or otherwise.

Mr-HaleYa commented 1 year ago

@ulek you could keep track of cleaning like this

Create a counter helper named daysWithoutCleaning.

create an automation that fires when the vacuum state changes to cleaning and have that reset the daysWithoutCleaning to 0. This will fire when the vacuum is told to clean by the mobile app or home assistant

create an automation that runs every day at the time you want to clean ie. 3pm and set it up following this logic

if daysWithoutCleaning is >= 3
  start cleaning
else
  add increment daysWithoutCleaning

when 3pm comes around every day it will check if it has cleaned in the last 3 days, if it has it will skip, and if it hasn't it will clean and the other automation will run to reset the counter


if you want you could easily merge the two automation by setting triggered by IDs and choice conditions

ulek commented 1 year ago

@Mr-HaleYa

I think that doesn't really do what I want. I forgot to finish my thought in the first post

At the moment I pretty much do what you said by doing the following. I have a automation (call it A) that fires off the vacuum when no one is home for an hour. Another automation (call it B) checks at certain time when that automation A was triggered and if it is more than specified time (in my case 3 days) it triggers the automation A.

But sometimes the vacuum is manually triggered, i.e. made a bigger mess or before mopping the floor, so it would be nice if I could inhibit automation B (maybe even A) by polling the history.

Otherwise I think that I would have to set up services and automations that would poll vacuums quite often and then go from them to create and reset timers and or variables