Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use skip_configuration flag to skip requests in ZHA #41554

Merged
merged 6 commits into from Oct 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions homeassistant/components/zha/core/channels/base.py
Expand Up @@ -200,6 +200,10 @@ async def async_configure(self):

async def async_initialize(self, from_cache):
"""Initialize channel."""
if not from_cache and self._ch_pool.skip_configuration:
self._status = ChannelStatus.INITIALIZED
return

self.debug("initializing channel: from_cache: %s", from_cache)
attributes = []
for report_config in self._report_config:
Expand Down
11 changes: 6 additions & 5 deletions homeassistant/components/zha/core/channels/general.py
Expand Up @@ -89,11 +89,12 @@ async def async_configure(self):

async def async_initialize(self, from_cache):
"""Initialize channel."""
power_source = await self.get_attribute_value(
"power_source", from_cache=from_cache
)
if power_source is not None:
self._power_source = power_source
if not self._ch_pool.skip_configuration or from_cache:
Adminiuga marked this conversation as resolved.
Show resolved Hide resolved
power_source = await self.get_attribute_value(
"power_source", from_cache=from_cache
)
if power_source is not None:
self._power_source = power_source
await super().async_initialize(from_cache)

def get_power_source(self):
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/zha/core/device.py
Expand Up @@ -401,7 +401,7 @@ async def async_configure(self):
entry = self.gateway.zha_storage.async_create_or_update_device(self)
self.debug("stored in registry: %s", entry)

if self._channels.identify_ch is not None:
if self._channels.identify_ch is not None and not self.skip_configuration:
await self._channels.identify_ch.trigger_effect(
EFFECT_OKAY, EFFECT_DEFAULT_VARIANT
)
Expand Down