Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
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
12 changes: 5 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
- name: Set up uv
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python-version }}
- uses: snok/install-poetry@v1.4.1
- name: Install Dependencies
run: poetry install
shell: bash
activate-environment: true
- run: uv pip install pip
- name: Test with Pytest
run: poetry run pytest --log-cli-level=DEBUG -vv -s
run: uv run pytest --log-cli-level=DEBUG -vv -s
shell: bash
release:
runs-on: ubuntu-latest
Expand Down
11 changes: 6 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
exclude: "CHANGELOG.md"
default_stages: [ commit ]
default_stages: [ pre-commit ]

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand All @@ -17,16 +17,17 @@ repos:
- id: detect-private-key
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/python-poetry/poetry
rev: 1.7.1
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.9.1
hooks:
- id: poetry-check
- id: uv-sync
args: ["--locked", "--all-packages"]
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.1.8
rev: v0.13.2
hooks:
- id: ruff-format
- id: ruff
Expand Down
1,780 changes: 0 additions & 1,780 deletions poetry.lock

This file was deleted.

91 changes: 52 additions & 39 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,62 +1,75 @@
[tool.poetry]
[project]
name = "python-roborock"
version = "2.54.0"
description = "A package to control Roborock vacuums."
authors = ["humbertogontijo <humbertogontijo@users.noreply.github.com>"]
license = "GPL-3.0-only"
authors = [{ name = "humbertogontijo", email = "humbertogontijo@users.noreply.github.com" }, {name="Lash-L"}, {name="allenporter"}]
requires-python = ">=3.11, <4"
readme = "README.md"
repository = "https://github.com/humbertogontijo/python-roborock"
documentation = "https://python-roborock.readthedocs.io/"
license = "GPL-3.0-only"
keywords = [
"roborock",
"vacuum",
"homeassistant",
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Natural Language :: English",
"Operating System :: OS Independent",
"Topic :: Software Development :: Libraries",
]
packages = [{include = "roborock"}]
keywords = ["roborock", "vacuum", "homeassistant"]
dependencies = [
"click>=8",
"aiohttp>=3.8.2,<4",
"async-timeout",
"pycryptodome~=3.18",
"pycryptodomex~=3.18 ; sys_platform == 'darwin'",
"paho-mqtt>=1.6.1,<3.0.0",
"construct>=2.10.57,<3",
"vacuum-map-parser-roborock",
"pyrate-limiter>=3.7.0,<4",
"aiomqtt>=2.3.2,<3",
"click-shell~=2.1",
]

[project.urls]
Repository = "https://github.com/humbertogontijo/python-roborock"
Documentation = "https://python-roborock.readthedocs.io/"

[tool.poetry.scripts]
[project.scripts]
roborock = "roborock.cli:main"

[tool.poetry.dependencies]
python = "^3.11"
click = ">=8"
aiohttp = "^3.8.2"
async-timeout = "*"
pycryptodome = "^3.18"
pycryptodomex = {version = "^3.18", markers = "sys_platform == 'darwin'"}
paho-mqtt = ">=1.6.1,<3.0.0"
construct = "^2.10.57"
vacuum-map-parser-roborock = "*"
pyrate-limiter = "^3.7.0"
aiomqtt = "^2.3.2"
click-shell = "^2.1"
[dependency-groups]
dev = [
"pytest-asyncio>=1.1.0",
"pytest",
"pre-commit>=3.5,<5.0",
"mypy",
"ruff==0.13.2",
"codespell",
"pyshark>=0.6,<0.7",
"aioresponses>=0.7.7,<0.8",
"freezegun>=1.5.1,<2",
"pytest-timeout>=2.3.1,<3",
"syrupy>=4.9.1,<5",
"pdoc>=15.0.4,<16",
]

[tool.hatch.build.targets.sdist]
include = ["roborock"]

[build-system]
requires = ["poetry-core==1.8.0"]
build-backend = "poetry.core.masonry.api"
[tool.hatch.build.targets.wheel]
include = ["roborock"]

[tool.poetry.group.dev.dependencies]
pytest-asyncio = ">=1.1.0"
pytest = "*"
pre-commit = ">=3.5,<5.0"
mypy = "*"
ruff = "*"
codespell = "*"
pyshark = "^0.6"
aioresponses = "^0.7.7"
freezegun = "^1.5.1"
pytest-timeout = "^2.3.1"
syrupy = "^4.9.1"
pdoc = "^15.0.4"
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.semantic_release]
branch = "main"
version_toml = ["pyproject.toml:tool.poetry.version"]
build_command = "pip install poetry && poetry build"

[tool.semantic_release.commit_parser_options]
allowed_tags = [
"chore",
Expand All @@ -68,9 +81,9 @@ allowed_tags = [
major_tags= ["refactor"]

[tool.ruff]
ignore = ["F403", "E741"]
lint.ignore = ["F403", "E741"]
line-length = 120
select=["E", "F", "UP", "I"]
lint.select=["E", "F", "UP", "I"]

[tool.ruff.lint.per-file-ignores]
"*/__init__.py" = ["F401"]
Expand Down
5 changes: 2 additions & 3 deletions roborock/containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import re
import types
from dataclasses import asdict, dataclass, field
from datetime import timezone
from enum import Enum
from functools import cached_property
from typing import Any, NamedTuple, get_args, get_origin
Expand Down Expand Up @@ -717,11 +716,11 @@ def square_meter_area(self) -> float | None:

@property
def begin_datetime(self) -> datetime.datetime | None:
return datetime.datetime.fromtimestamp(self.begin).astimezone(timezone.utc) if self.begin else None
return datetime.datetime.fromtimestamp(self.begin).astimezone(datetime.UTC) if self.begin else None

@property
def end_datetime(self) -> datetime.datetime | None:
return datetime.datetime.fromtimestamp(self.end).astimezone(timezone.utc) if self.end else None
return datetime.datetime.fromtimestamp(self.end).astimezone(datetime.UTC) if self.end else None

def __repr__(self) -> str:
return _attr_repr(self)
Expand Down
6 changes: 3 additions & 3 deletions roborock/devices/v1_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
This module provides a unified channel interface for V1 protocol devices,
handling both MQTT and local connections with automatic fallback.
"""

import asyncio
import datetime
import logging
Expand Down Expand Up @@ -182,7 +183,7 @@ async def _get_networking_info(self, *, use_cache: bool = True) -> NetworkInfo:
except RoborockException as e:
raise RoborockException(f"Network info failed for device {self._device_uid}") from e
_LOGGER.debug("Network info for device %s: %s", self._device_uid, network_info)
self._last_network_info_refresh = datetime.datetime.now(datetime.timezone.utc)
self._last_network_info_refresh = datetime.datetime.now(datetime.UTC)
cache_data.network_info[self._device_uid] = network_info
await self._cache.set(cache_data)
return network_info
Expand Down Expand Up @@ -252,8 +253,7 @@ def _should_use_cache(self, local_connect_failures: int) -> bool:
if local_connect_failures == 1:
return False
elif self._last_network_info_refresh and (
datetime.datetime.now(datetime.timezone.utc) - self._last_network_info_refresh
> NETWORK_INFO_REFRESH_INTERVAL
datetime.datetime.now(datetime.UTC) - self._last_network_info_refresh > NETWORK_INFO_REFRESH_INTERVAL
):
return False
return True
Expand Down
2 changes: 1 addition & 1 deletion roborock/protocols/v1_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def decode_rpc_response(message: RoborockMessage) -> ResponseMessage:
elif result != "ok":
exc = RoborockException(f"Unexpected API Result: {result}")
result = {}
if not isinstance(result, (dict, list, int)):
if not isinstance(result, dict | list | int):
raise RoborockException(
f"Invalid V1 message format: 'result' was unexpected type {type(result)}. {message.payload!r}"
)
Expand Down
Loading
Loading