Skip to content

Commit e9f2bb9

Browse files
committed
Send program name Andre0512/hon#124
1 parent ea81e28 commit e9f2bb9

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

pyhon/commands.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,11 @@ async def send_parameters(self, params: Dict[str, str | float]) -> bool:
144144
self.appliance.sync_command_to_params(self.name)
145145
try:
146146
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,
148152
)
149153
if not result:
150154
_LOGGER.error(result)

pyhon/connection/api.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ async def send_command(
190190
command: str,
191191
parameters: Dict[str, Any],
192192
ancillary_parameters: Dict[str, Any],
193+
program_name: str = "",
193194
) -> bool:
194195
now: str = datetime.utcnow().isoformat()
195196
data: Dict[str, Any] = {
@@ -208,6 +209,8 @@ async def send_command(
208209
"parameters": parameters,
209210
"applianceType": appliance.appliance_type,
210211
}
212+
if command == "startProgram" and program_name:
213+
data.update({"programName": program_name.upper()})
211214
url: str = f"{const.API_URL}/commands/v1/send"
212215
async with self._hon.post(url, json=data) as response:
213216
json_data: Dict[str, Any] = await response.json()
@@ -319,6 +322,12 @@ async def send_command(
319322
command: str,
320323
parameters: Dict[str, Any],
321324
ancillary_parameters: Dict[str, Any],
325+
program_name: str = "",
322326
) -> 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+
)
324333
return True

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
setup(
99
name="pyhOn",
10-
version="0.15.13",
10+
version="0.15.14",
1111
author="Andre Basche",
1212
description="Control hOn devices with python",
1313
long_description=long_description,

0 commit comments

Comments
 (0)