Skip to content

Commit

Permalink
Backward compatibility with pre 2024.6 builds
Browse files Browse the repository at this point in the history
  • Loading branch information
amitfin committed Jun 3, 2024
1 parent 14952f0 commit 616c091
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions custom_components/retry/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,8 @@ def _wrap_service_calls(
) -> None:
"""Warp any service call with retry."""
for action in sequence:
match cv.determine_script_action(action):
action_type = cv.determine_script_action(action)
match action_type:
case cv.SCRIPT_ACTION_CALL_SERVICE:
if action[ATTR_SERVICE] == f"{DOMAIN}.{ACTIONS_SERVICE}":
raise IntegrationError("Nested retry.actions are disallowed")
Expand Down Expand Up @@ -483,8 +484,9 @@ def _wrap_service_calls(
case cv.SCRIPT_ACTION_PARALLEL:
for parallel in action[CONF_PARALLEL]:
_wrap_service_calls(hass, parallel[CONF_SEQUENCE], retry_params)
case cv.SCRIPT_ACTION_SEQUENCE:
_wrap_service_calls(hass, action[CONF_SEQUENCE], retry_params)
case _:
if action_type == getattr(cv, "SCRIPT_ACTION_SEQUENCE", "sequence"):
_wrap_service_calls(hass, action[CONF_SEQUENCE], retry_params)


async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
Expand Down

0 comments on commit 616c091

Please sign in to comment.