Compare commits

...

4 Commits

Author SHA1 Message Date
7bd3aac7c5 Fix error for no category 2023-05-07 17:39:22 +02:00
365a37b42d Fix send command error 2023-05-07 01:17:02 +02:00
2bde6bb61c Fix mypy error 2023-05-07 00:48:42 +02:00
ccff32e6c1 Fix missing program 2023-05-07 00:47:08 +02:00
4 changed files with 14 additions and 6 deletions

View File

@ -142,8 +142,13 @@ class HonAppliance:
if last is None:
continue
parameters = command_history[last].get("command", {}).get("parameters", {})
if command.categories and parameters.get("category"):
command.category = parameters.pop("category").split(".")[-1].lower()
if command.categories and (
parameters.get("program") or parameters.get("category")
):
if parameters.get("program"):
command.category = parameters.pop("program").split(".")[-1].lower()
else:
command.category = parameters.pop("category")
command = self.commands[name]
for key, data in command.settings.items():
if (

View File

@ -85,8 +85,8 @@ class HonCommand:
self._parameters[name] = HonParameterProgram(name, self, "custom")
async def send(self) -> bool:
params = self.parameter_groups["parameters"]
ancillary_params = self.parameter_groups["ancillary_parameters"]
params = self.parameter_groups.get("parameters", {})
ancillary_params = self.parameter_groups.get("ancillaryParameters", {})
return await self._api.send_command(
self._appliance, self._name, params, ancillary_params
)

View File

@ -12,7 +12,10 @@ class HonParameterProgram(HonParameterEnum):
def __init__(self, key: str, command: "HonCommand", group: str) -> None:
super().__init__(key, {}, group)
self._command = command
self._value: str = command.category
if "PROGRAM" in command.category:
self._value = command.category.split(".")[-1].lower()
else:
self._value = command.category
self._programs: Dict[str, "HonCommand"] = command.categories
self._typology: str = "enum"

View File

@ -7,7 +7,7 @@ with open("README.md", "r") as f:
setup(
name="pyhOn",
version="0.10.1",
version="0.10.4",
author="Andre Basche",
description="Control hOn devices with python",
long_description=long_description,