def setup_platform(opp, config, add_entities, discovery_info=None): """Set up the Yeelight Sunflower Light platform.""" host = config.get(CONF_HOST) hub = yeelightsunflower.Hub(host) if not hub.available: _LOGGER.error("Could not connect to Yeelight Sunflower hub") return False add_entities(SunflowerBulb(light) for light in hub.get_lights())
def setup_platform( hass: HomeAssistant, config: ConfigType, add_entities: AddEntitiesCallback, discovery_info: DiscoveryInfoType | None = None, ) -> None: """Set up the Yeelight Sunflower Light platform.""" host = config.get(CONF_HOST) hub = yeelightsunflower.Hub(host) if not hub.available: _LOGGER.error("Could not connect to Yeelight Sunflower hub") return add_entities(SunflowerBulb(light) for light in hub.get_lights())
def setup_platform(hass, config, add_devices, discovery_info=None): """Setup the Yeelight Sunflower Light platform.""" import yeelightsunflower # Assign configuration variables. # The configuration check takes care they are present. host = config.get(CONF_HOST) # Setup connection with Yeelight Sunflower hub hub = yeelightsunflower.Hub(host) # Verify that hub is responsive if not hub.available: _LOGGER.error('Could not connect to Yeelight Sunflower hub') return False # Add devices add_devices(SunflowerBulb(light) for light in hub.get_lights())