Bump ZHA quirks and add skip configuration support (#31982)

* add skip configuration
* Bump quirks
* add skip configuration to FakeDevice
This commit is contained in:
David F. Mulcahey 2020-02-19 09:19:26 -05:00 committed by GitHub
parent e90d29ea36
commit 8255bdf3d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 16 additions and 11 deletions

View File

@ -194,8 +194,7 @@ class ZigbeeChannel(LogMixin):
async def async_configure(self): async def async_configure(self):
"""Set cluster binding and attribute reporting.""" """Set cluster binding and attribute reporting."""
# Xiaomi devices don't need this and it disrupts pairing if not self._zha_device.skip_configuration:
if self._zha_device.manufacturer != "LUMI":
await self.bind() await self.bind()
if self.cluster.is_server: if self.cluster.is_server:
for report_config in self._report_config: for report_config in self._report_config:
@ -203,8 +202,9 @@ class ZigbeeChannel(LogMixin):
report_config["attr"], report_config["config"] report_config["attr"], report_config["config"]
) )
await asyncio.sleep(uniform(0.1, 0.5)) await asyncio.sleep(uniform(0.1, 0.5))
self.debug("finished channel configuration")
self.debug("finished channel configuration") else:
self.debug("skipping channel configuration")
self._status = ChannelStatus.CONFIGURED self._status = ChannelStatus.CONFIGURED
async def async_initialize(self, from_cache): async def async_initialize(self, from_cache):
@ -264,7 +264,7 @@ class ZigbeeChannel(LogMixin):
def log(self, level, msg, *args): def log(self, level, msg, *args):
"""Log a message.""" """Log a message."""
msg = f"[%s:%s]: {msg}" msg = f"[%s:%s]: {msg}"
args = (self.device.nwk, self._id,) + args args = (self.device.nwk, self._id) + args
_LOGGER.log(level, msg, *args) _LOGGER.log(level, msg, *args)
def __getattr__(self, name): def __getattr__(self, name):

View File

@ -146,9 +146,8 @@ class IASZoneChannel(ZigbeeChannel):
async def async_configure(self): async def async_configure(self):
"""Configure IAS device.""" """Configure IAS device."""
# Xiaomi devices don't need this and it disrupts pairing if self._zha_device.skip_configuration:
if self._zha_device.manufacturer == "LUMI": self.debug("skipping IASZoneChannel configuration")
self.debug("finished IASZoneChannel configuration")
return return
self.debug("started IASZoneChannel configuration") self.debug("started IASZoneChannel configuration")

View File

@ -213,6 +213,11 @@ class ZHADevice(LogMixin):
if Groups.cluster_id in clusters: if Groups.cluster_id in clusters:
return True return True
@property
def skip_configuration(self):
"""Return true if the device should not issue configuration related commands."""
return self._zigpy_device.skip_configuration
@property @property
def gateway(self): def gateway(self):
"""Return the gateway for this device.""" """Return the gateway for this device."""

View File

@ -5,7 +5,7 @@
"documentation": "https://www.home-assistant.io/integrations/zha", "documentation": "https://www.home-assistant.io/integrations/zha",
"requirements": [ "requirements": [
"bellows-homeassistant==0.13.2", "bellows-homeassistant==0.13.2",
"zha-quirks==0.0.32", "zha-quirks==0.0.33",
"zigpy-cc==0.1.0", "zigpy-cc==0.1.0",
"zigpy-deconz==0.7.0", "zigpy-deconz==0.7.0",
"zigpy-homeassistant==0.13.2", "zigpy-homeassistant==0.13.2",

View File

@ -2130,7 +2130,7 @@ zengge==0.2
zeroconf==0.24.4 zeroconf==0.24.4
# homeassistant.components.zha # homeassistant.components.zha
zha-quirks==0.0.32 zha-quirks==0.0.33
# homeassistant.components.zhong_hong # homeassistant.components.zhong_hong
zhong_hong_hvac==1.0.9 zhong_hong_hvac==1.0.9

View File

@ -732,7 +732,7 @@ yahooweather==0.10
zeroconf==0.24.4 zeroconf==0.24.4
# homeassistant.components.zha # homeassistant.components.zha
zha-quirks==0.0.32 zha-quirks==0.0.33
# homeassistant.components.zha # homeassistant.components.zha
zigpy-cc==0.1.0 zigpy-cc==0.1.0

View File

@ -72,6 +72,7 @@ class FakeDevice:
self.last_seen = time.time() self.last_seen = time.time()
self.status = 2 self.status = 2
self.initializing = False self.initializing = False
self.skip_configuration = False
self.manufacturer = manufacturer self.manufacturer = manufacturer
self.model = model self.model = model
self.node_desc = zigpy.zdo.types.NodeDescriptor() self.node_desc = zigpy.zdo.types.NodeDescriptor()