Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add gang count and position to ra3/hwqsx control stations #130

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions pylutron_caseta/smartbridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -851,14 +851,14 @@ async def _load_ra3_control_stations(self, area):
for station in station_json:
station_name = station["Name"]
ganged_devices_json = station["AssociatedGangedDevices"]

for device_json in ganged_devices_json:
await self._load_ra3_station_device(
area_name, station_name, device_json
area_name, station_name, device_json, len(ganged_devices_json)
)

async def _load_ra3_station_device(
self, control_station_area_name, control_station_name, device_json
self, control_station_area_name, control_station_name, device_json, gang_count
):
"""
Load button groups and buttons for a control station device.
Expand All @@ -873,6 +873,8 @@ async def _load_ra3_station_device(
if device_type not in _LEAP_DEVICE_TYPES.get("sensor"):
return

gang_position = device_json["GangPosition"]

button_group_json = await self._request(
"ReadRequest", f"/device/{device_id}/buttongroup/expanded"
)
Expand Down Expand Up @@ -923,6 +925,8 @@ async def _load_ra3_station_device(
control_station_name=control_station_name,
device_name=device_name,
area=id_from_href(device_json.Body["Device"]["AssociatedArea"]["href"]),
gang_position=gang_position,
gang_count=gang_count,
)

for button_expanded_json in button_group_json.Body["ButtonGroupsExpanded"]:
Expand Down