mirror of
https://github.com/home-assistant/core.git
synced 2025-12-25 05:26:47 +00:00
Add system option to disable polling (#51299)
This commit is contained in:
@@ -214,6 +214,7 @@ class EntityPlatform:
|
||||
@callback
|
||||
def async_create_setup_task() -> Coroutine:
|
||||
"""Get task to set up platform."""
|
||||
config_entries.current_entry.set(config_entry)
|
||||
return platform.async_setup_entry( # type: ignore[no-any-return,union-attr]
|
||||
self.hass, config_entry, self._async_schedule_add_entities
|
||||
)
|
||||
@@ -395,8 +396,10 @@ class EntityPlatform:
|
||||
)
|
||||
raise
|
||||
|
||||
if self._async_unsub_polling is not None or not any(
|
||||
entity.should_poll for entity in self.entities.values()
|
||||
if (
|
||||
(self.config_entry and self.config_entry.system_options.disable_polling)
|
||||
or self._async_unsub_polling is not None
|
||||
or not any(entity.should_poll for entity in self.entities.values())
|
||||
):
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user