core: The vacuum doesn't update some sensors during cleaning

The problem

The vacuum roborock.vacuum.s5 doesn’t update the sensor.*_last_clean_area and sensor.*_last_clean_duration during cleaning, only after returned to the dock. May be some sensors such is cleaned_area and cleaning_time is missing.

What version of Home Assistant Core has the issue?

core-2021.11.1

What was the last working version of Home Assistant Core?

core-2021.10.*

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

Xiaomi miio

Link to integration documentation on our website

https://www.home-assistant.io/integrations/xiaomi_miio/

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 10
  • Comments: 18 (8 by maintainers)

Most upvoted comments

For some unknown reason, it seems the attributes cleaning_time and cleaned_area are no longer updated while the vacuum is working and only when a “job” is done (which is not the way it used to work before, as this would allow to know the actual job progress area and time-wise). These were actually migrated as integration sensors ‘Last Clean Duration’ and ‘Last Clean Area’, so not sure if this is a bug or a feature.

If it is a feature, it would be useful if we could get these attributes back or have 2 new separate integration sensors containing this “runtime” information.

Thanks in advance.

If we keep the 2 mentioned sensors, I would say option 2 is better, actually. If not, it could lead to other confusion. Where the last start time is representing the last start time in history, while the cleaning duration and area both represent the current cleaning cycle 🤔

So having 2 new sensors names current_cleaning_* would clearly indicate the diff. Where one is about the current cycle and the other is one of the last cycle known in history.

Cool, PR is ready for 👀

I see. Then it makes no sense to try to optimize that right now, so I agree that we should go with option 2. This will also allow use cases like creating a template sensor for “% cleaned” based on the previous run 😃

Hmm, good catch! Maybe it makes sense to revert the behavior here, as it will also reduce the number of required I/O requests by 2 per update cycle (1st request done internally by python-miio to find the most recent cleanup, and 2nd to obtain its details)? The only downside I’m seeing is that this will put some more info to the state machine, but that’s also how it was earlier so I think it’s a non-issue.

@OGKevin feel free to add yourself to the CODEOWNERS file, so you’ll get automatically pinged on issues 😃

So it looks like the coordinator is updating the data, but not informing the sensors to update their state. @OGKevin any ideas?