mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 05:37:44 +00:00
Use skip_configuration flag to skip requests in ZHA (#41554)
* Remove duplicated attribute request from ZHA The on_off attribute is on the REPORT_CONFIG, so super().async_initialize already requests it from the device. No need to request it twice. * Use skip_configuration flag to skip requests in ZHA * Fix loading from cache * Fix loading from cache condition
This commit is contained in:
parent
c29f613b1d
commit
28fb761b01
@ -200,6 +200,10 @@ class ZigbeeChannel(LogMixin):
|
||||
|
||||
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:
|
||||
|
@ -89,11 +89,12 @@ class BasicChannel(ZigbeeChannel):
|
||||
|
||||
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:
|
||||
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):
|
||||
|
@ -401,7 +401,7 @@ class ZHADevice(LogMixin):
|
||||
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
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user