Add recent context (#15989)
* Add recent context * Add async_set_context to components not using new services
This commit is contained in:
parent
d1e1b9b38a
commit
1be61df9c0
11 changed files with 211 additions and 11 deletions
|
@ -218,13 +218,15 @@ async def _handle_service_platform_call(func, data, entities, context):
|
|||
if not entity.available:
|
||||
continue
|
||||
|
||||
entity.async_set_context(context)
|
||||
|
||||
if isinstance(func, str):
|
||||
await getattr(entity, func)(**data)
|
||||
else:
|
||||
await func(entity, data)
|
||||
|
||||
if entity.should_poll:
|
||||
tasks.append(entity.async_update_ha_state(True, context))
|
||||
tasks.append(entity.async_update_ha_state(True))
|
||||
|
||||
if tasks:
|
||||
await asyncio.wait(tasks)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue