Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions roborock/devices/traits/b01/q7/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,19 @@ async def set_clean_path_preference(self, preference: CleanPathPreferenceMapping
async def set_repeat_state(self, repeat: CleanRepeatMapping) -> None:
"""Set the cleaning repeat state (cycles)."""
await self.set_prop(RoborockB01Props.REPEAT_STATE, repeat.code)

async def get_battery_level(self) -> int | None:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is this the same quantity we get back from the main get props?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes it is. I don't quite understand why but this corresponds to the current battery level at least on my vacuum.

Copy link
Copy Markdown
Collaborator

@Lash-L Lash-L Mar 17, 2026

Choose a reason for hiding this comment

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

Then we should actually be able to avoid adding this function at all and just grab the quantity property on the home assistant side I think? Does that seem to align with your understanding? Assuming you are adding this functionality for HA

"""Get the battery level (%)"""
level_query = await self.send(
command=RoborockB01Q7Methods.GET_PROP,
params={
"property": ["quantity"]
}
)
try:
return level_query['quantity']
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

what else is in the response dict?

except:
return None

async def start_clean(self) -> None:
"""Start cleaning."""
Expand Down
Loading