1 """Support for Tellstick lights using Tellstick Net."""
13 from .const
import DOMAIN, TELLDUS_DISCOVERY_NEW
14 from .entity
import TelldusLiveEntity
16 _LOGGER = logging.getLogger(__name__)
21 config_entry: ConfigEntry,
22 async_add_entities: AddEntitiesCallback,
24 """Set up tellduslive sensors dynamically."""
26 async
def async_discover_light(device_id):
27 """Discover and add a discovered sensor."""
28 client = hass.data[DOMAIN]
33 TELLDUS_DISCOVERY_NEW.format(light.DOMAIN, DOMAIN),
39 """Representation of a Tellstick Net light."""
42 _attr_color_mode = ColorMode.BRIGHTNESS
43 _attr_supported_color_modes = {ColorMode.BRIGHTNESS}
46 """Initialize the Tellstick Net light."""
51 """Define a property of the device that might have changed."""
57 """Return the brightness of this light between 0..255."""
58 return self.
devicedevice.dim_level
62 """Return true if light is on."""
63 return self.
devicedevice.is_on
66 """Turn the light on."""
67 brightness = kwargs.get(ATTR_BRIGHTNESS, self.
_last_brightness_last_brightness)
69 fallback_brightness = 100
71 "Setting brightness to %d%%, because it was 0", fallback_brightness
73 brightness =
int(fallback_brightness * 255 / 100)
74 self.
devicedevice.dim(level=brightness)
78 """Turn the light off."""
int|None brightness(self)
None turn_on(self, **Any kwargs)
None turn_off(self, **Any kwargs)
def __init__(self, client, device_id)
None schedule_update_ha_state(self, bool force_refresh=False)
None async_setup_entry(HomeAssistant hass, ConfigEntry config_entry, AddEntitiesCallback async_add_entities)
Callable[[], None] async_dispatcher_connect(HomeAssistant hass, str signal, Callable[..., Any] target)