Skip to content

Fix operational state and vacuum state for matter vacuum #147466

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 25, 2025

Conversation

ocrease
Copy link
Contributor

@ocrease ocrease commented Jun 24, 2025

Proposed change

Fixing the issue described in #145884. There are three main fixes:

  • The Operational State sensor was always looking for the OperationalState cluster (0x60), but vacuums use RvcOperationalState (0x61) which mean that the state for this sensor was always Unknown. The attribute to use is now configurable in the Entity Descriptor. I also split the mapping from code to translation key so that the correct mappings are used.
  • The vacuum entity defines an OperationalState enum, but the first 4 values were coming from the ErrorState enum rather than the OperationalState enum. This meant that the state of the vacuum would change to Error whenever it was not docked. Now it shows the correct state.
  • Updated the async_pause command to use the RvcOperationalState cluster. Previously it would result in the InteractionModelError: UnsupportedCluster (0xc3)

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.

To help with the load of incoming pull requests:

@ocrease ocrease requested a review from a team as a code owner June 24, 2025 22:28
@MartinHjelmare MartinHjelmare changed the title fixing operational state and vacuum state for matter vacuum Fix operational state and vacuum state for matter vacuum Jun 25, 2025
@ocrease ocrease marked this pull request as draft June 25, 2025 06:23
@ocrease
Copy link
Contributor Author

ocrease commented Jun 25, 2025

Fixed test that was failing

@ocrease ocrease marked this pull request as ready for review June 25, 2025 07:57
@home-assistant
Copy link

Hey there @home-assistant/matter, mind taking a look at this pull request as it has been labeled with an integration (matter) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of matter can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign matter Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.

@marcelveldt
Copy link
Member

Nice work! I finally got myself a (working) matter vacuum cleaner so I was planning to look at this myself but you've beaten me to it. Highly appreciated!

I will quickly test the PR and then lets focus on getting it merged asap.

@marcelveldt
Copy link
Member

Found one more small bug which caused the state to not be automaticically updated, corrected it.
Otherwise working great.

Copy link
Member

@marcelveldt marcelveldt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work @ocrease !

@marcelveldt
Copy link
Member

This PR fixes at least the state reporting but seems that starting the vacuum is still not always working. E.g. it works for a Matter 1.3 vacuum but doesn't for a 1.2 vacuum - needs more thought but can be fixed in another PR

@marcelveldt marcelveldt merged commit 977e8ad into home-assistant:dev Jun 25, 2025
34 checks passed
@ocrease
Copy link
Contributor Author

ocrease commented Jun 25, 2025

Found one more small bug which caused the state to not be automaticically updated, corrected it. Otherwise working great.

Ah great. I wondered why the main vacuum state didn't update immediately. Works much better now!

This PR fixes at least the state reporting but seems that starting the vacuum is still not always working. E.g. it works for a Matter 1.3 vacuum but doesn't for a 1.2 vacuum - needs more thought but can be fixed in another PR

I'm using a Eufy E25 which is matter 1.3 and start cleaning doesn't work for me. Pausing and resuming once the vacuum is running does work. I wanted to keep this PR focused on the state reporting. Maybe one needs to send a command on the RvcRunMode cluster instead? I haven't had a chance to investigate. Either way, it will need to be a new PR

@marcelveldt
Copy link
Member

Yeah, I'm working on it now - I'll prepare a PR within an hour or so with a fix.
Trouble is that some parts of the spec have been changed and we need to keep it backwards compatible.

For example the Matter 1.2 vacuums out there (e.g. Switchbot) do not have the OperationalState cluster while the 1.3 vacuums do.

Anyways, I'll sort something out.

Thanks for your efforts in fixing the state!

@ocrease
Copy link
Contributor Author

ocrease commented Jun 25, 2025

Once you have a PR I'm happy to review and/or try it out.

I also thought about adding error information from the (Rvc)OperationalState cluster, but wasn't sure if it should be a separate sensor or an extra attribute of the operational_state sensor. If you think it's worthwhile and you would like me to attempt to implement it, then let me know which option would be preferable and I can raise a PR

pelicarno pushed a commit to OlarmTech/home-assistant-core that referenced this pull request Jun 26, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Jun 26, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Matter - Roborock Robotic Vacuum Cleaner - State - (S8 MaxV Ultra)
3 participants