Skip to content
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

Bump Roborock to 17.0 adding device specific support and bugfixes #92547

Merged
merged 20 commits into from
May 19, 2023

Conversation

Lash-L
Copy link
Contributor

@Lash-L Lash-L commented May 4, 2023

Breaking change

Proposed change

This reworks how we look at devices so that it is a one coordinator/api per device. Each device also now has specifications to describe its fan codes/ mop codes/ any device specific options. Limits the code that repeats here.

changelog: https://github.com/humbertogontijo/python-roborock/blob/main/CHANGELOG.md
Changes: humbertogontijo/python-roborock@v0.8.3...v0.17.0

Summary:

  • adds individual fan/mop codes for each device so we can sync up what functionalities each device has and the names will be accurate.
  • Fixes some timeout issues
  • Fixed prefixes being incorrect for some commands ( was only a problem for users manually sending commands through send command service)

note: conflicts with #92502 - but that is more of a hotfix and this is a solution for the new dependency change.

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 Black (black --fast 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.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

@home-assistant
Copy link

home-assistant bot commented May 4, 2023

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

Code owner commands

Code owners of roborock 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 roborock Removes the current integration label and assignees on the pull request, add the integration domain after the command.

@Lash-L Lash-L changed the title Bump Roborock to 11.0 adding device specific support Bump Roborock to 13.1 adding device specific support May 5, 2023
@Lash-L Lash-L changed the title Bump Roborock to 13.1 adding device specific support Bump Roborock to 13.4 adding device specific support May 7, 2023
@Lash-L Lash-L mentioned this pull request May 8, 2023
20 tasks
@Lash-L Lash-L changed the title Bump Roborock to 13.4 adding device specific support Bump Roborock to 14.1 adding device specific support May 9, 2023
@Lash-L Lash-L changed the title Bump Roborock to 14.1 adding device specific support Bump Roborock to 17.0 adding device specific support and bugfixes May 11, 2023
@Lash-L
Copy link
Contributor Author

Lash-L commented May 11, 2023

Hey @allenporter On the original PR you said you'd keep an eye out for Roborock PRs and review them if you had a chance, just wanted to make you aware of this one! If you don't have time, feel free to ignore this message and sorry for pinging!

I have people on discord/forums/ issues asking for a lot more features that I'm unable to implement until I get this in ( as it is a major change) and people bringing up things that will be fixed by this, so I figured I'd see if you had the time.

Thank you!

Copy link
Contributor

@allenporter allenporter left a comment

Choose a reason for hiding this comment

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

Great work @Lash-L 👍🏼 -- looks like a huge improvement overall (good code cleanup, good reliability improvement)

homeassistant/components/roborock/device.py Outdated Show resolved Hide resolved
homeassistant/components/roborock/__init__.py Outdated Show resolved Hide resolved
homeassistant/components/roborock/select.py Show resolved Hide resolved
@home-assistant home-assistant bot marked this pull request as draft May 13, 2023 16:00
@home-assistant
Copy link

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@Lash-L Lash-L marked this pull request as ready for review May 13, 2023 16:28
@home-assistant home-assistant bot requested a review from allenporter May 13, 2023 16:28
@Lash-L
Copy link
Contributor Author

Lash-L commented May 13, 2023

thanks for the feedback allen. One more thing I wanted to include with these changes but I couldn't figure out was translating the state_attribute for fan_speed. I have seen examples for climate, but as far as vacuum goes, I haven't seen anyone translate the fan speeds. I tried for a bit and tried a bunch of different things, but I am thinking maybe the state attributes for vacuums aren't supported for translation? It's not strictly needed, but I thought it would be a nice to have. Not a real hold up, was just curious if you had any idea.

@Lash-L Lash-L requested a review from allenporter May 16, 2023 21:40
Copy link
Contributor

@allenporter allenporter left a comment

Choose a reason for hiding this comment

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

One minor question, otherwise looks good.

await mqtt_client.async_disconnect()
except RoborockException as err:
_LOGGER.warning("Failed disconnecting from the mqtt server %s", err)
await asyncio.gather(
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this still catch RoborockException here and below or is that now handled by the empty map check?

Aside: While not required, these types of failure cases may be tricky enough that you'd want to add tests for them if they aren't there already.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's handled by the empty map check, as disconnects don't matter if they fail, but I should probably add a warning to let the user know(even though there isn't much they can do)

However, I'm on vacation and won't be back until Wednesday, so I wouldn't be able to test it, so I'm not sure if it is worth adding a log for now. But your call, I can do it when I get back.

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it, eturn_exceptions=True. OK, yes, disconnects don't matter here.

await mqtt_client.async_disconnect()
except RoborockException as err:
_LOGGER.warning("Failed disconnecting from the mqtt server %s", err)
await asyncio.gather(
Copy link
Contributor

Choose a reason for hiding this comment

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

Got it, eturn_exceptions=True. OK, yes, disconnects don't matter here.

@allenporter allenporter merged commit 0ce1117 into home-assistant:dev May 19, 2023
48 of 49 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators May 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.