mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 12:47:08 +00:00
Fix error decorator [sonos] (#66399)
This commit is contained in:
parent
a7e5f38a3e
commit
1053314a30
@ -24,7 +24,7 @@ UID_POSTFIX = "01400"
|
|||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
_T = TypeVar("_T", "SonosSpeaker", "SonosEntity", "SonosHouseholdCoordinator")
|
_T = TypeVar("_T", bound="SonosSpeaker | SonosEntity | SonosHouseholdCoordinator")
|
||||||
_R = TypeVar("_R")
|
_R = TypeVar("_R")
|
||||||
_P = ParamSpec("_P")
|
_P = ParamSpec("_P")
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
import logging
|
import logging
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
from soco.exceptions import SoCoSlaveException, SoCoUPnPException
|
from soco.exceptions import SoCoSlaveException, SoCoUPnPException
|
||||||
|
|
||||||
@ -337,19 +338,19 @@ class SonosAlarmEntity(SonosEntity, SwitchEntity):
|
|||||||
ATTR_INCLUDE_LINKED_ZONES: self.alarm.include_linked_zones,
|
ATTR_INCLUDE_LINKED_ZONES: self.alarm.include_linked_zones,
|
||||||
}
|
}
|
||||||
|
|
||||||
async def async_turn_on(self, **kwargs) -> None:
|
def turn_on(self, **kwargs: Any) -> None:
|
||||||
"""Turn alarm switch on."""
|
"""Turn alarm switch on."""
|
||||||
await self.async_handle_switch_on_off(turn_on=True)
|
self._handle_switch_on_off(turn_on=True)
|
||||||
|
|
||||||
async def async_turn_off(self, **kwargs) -> None:
|
def turn_off(self, **kwargs: Any) -> None:
|
||||||
"""Turn alarm switch off."""
|
"""Turn alarm switch off."""
|
||||||
await self.async_handle_switch_on_off(turn_on=False)
|
self._handle_switch_on_off(turn_on=False)
|
||||||
|
|
||||||
@soco_error()
|
@soco_error()
|
||||||
async def async_handle_switch_on_off(self, turn_on: bool) -> None:
|
def _handle_switch_on_off(self, turn_on: bool) -> None:
|
||||||
"""Handle turn on/off of alarm switch."""
|
"""Handle turn on/off of alarm switch."""
|
||||||
self.alarm.enabled = turn_on
|
self.alarm.enabled = turn_on
|
||||||
await self.hass.async_add_executor_job(self.alarm.save)
|
self.alarm.save()
|
||||||
|
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
|
Loading…
x
Reference in New Issue
Block a user