1 """Sensor platform for Kaleidescape integration."""
3 from __future__
import annotations
5 from typing
import TYPE_CHECKING
7 from kaleidescape
import const
as kaleidescape_const
12 from .const
import DOMAIN
as KALEIDESCAPE_DOMAIN
13 from .entity
import KaleidescapeEntity
16 from collections.abc
import Iterable
17 from typing
import Any
25 hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
27 """Set up the platform from a config entry."""
48 """Representation of a Kaleidescape device."""
54 """Return true if device is on."""
55 return self.
_device_device.power.state == kaleidescape_const.DEVICE_POWER_STATE_ON
58 """Turn the device on."""
59 await self.
_device_device.leave_standby()
62 """Turn the device off."""
63 await self.
_device_device.enter_standby()
66 """Send a command to a device."""
68 if cmd
not in VALID_COMMANDS:
70 await getattr(self.
_device_device, cmd)()
None async_turn_on(self, **Any kwargs)
None async_turn_off(self, **Any kwargs)
None async_send_command(self, Iterable[str] command, **Any kwargs)
None async_setup_entry(HomeAssistant hass, ConfigEntry entry, AddEntitiesCallback async_add_entities)