Skip to content

Commit

Permalink
add extra translations
Browse files Browse the repository at this point in the history
  • Loading branch information
mikey0000 committed Oct 30, 2024
1 parent 067ae58 commit e428d8c
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pymammotion/aliyun/cloud_gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ def send_cloud_command(self, iot_id: str, command: bytes) -> str:
def devices_by_account_response(self):
return self._devices_by_account_response

def set_http(self, mammotion_http) -> None:
def set_http(self, mammotion_http: MammotionHTTP) -> None:
self.mammotion_http = mammotion_http

@property
Expand Down
2 changes: 2 additions & 0 deletions pymammotion/data/model/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from pymammotion.data.model.location import Location
from pymammotion.data.model.report_info import ReportData
from pymammotion.data.mqtt.properties import ThingPropertiesMessage
from pymammotion.http.model.http import ErrorInfo
from pymammotion.proto.dev_net import DevNet
from pymammotion.proto.luba_msg import LubaMsg
from pymammotion.proto.luba_mul import SocMul
Expand Down Expand Up @@ -45,6 +46,7 @@ class MowingDevice(DataClassORJSONMixin):
err_code_list_time: Optional[list] = field(default_factory=list)
limits: DeviceLimits = field(default_factory=DeviceLimits)
device: Optional[LubaMsg] = field(default_factory=LubaMsg)
error_codes: dict[str, ErrorInfo] = field(default_factory=dict)

@classmethod
def from_raw(cls, raw: dict) -> "MowingDevice":
Expand Down
3 changes: 2 additions & 1 deletion pymammotion/http/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def __init__(self, response: Response) -> None:
self._headers = dict()
self.login_info = LoginResponseData.from_dict(response.data) if response.data else None
self._headers["Authorization"] = f"Bearer {self.login_info.access_token}" if response.data else None
self.response = response
self.msg = response.msg
self.code = response.code

Expand Down Expand Up @@ -74,7 +75,7 @@ async def login(cls, session: ClientSession, username: str, password: str) -> Re
),
) as resp:
data = await resp.json()
response = Response.from_dict(data)
response = Response[LoginResponseData].from_dict(data)
# TODO catch errors from mismatch user / password elsewhere
# Assuming the data format matches the expected structure
return response
Expand Down
20 changes: 19 additions & 1 deletion pymammotion/http/model/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


@dataclass
class ErrorInfo:
class ErrorInfo(DataClassDictMixin):
code: str
platform: str
module: str
Expand Down Expand Up @@ -44,6 +44,24 @@ class ErrorInfo:
sl_solution: str
pt_implication: str
pt_solution: str
hu_implication: str
hu_solution: str
hr_implication: str
hr_solution: str
no_implication: str
no_solution: str
fi_implication: str
fi_solution: str
ro_implication: str
ro_solution: str
bg_implication: str
bg_solution: str
et_implication: str
et_solution: str
lv_implication: str
lv_solution: str
lt_implication: str
lt_solution: str


@dataclass
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[project]
name = "pymammotion"
version = "0.2.95"
version = "0.2.97"

[tool.poetry]
name = "pymammotion"
version = "0.2.95"
version = "0.2.97"
license = "GNU-3.0"
description = ""
readme = "README.md"
Expand Down Expand Up @@ -61,7 +61,7 @@ mypy = "^1.11.2"
autotyping = "^24.3.0"

[tool.bumpver]
current_version = "0.2.95"
current_version = "0.2.97"
version_pattern = "MAJOR.MINOR.PATCH"
commit_message = "Bump version {old_version} -> {new_version}"
commit = true
Expand Down

0 comments on commit e428d8c

Please sign in to comment.