Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add action exceptions to Cambridge Audio #131597

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion homeassistant/components/cambridge_audio/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
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)
Expand Down Expand Up @@ -116,6 +116,7 @@ def current_option(self) -> str | None:
"""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)
4 changes: 3 additions & 1 deletion homeassistant/components/cambridge_audio/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
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)
Expand Down Expand Up @@ -73,10 +73,12 @@ def is_on(self) -> bool:
"""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)