From e9f2bb9f4fbfa37c072b1cccc547fc847c7fff23 Mon Sep 17 00:00:00 2001 From: Andre Basche Date: Tue, 21 Nov 2023 02:23:38 +0100 Subject: [PATCH] Send program name Andre0512/hon#124 --- pyhon/commands.py | 6 +++++- pyhon/connection/api.py | 11 ++++++++++- setup.py | 2 +- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/pyhon/commands.py b/pyhon/commands.py index 8c0275a..d88cbd1 100644 --- a/pyhon/commands.py +++ b/pyhon/commands.py @@ -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) diff --git a/pyhon/connection/api.py b/pyhon/connection/api.py index 61bfe1f..2cb7dfe 100644 --- a/pyhon/connection/api.py +++ b/pyhon/connection/api.py @@ -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 diff --git a/setup.py b/setup.py index fe202c6..3887039 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ with open("README.md", "r", encoding="utf-8") as f: setup( name="pyhOn", - version="0.15.13", + version="0.15.14", author="Andre Basche", description="Control hOn devices with python", long_description=long_description,