Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ required-imports = ["from __future__ import annotations"]
"D104", # Missing docstring in public package
"N802", # Function name {name} should be lowercase
"N816", # Variable {name} in global scope should not be mixedCase
"PLR0913", # Too many arguments in function definition
"S101", # Use of assert detected
"SLF001", # Private member accessed: {access}
"T201", # print found
Expand All @@ -154,7 +153,7 @@ required-imports = ["from __future__ import annotations"]
max-complexity = 13

[tool.ruff.lint.pylint]
max-args = 7
max-args = 10

[tool.mypy]
files = ["./src", "./tests"]
Expand Down
7 changes: 7 additions & 0 deletions src/saic_ismart_client_ng/api/vehicle/alarm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
)
from saic_ismart_client_ng.crypto_utils import sha256_hex_digest

__all__ = [
"AlarmSwitch",
"AlarmSwitchReq",
"AlarmSwitchResp",
"AlarmType",
]


class SaicVehicleAlarmApi(SaicVehicleApi):
async def get_alarm_switch(self, vin: str) -> AlarmSwitchResp:
Expand Down
18 changes: 8 additions & 10 deletions src/saic_ismart_client_ng/api/vehicle/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,14 @@ class BasicVehicleStatus:
vehicleAlarmStatus: int | None = None
wheelTyreMonitorStatus: int | None = None

@property
def is_parked(self) -> bool:
return self.engineStatus != 1 or self.handBrake == 1

@property
def is_engine_running(self) -> bool:
return self.engineStatus == 1


@dataclass
class ExtendedVehicleStatus:
Expand All @@ -124,16 +132,6 @@ class VehicleStatusResp:
gpsPosition: GpsPosition | None = None
statusTime: int | None = None

@property
def is_parked(self) -> bool:
return (v := self.basicVehicleStatus) is not None and (
v.engineStatus != 1 or v.handBrake == 1
)

@property
def is_engine_running(self) -> bool:
return (v := self.basicVehicleStatus) is not None and v.engineStatus == 1


class RvcParamsId(Enum):
FIND_MY_CAR_ENABLE = 1
Expand Down
Empty file.