1 """Support for the light on the Sisyphus Kinetic Art Table."""
3 from __future__
import annotations
17 from .
import DATA_SISYPHUS
19 _LOGGER = logging.getLogger(__name__)
25 add_entities: AddEntitiesCallback,
26 discovery_info: DiscoveryInfoType |
None =
None,
28 """Set up a single Sisyphus table."""
29 if not discovery_info:
31 host = discovery_info[CONF_HOST]
33 table_holder = hass.data[DATA_SISYPHUS][host]
34 table = await table_holder.get_table()
35 except aiohttp.ClientError
as err:
36 raise PlatformNotReady
from err
42 """Representation of a Sisyphus table as a light."""
44 _attr_color_mode = ColorMode.BRIGHTNESS
45 _attr_supported_color_modes = {ColorMode.BRIGHTNESS}
48 """Initialize the Sisyphus table."""
53 """Add listeners after this object has been initialized."""
57 """Force update the table state."""
58 await self.
_table_table.refresh()
62 """Return true if the table is responding to heartbeats."""
63 return self.
_table_table.is_connected
67 """Return the UUID of the table."""
68 return self.
_table_table.id
72 """Return the ame of the table."""
73 return self.
_name_name
77 """Return True if the table is on."""
78 return not self.
_table_table.is_sleeping
82 """Return the current brightness of the table's ring light."""
83 return self.
_table_table.brightness * 255
86 """Put the table to sleep."""
87 await self.
_table_table.sleep()
88 _LOGGER.debug(
"Sisyphus table %s: sleep")
91 """Wake up the table if necessary, optionally changes brightness."""
93 await self.
_table_table.wakeup()
94 _LOGGER.debug(
"Sisyphus table %s: wakeup")
96 if "brightness" in kwargs:
97 await self.
_table_table.set_brightness(kwargs[
"brightness"] / 255.0)
None async_turn_off(self, **Any kwargs)
None async_turn_on(self, **Any kwargs)
None async_added_to_hass(self)
def __init__(self, name, table)
None async_write_ha_state(self)
None add_entities(AsusWrtRouter router, AddEntitiesCallback async_add_entities, set[str] tracked)
None async_setup_platform(HomeAssistant hass, ConfigType config, AddEntitiesCallback add_entities, DiscoveryInfoType|None discovery_info=None)