1
mirror of https://github.com/home-assistant/core synced 2024-08-06 09:34:49 +02:00

Add ZoneGroupState statistics to Sonos diagnostics (#73848)

This commit is contained in:
jjlawren 2022-06-22 12:29:34 -05:00 committed by GitHub
parent 54d04d233b
commit 8d66623036
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View File

@ -190,6 +190,14 @@ class SonosDiscoveryManager:
for speaker in self.data.discovered.values():
speaker.activity_stats.log_report()
speaker.event_stats.log_report()
if zgs := next(
speaker.soco.zone_group_state for speaker in self.data.discovered.values()
):
_LOGGER.debug(
"ZoneGroupState stats: (%s/%s) processed",
zgs.processed_count,
zgs.total_requests,
)
await asyncio.gather(
*(speaker.async_offline() for speaker in self.data.discovered.values())
)

View File

@ -136,4 +136,8 @@ async def async_generate_speaker_info(
payload["media"] = await async_generate_media_info(hass, speaker)
payload["activity_stats"] = speaker.activity_stats.report()
payload["event_stats"] = speaker.event_stats.report()
payload["zone_group_state_stats"] = {
"processed": speaker.soco.zone_group_state.processed_count,
"total_requests": speaker.soco.zone_group_state.total_requests,
}
return payload