1 """Philips TV menu switches."""
3 from __future__
import annotations
11 from .
import PhilipsTVConfigEntry
12 from .coordinator
import PhilipsTVDataUpdateCoordinator
13 from .entity
import PhilipsJsEntity
21 config_entry: PhilipsTVConfigEntry,
22 async_add_entities: AddEntitiesCallback,
24 """Set up the configuration entry."""
25 coordinator = config_entry.runtime_data
29 if coordinator.api.json_feature_supported(
"ambilight",
"Hue"):
34 """A Philips TV screen state switch."""
36 _attr_translation_key =
"screen_state"
40 coordinator: PhilipsTVDataUpdateCoordinator,
42 """Initialize entity."""
50 """Return true if entity is available."""
51 if not super().available:
53 if not self.coordinator.api.on:
55 return self.coordinator.api.powerstate ==
"On"
59 """Return True if entity is on."""
60 return self.coordinator.api.screenstate ==
"On"
63 """Turn the entity on."""
64 await self.coordinator.api.setScreenState(
"On")
67 """Turn the entity off."""
68 await self.coordinator.api.setScreenState(
"Off")
72 """A Philips TV Ambi+Hue switch."""
74 _attr_translation_key =
"ambilight_hue"
78 coordinator: PhilipsTVDataUpdateCoordinator,
80 """Initialize entity."""
88 """Return true if entity is available."""
89 if not super().available:
91 if not self.coordinator.api.on:
93 return self.coordinator.api.powerstate ==
"On"
97 """Return True if entity is on."""
98 return self.coordinator.api.huelamp_power == HUE_POWER_ON
101 """Turn the entity on."""
102 await self.coordinator.api.setHueLampPower(HUE_POWER_ON)
106 """Turn the entity off."""
107 await self.coordinator.api.setHueLampPower(HUE_POWER_OFF)
None __init__(self, PhilipsTVDataUpdateCoordinator coordinator)
None async_turn_off(self, **Any kwargs)
None async_turn_on(self, **Any kwargs)
None async_turn_off(self, **Any kwargs)
None __init__(self, PhilipsTVDataUpdateCoordinator coordinator)
None async_turn_on(self, **Any kwargs)
None async_write_ha_state(self)
None async_setup_entry(HomeAssistant hass, PhilipsTVConfigEntry config_entry, AddEntitiesCallback async_add_entities)