Skip to content

Commit

Permalink
Fix state fetch logic for OperationState==Inactive
Browse files Browse the repository at this point in the history
  • Loading branch information
ekutner committed Nov 7, 2023
1 parent 3994bbb commit 7542b7c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
14 changes: 12 additions & 2 deletions home_connect_async/appliance.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,8 +575,18 @@ async def async_update_data(self, data:dict) -> None:
self.active_program = None
self._active_program_fail_count = 0
self.selected_program = None
self.available_programs = None
self.commands = {}
# It appears that there are appliances, like Hood that can be inactive, or even powered off,
# but still have available programs that can be started with a call to start_program.
# However, we only want to fetch the available program if we we're in a state that already fetched them
if "BSH.Common.Status.OperationState" not in self.status or self.status["BSH.Common.Status.OperationState"].value != "BSH.Common.EnumType.OperationState.Ready":
self.available_programs = await self._async_fetch_programs("available")

# Update the commands only if they weren't updated in the previous state
if "BSH.Common.Status.OperationState" not in self.status or \
self.status["BSH.Common.Status.OperationState"].value not in \
["BSH.Common.EnumType.OperationState.Finished", "BSH.Common.EnumType.OperationState.Ready"]:
self.commands = await self._async_fetch_commands()

await self._callbacks.async_broadcast_event(self, Events.DATA_CHANGED)

elif key == "BSH.Common.Status.OperationState" and value == "BSH.Common.EnumType.OperationState.Pause" \
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
setup(
name = 'home-connect-async',
packages = ['home_connect_async'],
version = '0.7.14',
version = '0.7.15',
license='MIT',
description = 'Async SDK for BSH Home Connect API',
author = 'Eran Kutner',
Expand Down

0 comments on commit 7542b7c

Please sign in to comment.