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

Increase Zigbee command retries #93877

Merged
merged 3 commits into from
Jun 1, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@

_LOGGER = logging.getLogger(__name__)

DEFAULT_REQUEST_RETRIES = 3


class AttrReportConfig(TypedDict, total=True):
"""Configuration to report for the attributes."""
Expand Down Expand Up @@ -78,6 +80,8 @@ def decorate_command(cluster_handler, command):

@wraps(command)
async def wrapper(*args, **kwds):
kwds.setdefault("tries", DEFAULT_REQUEST_RETRIES)

try:
result = await command(*args, **kwds)
cluster_handler.debug(
Expand Down
5 changes: 5 additions & 0 deletions tests/components/zha/test_alarm_control_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ async def test_alarm_control_panel(
0,
security.IasAce.AudibleNotification.Default_Sound,
security.IasAce.AlarmStatus.No_Alarm,
tries=3,
)

# disarm from HA
Expand Down Expand Up @@ -134,6 +135,7 @@ async def test_alarm_control_panel(
0,
security.IasAce.AudibleNotification.Default_Sound,
security.IasAce.AlarmStatus.Emergency,
tries=3,
)

# reset the panel
Expand All @@ -157,6 +159,7 @@ async def test_alarm_control_panel(
0,
security.IasAce.AudibleNotification.Default_Sound,
security.IasAce.AlarmStatus.No_Alarm,
tries=3,
)

# arm_night from HA
Expand All @@ -177,6 +180,7 @@ async def test_alarm_control_panel(
0,
security.IasAce.AudibleNotification.Default_Sound,
security.IasAce.AlarmStatus.No_Alarm,
tries=3,
)

# reset the panel
Expand Down Expand Up @@ -274,5 +278,6 @@ async def reset_alarm_panel(hass, cluster, entity_id):
0,
security.IasAce.AudibleNotification.Default_Sound,
security.IasAce.AlarmStatus.No_Alarm,
tries=3,
)
cluster.client_command.reset_mock()
4 changes: 2 additions & 2 deletions tests/components/zha/test_device_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ async def test_action(hass: HomeAssistant, device_ias, device_inovelli) -> None:
5,
expect_reply=False,
manufacturer=4151,
tries=1,
tries=3,
tsn=None,
)
in cluster.request.call_args_list
Expand All @@ -345,7 +345,7 @@ async def test_action(hass: HomeAssistant, device_ias, device_inovelli) -> None:
5,
expect_reply=False,
manufacturer=4151,
tries=1,
tries=3,
tsn=None,
)
in cluster.request.call_args_list
Expand Down
2 changes: 1 addition & 1 deletion tests/components/zha/test_discover.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ async def test_devices(
),
expect_reply=True,
manufacturer=None,
tries=1,
tries=3,
tsn=None,
)
]
Expand Down