Skip to content

Conversation

@allenporter
Copy link
Contributor

Add a volume trait. The purpose is to have more trait use cases to figure out a better trait API.
This improves error response handling, found during adding the volume trait and making some mistakes.

This will have merge conflicts with #476 and will likely need another pass of review.

@allenporter allenporter changed the title feat: Add volume trait feat: add a volume trait Sep 14, 2025
@allenporter allenporter changed the title feat: add a volume trait feat: add a sound volume trait Sep 14, 2025
Lash-L
Lash-L previously approved these changes Sep 14, 2025
Comment on lines 23 to 25
response = await self._rpc_channel.send_command(RoborockCommand.GET_SOUND_VOLUME)
if isinstance(response, list) and response:
return int(response[0])
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is something we should definitely try to figure out in the future system. I don't think we should always have to check if it is a list, I think you said it is just because you changed the typing for send_command

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does the API always return a list? My impression was that it does not given some of the other code. If it does always return a list, then that's good to know.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I honestly can't remember. I think we may always wrap it in a list? We didn't have to do this explicit check before so I can't remember what we did

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this always returns a list with a number in it...

I had to take out the code that always pops the data structure out of the list for the clean summary https://github.com/Python-roborock/python-roborock/pull/476/files otherwise it only returns one number from the list.

Copy link
Contributor Author

@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.

I ended up rebasing and merging, then adding a test with the json for the sound response just to get that source of truth checked in.

Lash-L
Lash-L previously approved these changes Sep 15, 2025
@allenporter
Copy link
Contributor Author

Fixed lint errors, need one more approval, sorry about that.

@allenporter allenporter merged commit a391c17 into Python-roborock:main Sep 15, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants