aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Basche <andre.basche@gmail.com>2023-11-21 02:23:38 +0100
committerAndre Basche <andre.basche@gmail.com>2023-11-21 02:23:53 +0100
commite9f2bb9f4fbfa37c072b1cccc547fc847c7fff23 (patch)
treee46f211f3d03cf112e6dc138006f863b446fcc16
parentea81e2891f5bf85cd4c8b12348745e9f49cef341 (diff)
Send program name Andre0512/hon#124v0.15.14
-rw-r--r--pyhon/commands.py6
-rw-r--r--pyhon/connection/api.py11
-rw-r--r--setup.py2
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:
144 self.appliance.sync_command_to_params(self.name) 144 self.appliance.sync_command_to_params(self.name)
145 try: 145 try:
146 result = await self.api.send_command( 146 result = await self.api.send_command(
147 self._appliance, self._name, params, ancillary_params 147 self._appliance,
148 self._name,
149 params,
150 ancillary_params,
151 self._category_name,
148 ) 152 )
149 if not result: 153 if not result:
150 _LOGGER.error(result) 154 _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:
190 command: str, 190 command: str,
191 parameters: Dict[str, Any], 191 parameters: Dict[str, Any],
192 ancillary_parameters: Dict[str, Any], 192 ancillary_parameters: Dict[str, Any],
193 program_name: str = "",
193 ) -> bool: 194 ) -> bool:
194 now: str = datetime.utcnow().isoformat() 195 now: str = datetime.utcnow().isoformat()
195 data: Dict[str, Any] = { 196 data: Dict[str, Any] = {
@@ -208,6 +209,8 @@ class HonAPI:
208 "parameters": parameters, 209 "parameters": parameters,
209 "applianceType": appliance.appliance_type, 210 "applianceType": appliance.appliance_type,
210 } 211 }
212 if command == "startProgram" and program_name:
213 data.update({"programName": program_name.upper()})
211 url: str = f"{const.API_URL}/commands/v1/send" 214 url: str = f"{const.API_URL}/commands/v1/send"
212 async with self._hon.post(url, json=data) as response: 215 async with self._hon.post(url, json=data) as response:
213 json_data: Dict[str, Any] = await response.json() 216 json_data: Dict[str, Any] = await response.json()
@@ -319,6 +322,12 @@ class TestAPI(HonAPI):
319 command: str, 322 command: str,
320 parameters: Dict[str, Any], 323 parameters: Dict[str, Any],
321 ancillary_parameters: Dict[str, Any], 324 ancillary_parameters: Dict[str, Any],
325 program_name: str = "",
322 ) -> bool: 326 ) -> bool:
323 _LOGGER.info("%s - %s", str(parameters), str(ancillary_parameters)) 327 _LOGGER.info(
328 "%s - %s - %s",
329 str(parameters),
330 str(ancillary_parameters),
331 str(program_name),
332 )
324 return True 333 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:
7 7
8setup( 8setup(
9 name="pyhOn", 9 name="pyhOn",
10 version="0.15.13", 10 version="0.15.14",
11 author="Andre Basche", 11 author="Andre Basche",
12 description="Control hOn devices with python", 12 description="Control hOn devices with python",
13 long_description=long_description, 13 long_description=long_description,