mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Support continue_on_error for command execution in Overkiz (#103591)
This commit is contained in:
parent
d935d06265
commit
a11091890f
@ -5,9 +5,12 @@ from typing import Any, cast
|
|||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
from pyoverkiz.enums import OverkizCommand, Protocol
|
from pyoverkiz.enums import OverkizCommand, Protocol
|
||||||
|
from pyoverkiz.exceptions import OverkizException
|
||||||
from pyoverkiz.models import Command, Device, StateDefinition
|
from pyoverkiz.models import Command, Device, StateDefinition
|
||||||
from pyoverkiz.types import StateType as OverkizStateType
|
from pyoverkiz.types import StateType as OverkizStateType
|
||||||
|
|
||||||
|
from homeassistant.exceptions import HomeAssistantError
|
||||||
|
|
||||||
from .coordinator import OverkizDataUpdateCoordinator
|
from .coordinator import OverkizDataUpdateCoordinator
|
||||||
|
|
||||||
# Commands that don't support setting
|
# Commands that don't support setting
|
||||||
@ -88,11 +91,15 @@ class OverkizExecutor:
|
|||||||
):
|
):
|
||||||
parameters.append(0)
|
parameters.append(0)
|
||||||
|
|
||||||
|
try:
|
||||||
exec_id = await self.coordinator.client.execute_command(
|
exec_id = await self.coordinator.client.execute_command(
|
||||||
self.device.device_url,
|
self.device.device_url,
|
||||||
Command(command_name, parameters),
|
Command(command_name, parameters),
|
||||||
"Home Assistant",
|
"Home Assistant",
|
||||||
)
|
)
|
||||||
|
# Catch Overkiz exceptions to support `continue_on_error` functionality
|
||||||
|
except OverkizException as exception:
|
||||||
|
raise HomeAssistantError(exception) from exception
|
||||||
|
|
||||||
# ExecutionRegisteredEvent doesn't contain the device_url, thus we need to register it here
|
# ExecutionRegisteredEvent doesn't contain the device_url, thus we need to register it here
|
||||||
self.coordinator.executions[exec_id] = {
|
self.coordinator.executions[exec_id] = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user