Catch bad devices when Google Sync (#39377)
This commit is contained in:
parent
b882304ec2
commit
8302a7879e
2 changed files with 72 additions and 4 deletions
|
@ -83,15 +83,24 @@ async def async_devices_sync(hass, data, payload):
|
|||
)
|
||||
|
||||
agent_user_id = data.config.get_agent_user_id(data.context)
|
||||
|
||||
devices = await asyncio.gather(
|
||||
entities = async_get_entities(hass, data.config)
|
||||
results = await asyncio.gather(
|
||||
*(
|
||||
entity.sync_serialize(agent_user_id)
|
||||
for entity in async_get_entities(hass, data.config)
|
||||
for entity in entities
|
||||
if entity.should_expose()
|
||||
)
|
||||
),
|
||||
return_exceptions=True,
|
||||
)
|
||||
|
||||
devices = []
|
||||
|
||||
for entity, result in zip(entities, results):
|
||||
if isinstance(result, Exception):
|
||||
_LOGGER.error("Error serializing %s", entity.entity_id, exc_info=result)
|
||||
else:
|
||||
devices.append(result)
|
||||
|
||||
response = {"agentUserId": agent_user_id, "devices": devices}
|
||||
|
||||
await data.config.async_connect_agent_user(agent_user_id)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue