Skip to content

Commit b1399a5

Browse files
tr4nt0redenhausfrenck
authored
Prevent startup blocking when a friend’s trophy summary is private on PlayStation Network (home-assistant#157597)
Co-authored-by: Robert Resch <[email protected]> Co-authored-by: Franck Nijhof <[email protected]>
1 parent 316cdde commit b1399a5

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

homeassistant/components/playstation_network/coordinator.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -251,13 +251,7 @@ async def _async_setup(self) -> None:
251251
def _update_data(self) -> PlaystationNetworkData:
252252
"""Update friend status data."""
253253
try:
254-
return PlaystationNetworkData(
255-
username=self.user.online_id,
256-
account_id=self.user.account_id,
257-
presence=self.user.get_presence(),
258-
profile=self.profile,
259-
trophy_summary=self.user.trophy_summary(),
260-
)
254+
presence = self.user.get_presence()
261255
except PSNAWPForbiddenError as error:
262256
raise UpdateFailed(
263257
translation_domain=DOMAIN,
@@ -267,6 +261,19 @@ def _update_data(self) -> PlaystationNetworkData:
267261
except PSNAWPError:
268262
raise
269263

264+
try:
265+
trophy_summary = self.user.trophy_summary()
266+
except PSNAWPForbiddenError:
267+
trophy_summary = None
268+
269+
return PlaystationNetworkData(
270+
username=self.user.online_id,
271+
account_id=self.user.account_id,
272+
profile=self.profile,
273+
presence=presence,
274+
trophy_summary=trophy_summary,
275+
)
276+
270277
async def update_data(self) -> PlaystationNetworkData:
271278
"""Update friend status data."""
272279
return await self.hass.async_add_executor_job(self._update_data)

0 commit comments

Comments
 (0)