Skip to content

Commit

Permalink
Send program name Andre0512/hon#124
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre0512 committed Nov 21, 2023
1 parent ea81e28 commit e9f2bb9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
6 changes: 5 additions & 1 deletion pyhon/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,11 @@ async def send_parameters(self, params: Dict[str, str | float]) -> bool:
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)
Expand Down
11 changes: 10 additions & 1 deletion pyhon/connection/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ async def send_command(
command: str,
parameters: Dict[str, Any],
ancillary_parameters: Dict[str, Any],
program_name: str = "",
) -> bool:
now: str = datetime.utcnow().isoformat()
data: Dict[str, Any] = {
Expand All @@ -208,6 +209,8 @@ async def send_command(
"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()
Expand Down Expand Up @@ -319,6 +322,12 @@ async def send_command(
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
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setup(
name="pyhOn",
version="0.15.13",
version="0.15.14",
author="Andre Basche",
description="Control hOn devices with python",
long_description=long_description,
Expand Down

0 comments on commit e9f2bb9

Please sign in to comment.