Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 8 additions & 13 deletions homeassistant/components/zha/core/channels/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ async def wrapper(*args, **kwds):
)
return result

except (zigpy.exceptions.DeliveryError, asyncio.TimeoutError) as ex:
except (zigpy.exceptions.ZigbeeException, asyncio.TimeoutError) as ex:
channel.debug("command failed: %s exception: %s", command.__name__, str(ex))
return ex

Expand Down Expand Up @@ -135,21 +135,21 @@ def async_send_signal(self, signal: str, *args: Any) -> None:
async def bind(self):
"""Bind a zigbee cluster.

This also swallows DeliveryError exceptions that are thrown when
This also swallows ZigbeeException exceptions that are thrown when
devices are unreachable.
"""
try:
res = await self.cluster.bind()
self.debug("bound '%s' cluster: %s", self.cluster.ep_attribute, res[0])
except (zigpy.exceptions.DeliveryError, asyncio.TimeoutError) as ex:
except (zigpy.exceptions.ZigbeeException, asyncio.TimeoutError) as ex:
self.debug(
"Failed to bind '%s' cluster: %s", self.cluster.ep_attribute, str(ex)
)

async def configure_reporting(self) -> None:
"""Configure attribute reporting for a cluster.

This also swallows DeliveryError exceptions that are thrown when
This also swallows ZigbeeException exceptions that are thrown when
devices are unreachable.
"""
kwargs = {}
Expand All @@ -173,7 +173,7 @@ async def configure_reporting(self) -> None:
reportable_change,
res,
)
except (zigpy.exceptions.DeliveryError, asyncio.TimeoutError) as ex:
except (zigpy.exceptions.ZigbeeException, asyncio.TimeoutError) as ex:
self.debug(
"failed to set reporting for '%s' attr on '%s' cluster: %s",
attr_name,
Expand Down Expand Up @@ -263,20 +263,15 @@ async def get_attributes(self, attributes, from_cache=True):
only_cache=from_cache,
manufacturer=manufacturer,
)
results = {
attribute: result.get(attribute)
for attribute in attributes
if result.get(attribute) is not None
}
except (asyncio.TimeoutError, zigpy.exceptions.DeliveryError) as ex:
return result
except (asyncio.TimeoutError, zigpy.exceptions.ZigbeeException) as ex:
self.debug(
"failed to get attributes '%s' on '%s' cluster: %s",
attributes,
self.cluster.ep_attribute,
str(ex),
)
results = {}
return results
return {}

def log(self, level, msg, *args):
"""Log a message."""
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/zha/core/channels/hvac.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""HVAC channels module for Zigbee Home Automation."""
import logging

from zigpy.exceptions import DeliveryError
from zigpy.exceptions import ZigbeeException
import zigpy.zcl.clusters.hvac as hvac

from homeassistant.core import callback
Expand Down Expand Up @@ -31,7 +31,7 @@ async def async_set_speed(self, value) -> None:

try:
await self.cluster.write_attributes({"fan_mode": value})
except DeliveryError as ex:
except ZigbeeException as ex:
self.error("Could not set speed: %s", ex)
return

Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/zha/core/channels/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import asyncio
import logging

from zigpy.exceptions import DeliveryError
from zigpy.exceptions import ZigbeeException
import zigpy.zcl.clusters.security as security

from homeassistant.core import callback
Expand Down Expand Up @@ -151,7 +151,7 @@ async def async_configure(self):
self._cluster.ep_attribute,
res[0],
)
except DeliveryError as ex:
except ZigbeeException as ex:
self.debug(
"Failed to write cie_addr: %s to '%s' cluster: %s",
str(ieee),
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/zha/core/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ async def write_zigbee_attribute(
response,
)
return response
except zigpy.exceptions.DeliveryError as exc:
except zigpy.exceptions.ZigbeeException as exc:
self.debug(
"failed to set attribute: %s %s %s %s %s",
f"{ATTR_VALUE}: {value}",
Expand Down Expand Up @@ -563,7 +563,7 @@ async def async_remove_from_group(self, group_id):
"""Remove this device from the provided zigbee group."""
try:
await self._zigpy_device.remove_from_group(group_id)
except (zigpy.exceptions.DeliveryError, asyncio.TimeoutError) as ex:
except (zigpy.exceptions.ZigbeeException, asyncio.TimeoutError) as ex:
self.debug(
"Failed to remove device '%s' from group: 0x%04x ex: %s",
self._zigpy_device.ieee,
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/zha/fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import logging
from typing import List

from zigpy.exceptions import DeliveryError
from zigpy.exceptions import ZigbeeException
import zigpy.zcl.clusters.hvac as hvac

from homeassistant.components.fan import (
Expand Down Expand Up @@ -177,7 +177,7 @@ async def async_set_speed(value) -> None:
"""Set the speed of the fan."""
try:
await self._fan_channel.write_attributes({"fan_mode": value})
except DeliveryError as ex:
except ZigbeeException as ex:
self.error("Could not set speed: %s", ex)
return

Expand Down