mirror of
https://github.com/home-assistant/core.git
synced 2025-07-28 15:47:12 +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.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from .entity import CambridgeAudioEntity
|
from .entity import CambridgeAudioEntity, command
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True, kw_only=True)
|
@dataclass(frozen=True, kw_only=True)
|
||||||
@ -116,6 +116,7 @@ class CambridgeAudioSelect(CambridgeAudioEntity, SelectEntity):
|
|||||||
"""Return the state of the select."""
|
"""Return the state of the select."""
|
||||||
return self.entity_description.value_fn(self.client)
|
return self.entity_description.value_fn(self.client)
|
||||||
|
|
||||||
|
@command
|
||||||
async def async_select_option(self, option: str) -> None:
|
async def async_select_option(self, option: str) -> None:
|
||||||
"""Change the selected option."""
|
"""Change the selected option."""
|
||||||
await self.entity_description.set_value_fn(self.client, 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.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from .entity import CambridgeAudioEntity
|
from .entity import CambridgeAudioEntity, command
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True, kw_only=True)
|
@dataclass(frozen=True, kw_only=True)
|
||||||
@ -73,10 +73,12 @@ class CambridgeAudioSwitch(CambridgeAudioEntity, SwitchEntity):
|
|||||||
"""Return the state of the switch."""
|
"""Return the state of the switch."""
|
||||||
return self.entity_description.value_fn(self.client)
|
return self.entity_description.value_fn(self.client)
|
||||||
|
|
||||||
|
@command
|
||||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||||
"""Turn the switch on."""
|
"""Turn the switch on."""
|
||||||
await self.entity_description.set_value_fn(self.client, True)
|
await self.entity_description.set_value_fn(self.client, True)
|
||||||
|
|
||||||
|
@command
|
||||||
async def async_turn_off(self, **kwargs: Any) -> None:
|
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||||
"""Turn the switch off."""
|
"""Turn the switch off."""
|
||||||
await self.entity_description.set_value_fn(self.client, False)
|
await self.entity_description.set_value_fn(self.client, False)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user