dolphin-robot icon indicating copy to clipboard operation
dolphin-robot copied to clipboard

Remove "Turn On" when robot is idle

Open sh00t2kill opened this issue 1 year ago • 6 comments

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.

sh00t2kill avatar Jun 30 '24 01:06 sh00t2kill

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:

  1. run tests in indicators_test.py
  2. run manual test of all state transition by HA

last thing, as result of that change there will be functions that will not get called, so they should be cleaned as well

elad-bar avatar Jun 30 '24 05:06 elad-bar

adding list of code lines related to pws_state_off: image

elad-bar avatar Jun 30 '24 05:06 elad-bar

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.

sh00t2kill avatar Jun 30 '24 05:06 sh00t2kill

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.

elad-bar avatar Jul 02 '24 06:07 elad-bar

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!

sh00t2kill avatar Jul 02 '24 06:07 sh00t2kill

Will try to get to it this weekend and take this branch and add the additional items i wrote

elad-bar avatar Jul 02 '24 08:07 elad-bar