mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 23:27:37 +00:00
Add action exceptions to Cambridge Audio (#131597)
This commit is contained in:
parent
4702d8ddb0
commit
b1a540a772
@ -12,7 +12,7 @@ from homeassistant.const import EntityCategory
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
||||
from .entity import CambridgeAudioEntity
|
||||
from .entity import CambridgeAudioEntity, command
|
||||
|
||||
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
@ -116,6 +116,7 @@ class CambridgeAudioSelect(CambridgeAudioEntity, SelectEntity):
|
||||
"""Return the state of the select."""
|
||||
return self.entity_description.value_fn(self.client)
|
||||
|
||||
@command
|
||||
async def async_select_option(self, option: str) -> None:
|
||||
"""Change the selected option."""
|
||||
await self.entity_description.set_value_fn(self.client, option)
|
||||
|
@ -12,7 +12,7 @@ from homeassistant.const import EntityCategory
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
||||
from .entity import CambridgeAudioEntity
|
||||
from .entity import CambridgeAudioEntity, command
|
||||
|
||||
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
@ -73,10 +73,12 @@ class CambridgeAudioSwitch(CambridgeAudioEntity, SwitchEntity):
|
||||
"""Return the state of the switch."""
|
||||
return self.entity_description.value_fn(self.client)
|
||||
|
||||
@command
|
||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||
"""Turn the switch on."""
|
||||
await self.entity_description.set_value_fn(self.client, True)
|
||||
|
||||
@command
|
||||
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||
"""Turn the switch off."""
|
||||
await self.entity_description.set_value_fn(self.client, False)
|
||||
|
Loading…
x
Reference in New Issue
Block a user