Skip to content

Commit cd97ddb

Browse files
authored
Merge branch 'main' into l01_new_format
2 parents c7d8069 + fe82fb1 commit cd97ddb

File tree

20 files changed

+519
-242
lines changed

20 files changed

+519
-242
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ updates:
66
schedule:
77
interval: "weekly"
88

9-
- package-ecosystem: "pip"
9+
- package-ecosystem: "uv"
1010
directory: "/"
1111
schedule:
1212
interval: "weekly"

.github/workflows/ci.yml

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,56 @@ jobs:
4949
- name: Test with Pytest
5050
run: uv run pytest --log-cli-level=DEBUG -vv -s
5151
shell: bash
52+
53+
build:
54+
name: Build Package
55+
runs-on: ubuntu-latest
56+
if: github.ref != 'refs/heads/main'
57+
steps:
58+
- uses: actions/checkout@v5
59+
- name: Set up uv
60+
uses: astral-sh/setup-uv@v7
61+
with:
62+
python-version: "3.11"
63+
activate-environment: true
64+
- name: Build package
65+
run: uv build
66+
67+
# Test semantic-release configuration on PR branches
68+
test-release:
69+
name: Test Semantic Release
70+
runs-on: ubuntu-latest
71+
if: github.event_name == 'pull_request'
72+
steps:
73+
- uses: actions/checkout@v5
74+
with:
75+
fetch-depth: 0
76+
- name: Setup Git for Semantic Release Testing
77+
run: |
78+
# Setup a temp branch to test
79+
git checkout -B temp-main-branch
80+
git merge ${{ github.event.pull_request.head.sha }} --no-edit
81+
git config user.name "GitHub Actions"
82+
git config user.email "actions@github.com"
83+
- name: Test Semantic Release (No-op)
84+
id: test-release
85+
uses: python-semantic-release/python-semantic-release@v10.4.1
86+
with:
87+
github_token: ${{ secrets.GITHUB_TOKEN }}
88+
changelog: true
89+
# Use noop mode to test without making changes
90+
no_operation_mode: true
91+
- name: Test Semantic Release (Dry Run)
92+
id: test-release-dry
93+
uses: python-semantic-release/python-semantic-release@v10.4.1
94+
with:
95+
github_token: ${{ secrets.GITHUB_TOKEN }}
96+
changelog: true
97+
# Use dry run mode to test without committing
98+
commit: false
99+
tag: false
100+
push: false
101+
vcs_release: false
52102
release:
53103
runs-on: ubuntu-latest
54104
needs:
@@ -79,10 +129,13 @@ jobs:
79129

80130
- name: Publish package distributions to PyPI
81131
uses: pypa/gh-action-pypi-publish@v1.13.0
82-
83132
# NOTE: DO NOT wrap the conditional in ${{ }} as it will always evaluate to true.
84133
# See https://github.com/actions/runner/issues/1173
85134
if: steps.release.outputs.released == 'true'
135+
with:
136+
packages-dir: dist
137+
print-hash: true
138+
verbose: true
86139

87140
- name: Publish package distributions to GitHub Releases
88141
uses: python-semantic-release/publish-action@v10.4.1

.pre-commit-config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,9 @@ repos:
3939
- id: mypy
4040
exclude: cli.py
4141
additional_dependencies: [ "types-paho-mqtt" ]
42+
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
43+
rev: v9.23.0
44+
hooks:
45+
- id: commitlint
46+
stages: [commit-msg]
47+
additional_dependencies: ['@commitlint/config-conventional']

CHANGELOG.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,93 @@
22

33
<!-- version list -->
44

5+
## v3.1.2 (2025-10-25)
6+
7+
### Bug Fixes
8+
9+
- Move semantic release build command
10+
([`8ed178d`](https://github.com/Python-roborock/python-roborock/commit/8ed178d9f75245bde3ffcebbf8ef18e171ba563d))
11+
12+
13+
## v3.1.1 (2025-10-25)
14+
15+
### Bug Fixes
16+
17+
- Explicitly pip install uv in release
18+
([`4409ee9`](https://github.com/Python-roborock/python-roborock/commit/4409ee90694e9b3389342692f30fbf3706f2f00c))
19+
20+
### Chores
21+
22+
- Add pre commit step for commitlint
23+
([#563](https://github.com/Python-roborock/python-roborock/pull/563),
24+
[`14c811f`](https://github.com/Python-roborock/python-roborock/commit/14c811f30f0bb1f574be59e759aecab5ca61cd65))
25+
26+
27+
## v3.1.0 (2025-10-25)
28+
29+
### Bug Fixes
30+
31+
- Fix enum names to include `none` states
32+
([#561](https://github.com/Python-roborock/python-roborock/pull/561),
33+
[`82f6dc2`](https://github.com/Python-roborock/python-roborock/commit/82f6dc29d55fd4f8565312af3cf60abf8abba56c))
34+
35+
### Chores
36+
37+
- Add a temp main branch for testing
38+
([#562](https://github.com/Python-roborock/python-roborock/pull/562),
39+
[`7592255`](https://github.com/Python-roborock/python-roborock/commit/75922550bad8f5fc4ece1f2f4a6be74ebb3849c2))
40+
41+
- Build system to make sure it doesn't break
42+
([#562](https://github.com/Python-roborock/python-roborock/pull/562),
43+
[`7592255`](https://github.com/Python-roborock/python-roborock/commit/75922550bad8f5fc4ece1f2f4a6be74ebb3849c2))
44+
45+
- Fix branches ([#562](https://github.com/Python-roborock/python-roborock/pull/562),
46+
[`7592255`](https://github.com/Python-roborock/python-roborock/commit/75922550bad8f5fc4ece1f2f4a6be74ebb3849c2))
47+
48+
- Fix changelog ([#552](https://github.com/Python-roborock/python-roborock/pull/552),
49+
[`e2073ed`](https://github.com/Python-roborock/python-roborock/commit/e2073edc655c1a91caae5f05e1377aebfad2938e))
50+
51+
- Fix test release ([#562](https://github.com/Python-roborock/python-roborock/pull/562),
52+
[`7592255`](https://github.com/Python-roborock/python-roborock/commit/75922550bad8f5fc4ece1f2f4a6be74ebb3849c2))
53+
54+
- Get uv release to work properly
55+
([#562](https://github.com/Python-roborock/python-roborock/pull/562),
56+
[`7592255`](https://github.com/Python-roborock/python-roborock/commit/75922550bad8f5fc4ece1f2f4a6be74ebb3849c2))
57+
58+
- Switch dependabot from pip to uv
59+
([#554](https://github.com/Python-roborock/python-roborock/pull/554),
60+
[`9377e9a`](https://github.com/Python-roborock/python-roborock/commit/9377e9ac305f45339b022b5ef8f0c16b58732300))
61+
62+
- Try running a test release on every PR
63+
([#562](https://github.com/Python-roborock/python-roborock/pull/562),
64+
[`7592255`](https://github.com/Python-roborock/python-roborock/commit/75922550bad8f5fc4ece1f2f4a6be74ebb3849c2))
65+
66+
- Update snapshot ([#555](https://github.com/Python-roborock/python-roborock/pull/555),
67+
[`b45ad3c`](https://github.com/Python-roborock/python-roborock/commit/b45ad3c487b21639a1f2ba148fe69836b11024c4))
68+
69+
- Update spelling from co-pilot suggestion
70+
([#555](https://github.com/Python-roborock/python-roborock/pull/555),
71+
[`b45ad3c`](https://github.com/Python-roborock/python-roborock/commit/b45ad3c487b21639a1f2ba148fe69836b11024c4))
72+
73+
- Update test assertion for network info
74+
([#558](https://github.com/Python-roborock/python-roborock/pull/558),
75+
[`b34abde`](https://github.com/Python-roborock/python-roborock/commit/b34abde2e3401c463e7fb821bae1cf20a325ec6d))
76+
77+
- **deps**: Bump ruff from 0.14.0 to 0.14.1
78+
([#553](https://github.com/Python-roborock/python-roborock/pull/553),
79+
[`df438f7`](https://github.com/Python-roborock/python-roborock/commit/df438f7a293fb0c1f1b3cfaf3691eafaa8a3fd8b))
80+
81+
### Features
82+
83+
- Add a trait for reading NetworkInfo from the device
84+
([#558](https://github.com/Python-roborock/python-roborock/pull/558),
85+
[`b34abde`](https://github.com/Python-roborock/python-roborock/commit/b34abde2e3401c463e7fb821bae1cf20a325ec6d))
86+
87+
- Combine the clean record trait with the clean summary
88+
([#555](https://github.com/Python-roborock/python-roborock/pull/555),
89+
[`b45ad3c`](https://github.com/Python-roborock/python-roborock/commit/b45ad3c487b21639a1f2ba148fe69836b11024c4))
90+
91+
592
## v3.0.0 (2025-10-20)
693

794
### Features

pyproject.toml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "python-roborock"
3-
version = "3.0.0"
3+
version = "3.1.2"
44
description = "A package to control Roborock vacuums."
55
authors = [{ name = "humbertogontijo", email = "humbertogontijo@users.noreply.github.com" }, {name="Lash-L"}, {name="allenporter"}]
66
requires-python = ">=3.11, <4"
@@ -69,15 +69,18 @@ build-backend = "hatchling.build"
6969
[tool.semantic_release]
7070
branch = "main"
7171
version_toml = ["pyproject.toml:project.version"]
72-
build_command = """
73-
python -m pip install -e '.[build]'
74-
uv lock --upgrade-package "$PACKAGE_NAME"
75-
git add uv.lock
76-
uv build
77-
"""
72+
build_command = "pip install uv && uv lock --upgrade-package python-roborock && git add uv.lock && uv build"
7873
changelog_file = 'CHANGELOG.md'
7974
commit = true
8075

76+
[tool.semantic_release.branches.main]
77+
match = "main"
78+
prerelease = false
79+
80+
[tool.semantic_release.branches.temp-main-branch]
81+
match = "temp-main-branch"
82+
prerelease = false
83+
8184

8285
[tool.semantic_release.commit_parser_options]
8386
allowed_tags = [

roborock/cli.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,16 @@ async def home(ctx, device_id: str, refresh: bool):
731731
click.echo("No maps discovered")
732732

733733

734+
@session.command()
735+
@click.option("--device_id", required=True)
736+
@click.pass_context
737+
@async_command
738+
async def network_info(ctx, device_id: str):
739+
"""Get device network information."""
740+
context: RoborockContext = ctx.obj
741+
await _display_v1_trait(context, device_id, lambda v1: v1.network_info)
742+
743+
734744
@click.command()
735745
@click.option("--device_id", required=True)
736746
@click.option("--cmd", required=True)
@@ -979,6 +989,7 @@ def write_markdown_table(product_features: dict[str, dict[str, any]], all_featur
979989
cli.add_command(dnd)
980990
cli.add_command(flow_led_status)
981991
cli.add_command(led_status)
992+
cli.add_command(network_info)
982993

983994

984995
def main():

roborock/data/v1/v1_containers.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,15 @@ def square_meter_clean_area(self) -> float | None:
156156

157157
@property
158158
def error_code_name(self) -> str | None:
159-
return self.error_code.name if self.error_code else None
159+
return self.error_code.name if self.error_code is not None else None
160160

161161
@property
162162
def state_name(self) -> str | None:
163-
return self.state.name if self.state else None
163+
return self.state.name if self.state is not None else None
164164

165165
@property
166166
def water_box_mode_name(self) -> str | None:
167-
return self.water_box_mode.name if self.water_box_mode else None
167+
return self.water_box_mode.name if self.water_box_mode is not None else None
168168

169169
@property
170170
def fan_power_options(self) -> list[str]:
@@ -174,11 +174,11 @@ def fan_power_options(self) -> list[str]:
174174

175175
@property
176176
def fan_power_name(self) -> str | None:
177-
return self.fan_power.name if self.fan_power else None
177+
return self.fan_power.name if self.fan_power is not None else None
178178

179179
@property
180180
def mop_mode_name(self) -> str | None:
181-
return self.mop_mode.name if self.mop_mode else None
181+
return self.mop_mode.name if self.mop_mode is not None else None
182182

183183
def get_fan_speed_code(self, fan_speed: str) -> int:
184184
if self.fan_power is None:
@@ -449,6 +449,12 @@ def __repr__(self) -> str:
449449
return _attr_repr(self)
450450

451451

452+
class CleanSummaryWithDetail(CleanSummary):
453+
"""CleanSummary with the last CleanRecord included."""
454+
455+
last_clean_record: CleanRecord | None = None
456+
457+
452458
@dataclass
453459
class Consumable(RoborockBase):
454460
main_brush_work_time: int | None = None

roborock/devices/device_manager.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ def device_creator(home_data: HomeData, device: HomeDataDevice, product: HomeDat
157157
case DeviceVersion.V1:
158158
channel = create_v1_channel(user_data, mqtt_params, mqtt_session, device, cache)
159159
trait = v1.create(
160+
device.duid,
160161
product,
161162
home_data,
162163
channel.rpc_channel,

roborock/devices/traits/v1/__init__.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
from roborock.map.map_parser import MapParserConfig
4343

4444
from .child_lock import ChildLockTrait
45-
from .clean_record import CleanRecordTrait
4645
from .clean_summary import CleanSummaryTrait
4746
from .command import CommandTrait
4847
from .common import V1TraitMixin
@@ -55,6 +54,7 @@
5554
from .led_status import LedStatusTrait
5655
from .map_content import MapContentTrait
5756
from .maps import MapsTrait
57+
from .network_info import NetworkInfoTrait
5858
from .rooms import RoomsTrait
5959
from .smart_wash_params import SmartWashParamsTrait
6060
from .status import StatusTrait
@@ -70,7 +70,6 @@
7070
"StatusTrait",
7171
"DoNotDisturbTrait",
7272
"CleanSummaryTrait",
73-
"CleanRecordTrait",
7473
"SoundVolumeTrait",
7574
"MapsTrait",
7675
"MapContentTrait",
@@ -85,6 +84,7 @@
8584
"DustCollectionModeTrait",
8685
"WashTowelModeTrait",
8786
"SmartWashParamsTrait",
87+
"NetworkInfoTrait",
8888
]
8989

9090

@@ -100,14 +100,14 @@ class PropertiesApi(Trait):
100100
command: CommandTrait
101101
dnd: DoNotDisturbTrait
102102
clean_summary: CleanSummaryTrait
103-
clean_record: CleanRecordTrait
104103
sound_volume: SoundVolumeTrait
105104
rooms: RoomsTrait
106105
maps: MapsTrait
107106
map_content: MapContentTrait
108107
consumables: ConsumableTrait
109108
home: HomeTrait
110109
device_features: DeviceFeaturesTrait
110+
network_info: NetworkInfoTrait
111111

112112
# Optional features that may not be supported on all devices
113113
child_lock: ChildLockTrait | None = None
@@ -120,6 +120,7 @@ class PropertiesApi(Trait):
120120

121121
def __init__(
122122
self,
123+
device_uid: str,
123124
product: HomeDataProduct,
124125
home_data: HomeData,
125126
rpc_channel: V1RpcChannel,
@@ -129,20 +130,20 @@ def __init__(
129130
map_parser_config: MapParserConfig | None = None,
130131
) -> None:
131132
"""Initialize the V1TraitProps."""
133+
self._device_uid = device_uid
132134
self._rpc_channel = rpc_channel
133135
self._mqtt_rpc_channel = mqtt_rpc_channel
134136
self._map_rpc_channel = map_rpc_channel
135137
self._cache = cache
136138

137139
self.status = StatusTrait(product)
138-
self.clean_summary = CleanSummaryTrait()
139-
self.clean_record = CleanRecordTrait(self.clean_summary)
140140
self.consumables = ConsumableTrait()
141141
self.rooms = RoomsTrait(home_data)
142142
self.maps = MapsTrait(self.status)
143143
self.map_content = MapContentTrait(map_parser_config)
144144
self.home = HomeTrait(self.status, self.maps, self.rooms, cache)
145145
self.device_features = DeviceFeaturesTrait(product.product_nickname, cache)
146+
self.network_info = NetworkInfoTrait(device_uid, cache)
146147

147148
# Dynamically create any traits that need to be populated
148149
for item in fields(self):
@@ -248,6 +249,7 @@ async def _set_cached_trait_data(self, name: str, value: Any) -> None:
248249

249250

250251
def create(
252+
device_uid: str,
251253
product: HomeDataProduct,
252254
home_data: HomeData,
253255
rpc_channel: V1RpcChannel,
@@ -257,4 +259,13 @@ def create(
257259
map_parser_config: MapParserConfig | None = None,
258260
) -> PropertiesApi:
259261
"""Create traits for V1 devices."""
260-
return PropertiesApi(product, home_data, rpc_channel, mqtt_rpc_channel, map_rpc_channel, cache, map_parser_config)
262+
return PropertiesApi(
263+
device_uid,
264+
product,
265+
home_data,
266+
rpc_channel,
267+
mqtt_rpc_channel,
268+
map_rpc_channel,
269+
cache,
270+
map_parser_config,
271+
)

0 commit comments

Comments
 (0)