Open sh00t2kill opened 3 months ago
hi, sorry for all comments below :)
there are 16 places in code that relaying on off state that you changed in calculated state, in addition, the idle (new state) should have more impact than just sensor state, it should allow or not, whether you can move to another state (clean mode, pickup, etc...), to make sure it works perfectly you will need to:
last thing, as result of that change there will be functions that will not get called, so they should be cleaned as well
adding list of code lines related to pws_state_off:
I did a bunch of manual testing, it worked as expected.
A lot of the spots you highlighted are the tests themselves, or the actual state of the base station.
if the mapping of actions (ACTION_ENTITY_TURN_ON, ACTION_ENTITY_TURN_OFF) in coordinator was removed, the corresponding action should be removed (_vacuum_turn_on, _vacuum_turn_off).
in case the vacuum doesn't support turn on/off, it will not support toggle, therefore mapping ACTION_ENTITY_TOGGLE should be removed with its function _vacuum_toggle.
the problem that might get created and relevant not for ui but for the aws reporting status is CONSIDERED_POWER_STATE, up until now, PWS_STATE_OFF and PWS_STATE_ERROR reported it off, if you are removing the off state, the aws status reporting needs to use another variable or that variable should be set by something else with the fact whether the robot should be treated as on/off.
not sure whether you tested it with logs in debug mode to see how things are working and whether all state changes are working - set as one mode, change to another, pause, resume, double resume, double pause, pickup when running, when idle.
I didn't test everything, but I tested the main functions and everything seemed as expected.
I left those functions in just in case something else is using them.
Unfortunately I'm away on holiday for the next 4 weeks so feel free to reject this and work on it, but at least I found the cause of why turn on appears!
Will try to get to it this weekend and take this branch and add the additional items i wrote
The integration automatically sets the state of the vacuum to off when its not actively cleaning and it is unable to calculate another state.
When HA sees a state of off, it automatically adds a TURN ON button, instead of START CLEANING. Changing the default state to idle addresses this.