mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +00:00
fix ZHA IASWD commands (#33402)
This commit is contained in:
parent
de54659097
commit
ef61118d49
@ -950,6 +950,15 @@ def async_load_api(hass):
|
||||
schema=SERVICE_SCHEMAS[SERVICE_ISSUE_ZIGBEE_GROUP_COMMAND],
|
||||
)
|
||||
|
||||
def _get_ias_wd_channel(zha_device):
|
||||
"""Get the IASWD channel for a device."""
|
||||
cluster_channels = {
|
||||
ch.name: ch
|
||||
for pool in zha_device.channels.pools
|
||||
for ch in pool.claimed_channels.values()
|
||||
}
|
||||
return cluster_channels.get(CHANNEL_IAS_WD)
|
||||
|
||||
async def warning_device_squawk(service):
|
||||
"""Issue the squawk command for an IAS warning device."""
|
||||
ieee = service.data[ATTR_IEEE]
|
||||
@ -959,9 +968,9 @@ def async_load_api(hass):
|
||||
|
||||
zha_device = zha_gateway.get_device(ieee)
|
||||
if zha_device is not None:
|
||||
channel = zha_device.cluster_channels.get(CHANNEL_IAS_WD)
|
||||
channel = _get_ias_wd_channel(zha_device)
|
||||
if channel:
|
||||
await channel.squawk(mode, strobe, level)
|
||||
await channel.issue_squawk(mode, strobe, level)
|
||||
else:
|
||||
_LOGGER.error(
|
||||
"Squawking IASWD: %s: [%s] is missing the required IASWD channel!",
|
||||
@ -1003,9 +1012,9 @@ def async_load_api(hass):
|
||||
|
||||
zha_device = zha_gateway.get_device(ieee)
|
||||
if zha_device is not None:
|
||||
channel = zha_device.cluster_channels.get(CHANNEL_IAS_WD)
|
||||
channel = _get_ias_wd_channel(zha_device)
|
||||
if channel:
|
||||
await channel.start_warning(
|
||||
await channel.issue_start_warning(
|
||||
mode, strobe, level, duration, duty_mode, intensity
|
||||
)
|
||||
else:
|
||||
|
@ -51,7 +51,7 @@ class IasWd(ZigbeeChannel):
|
||||
"""Get the specified bit from the value."""
|
||||
return (value & (1 << bit)) != 0
|
||||
|
||||
async def squawk(
|
||||
async def issue_squawk(
|
||||
self,
|
||||
mode=WARNING_DEVICE_SQUAWK_MODE_ARMED,
|
||||
strobe=WARNING_DEVICE_STROBE_YES,
|
||||
@ -76,7 +76,7 @@ class IasWd(ZigbeeChannel):
|
||||
|
||||
await self.squawk(value)
|
||||
|
||||
async def start_warning(
|
||||
async def issue_start_warning(
|
||||
self,
|
||||
mode=WARNING_DEVICE_MODE_EMERGENCY,
|
||||
strobe=WARNING_DEVICE_STROBE_YES,
|
||||
|
Loading…
x
Reference in New Issue
Block a user