mirror of
https://github.com/Andre0512/pyhOn.git
synced 2025-03-08 06:09:41 +00:00
Merge branch 'main' of https://github.com/VadymMelnychuk/pyhOn
# Conflicts: # pyhon/appliances/wh.py
This commit is contained in:
commit
73fe98032b
2
.github/workflows/python-check.yml
vendored
2
.github/workflows/python-check.yml
vendored
|
@ -13,7 +13,7 @@ jobs:
|
|||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
python-version: ["3.10", "3.11"]
|
||||
python-version: ["3.10", "3.11", "3.12"]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
|
|
@ -94,15 +94,15 @@ class HonAppliance:
|
|||
|
||||
@property
|
||||
def appliance_model_id(self) -> str:
|
||||
return self._info.get("applianceModelId", "")
|
||||
return str(self._info.get("applianceModelId", ""))
|
||||
|
||||
@property
|
||||
def appliance_type(self) -> str:
|
||||
return self._info.get("applianceTypeName", "")
|
||||
return str(self._info.get("applianceTypeName", ""))
|
||||
|
||||
@property
|
||||
def mac_address(self) -> str:
|
||||
return self.info.get("macAddress", "")
|
||||
return str(self.info.get("macAddress", ""))
|
||||
|
||||
@property
|
||||
def unique_id(self) -> str:
|
||||
|
@ -138,11 +138,11 @@ class HonAppliance:
|
|||
|
||||
@property
|
||||
def model_id(self) -> int:
|
||||
return self._info.get("applianceModelId", 0)
|
||||
return int(self._info.get("applianceModelId", 0))
|
||||
|
||||
@property
|
||||
def options(self) -> Dict[str, Any]:
|
||||
return self._appliance_model.get("options", {})
|
||||
return dict(self._appliance_model.get("options", {}))
|
||||
|
||||
@property
|
||||
def commands(self) -> Dict[str, HonCommand]:
|
||||
|
|
|
@ -7,10 +7,10 @@ class Appliance(ApplianceBase):
|
|||
def attributes(self, data: Dict[str, Any]) -> Dict[str, Any]:
|
||||
data = super().attributes(data)
|
||||
if data.get("lastConnEvent", {}).get("category", "") == "DISCONNECTED":
|
||||
data["parameters"]["temp"].value = "0"
|
||||
data["parameters"]["onOffStatus"].value = "0"
|
||||
data["parameters"]["remoteCtrValid"].value = "0"
|
||||
data["parameters"]["remainingTimeMM"].value = "0"
|
||||
data["parameters"]["temp"].value = 0
|
||||
data["parameters"]["onOffStatus"].value = 0
|
||||
data["parameters"]["remoteCtrValid"].value = 0
|
||||
data["parameters"]["remainingTimeMM"].value = 0
|
||||
|
||||
data["active"] = data["parameters"]["onOffStatus"] == "1"
|
||||
data["active"] = data["parameters"]["onOffStatus"].value == 1
|
||||
return data
|
||||
|
|
|
@ -7,7 +7,7 @@ from pyhon.parameter.base import HonParameter
|
|||
class Appliance(ApplianceBase):
|
||||
def attributes(self, data: Dict[str, Any]) -> Dict[str, Any]:
|
||||
data = super().attributes(data)
|
||||
parameter = data["parameters"]["onOffStatus"]
|
||||
parameter = data.get("parameters", {}).get("onOffStatus")
|
||||
is_class = isinstance(parameter, HonParameter)
|
||||
data["active"] = parameter.value == 1 if is_class else parameter == 1
|
||||
return data
|
||||
|
|
|
@ -144,7 +144,11 @@ class HonCommand:
|
|||
self.appliance.sync_command_to_params(self.name)
|
||||
try:
|
||||
result = await self.api.send_command(
|
||||
self._appliance, self._name, params, ancillary_params
|
||||
self._appliance,
|
||||
self._name,
|
||||
params,
|
||||
ancillary_params,
|
||||
self._category_name,
|
||||
)
|
||||
if not result:
|
||||
_LOGGER.error(result)
|
||||
|
|
|
@ -190,6 +190,7 @@ class HonAPI:
|
|||
command: str,
|
||||
parameters: Dict[str, Any],
|
||||
ancillary_parameters: Dict[str, Any],
|
||||
program_name: str = "",
|
||||
) -> bool:
|
||||
now: str = datetime.utcnow().isoformat()
|
||||
data: Dict[str, Any] = {
|
||||
|
@ -208,6 +209,8 @@ class HonAPI:
|
|||
"parameters": parameters,
|
||||
"applianceType": appliance.appliance_type,
|
||||
}
|
||||
if command == "startProgram" and program_name:
|
||||
data.update({"programName": program_name.upper()})
|
||||
url: str = f"{const.API_URL}/commands/v1/send"
|
||||
async with self._hon.post(url, json=data) as response:
|
||||
json_data: Dict[str, Any] = await response.json()
|
||||
|
@ -319,6 +322,12 @@ class TestAPI(HonAPI):
|
|||
command: str,
|
||||
parameters: Dict[str, Any],
|
||||
ancillary_parameters: Dict[str, Any],
|
||||
program_name: str = "",
|
||||
) -> bool:
|
||||
_LOGGER.info("%s - %s", str(parameters), str(ancillary_parameters))
|
||||
_LOGGER.info(
|
||||
"%s - %s - %s",
|
||||
str(parameters),
|
||||
str(ancillary_parameters),
|
||||
str(program_name),
|
||||
)
|
||||
return True
|
||||
|
|
|
@ -6,7 +6,7 @@ CLIENT_ID = (
|
|||
"3MVG9QDx8IX8nP5T2Ha8ofvlmjLZl5L_gvfbT9."
|
||||
"HJvpHGKoAS_dcMN8LYpTSYeVFCraUnV.2Ag1Ki7m4znVO6"
|
||||
)
|
||||
APP_VERSION = "2.3.5"
|
||||
APP_VERSION = "2.4.7"
|
||||
OS_VERSION = 31
|
||||
OS = "android"
|
||||
DEVICE_MODEL = "exynos9820"
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
aiohttp~=3.8
|
||||
yarl~=1.9
|
||||
typing-extensions~=4.7
|
||||
aiohttp>=3.8
|
||||
yarl>=1.8
|
||||
typing-extensions>=4.8
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
black==23.7.0
|
||||
flake8==6.0.0
|
||||
mypy==1.4.1
|
||||
pylint==2.17.4
|
||||
black>=22.12
|
||||
flake8>=6.0
|
||||
mypy>=0.991
|
||||
pylint>=2.15
|
||||
setuptools>=62.3
|
||||
|
|
5
setup.py
5
setup.py
|
@ -7,7 +7,7 @@ with open("README.md", "r", encoding="utf-8") as f:
|
|||
|
||||
setup(
|
||||
name="pyhOn",
|
||||
version="0.15.9",
|
||||
version="0.15.14",
|
||||
author="Andre Basche",
|
||||
description="Control hOn devices with python",
|
||||
long_description=long_description,
|
||||
|
@ -21,7 +21,7 @@ setup(
|
|||
packages=find_packages(),
|
||||
include_package_data=True,
|
||||
python_requires=">=3.10",
|
||||
install_requires=["aiohttp~=3.8", "typing-extensions~=4.7", "yarl~=1.9"],
|
||||
install_requires=["aiohttp>=3.8", "typing-extensions>=4.8", "yarl>=1.8"],
|
||||
classifiers=[
|
||||
"Development Status :: 4 - Beta",
|
||||
"Environment :: Console",
|
||||
|
@ -30,6 +30,7 @@ setup(
|
|||
"Operating System :: OS Independent",
|
||||
"Programming Language :: Python :: 3.10",
|
||||
"Programming Language :: Python :: 3.11",
|
||||
"Programming Language :: Python :: 3.12",
|
||||
"Topic :: Software Development :: Libraries :: Python Modules",
|
||||
],
|
||||
entry_points={
|
||||
|
|
Loading…
Reference in a new issue