Skip to content

Commit

Permalink
Merge pull request #167 from baunan/master
Browse files Browse the repository at this point in the history
Fix multi installation issue
  • Loading branch information
gjohansson-ST authored Nov 12, 2023
2 parents 9d2f3aa + c981f72 commit 7bf2004
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion custom_components/sector/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ async def async_first_refresh(self) -> dict[str, Any]:
if not response_panellist:
raise UpdateFailed("Could not retrieve panels")
LOGGER.debug("Panels retrieved: %s", response_panellist)
return_data = {}
for panel in response_panellist:
data: dict[str, Any] = {panel["PanelId"]: {}}
data[panel["PanelId"]]["name"] = panel["DisplayName"]
Expand Down Expand Up @@ -197,14 +198,16 @@ async def async_first_refresh(self) -> dict[str, Any]:
}
data[panel["PanelId"]]["switch"] = switch_dict

return_data.update(data.copy())

LOGGER.debug("Trying to get user info")
response_getuser = await self._request(API_URL + "/Login/GetUser")
if not response_getuser or not isinstance(response_getuser, dict):
raise UpdateFailed("Could not retrieve username")
LOGGER.debug("User info retrieved %s", response_getuser)
self.logname = response_getuser.get("User", {}).get("UserName")

return data
return return_data

async def _async_update_data(self) -> dict[str, Any]:
"""Fetch info from API."""
Expand Down

0 comments on commit 7bf2004

Please sign in to comment.