Skip to content

Commit

Permalink
feat: add parent_controller property to controller
Browse files Browse the repository at this point in the history
  • Loading branch information
noahhusby committed Jul 22, 2024
1 parent c555c63 commit 3939cd4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions aiorussound/rio.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,8 @@ async def enumerate_controllers(self):
firmware_version = await self.get_variable(
device_str, "firmwareVersion"
)
controller = Controller(self, controller_id, mac_address, controller_type, firmware_version)
controller = Controller(self, controllers.get(1, None), controller_id, mac_address, controller_type,
firmware_version)
await controller.fetch_configuration()
controllers[controller_id] = controller
except CommandException:
Expand Down Expand Up @@ -271,9 +272,10 @@ async def _watch_cached_devices(self):
class Controller:
"""Uniquely identifies a controller"""

def __init__(self, instance: Russound, controller_id: int, mac_address: str, controller_type: str,
firmware_version: str):
def __init__(self, instance: Russound, parent_controller, controller_id: int, mac_address: str,
controller_type: str, firmware_version: str):
self.instance = instance
self.parent_controller = parent_controller
self.controller_id = controller_id
self.mac_address = mac_address
self.controller_type = controller_type
Expand Down
2 changes: 1 addition & 1 deletion examples/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ async def demo(loop, host):
print("Finding controllers")
controllers = await rus.enumerate_controllers()

for c in controllers:
for c in controllers.values():
print("%s (%s): %s" % (c.controller_id, c.mac_address, c.controller_type))

print("Determining valid zones")
Expand Down

0 comments on commit 3939cd4

Please sign in to comment.