def __init__(self, coordinator: DahuaDataUpdateCoordinator, config_entry): DahuaBaseEntity.__init__(self, coordinator, config_entry) SelectEntity.__init__(self) self._coordinator = coordinator self._attr_name = f"{coordinator.get_device_name()} Security Light" self._attr_unique_id = f"{coordinator.get_serial_number()}_security_light" self._attr_options = ["Off", "On", "Strobe"]
def __init__(self, data_handler: NetatmoDataHandler, home_id: str, options: list) -> None: """Initialize the select entity.""" SelectEntity.__init__(self) super().__init__(data_handler) self._home_id = home_id self._data_classes.extend([ { "name": HOMEDATA_DATA_CLASS_NAME, SIGNAL_NAME: HOMEDATA_DATA_CLASS_NAME, }, ]) self._device_name = self._data.homes[home_id]["name"] self._attr_name = f"{MANUFACTURER} {self._device_name}" self._model: str = "NATherm1" self._attr_unique_id = f"{self._home_id}-schedule-select" self._attr_current_option = self._data._get_selected_schedule( home_id=self._home_id).get("name") self._attr_options = options
def __init__(self, hass, config, config_entry, discovery_data): """Initialize the MQTT select.""" self._config = config self._optimistic = False self._sub_state = None self._attr_current_option = None SelectEntity.__init__(self) MqttEntity.__init__(self, hass, config, config_entry, discovery_data)
def __init__(self, hass: HomeAssistant, client: VisonicClient, visonic_device: PySensorDevice): """Initialize the visonic binary sensor arm/bypass select entity.""" SelectEntity.__init__(self) #_LOGGER.debug("Creating select entity for %s",visonic_device.getDeviceName()) self.hass = hass self._client = client self._visonic_device = visonic_device self._name = "visonic_" + self._visonic_device.getDeviceName().lower() self._visonic_id = slugify(self._name) self._is_available = self._visonic_device.isEnrolled() self._is_armed = not self._visonic_device.isBypass() self._pending_state_is_armed = None self._lastSendOfCommand = None
def __init__( self, coordinator: EufySecurityDataUpdateCoordinator, config_entry: ConfigEntry, device: Device, id: str, description: str, key: str, entity_category: str, ): EufySecurityEntity.__init__(self, coordinator, config_entry, device) SelectEntity.__init__(self) self._id = id self.description = description self.key = key self.metadata = get_child_value(self.device.properties_metadata, self.key) _LOGGER.debug( f"{DOMAIN} - {self.device.name} - {self.id} - select init - {self.metadata}" ) self.states = self.metadata.get("states", {}) if len(self.states) == 0: min_value = self.metadata.get("min", 0) max_value = self.metadata.get("max", 0) self.states = { str(i): str(i) for i in range(min_value, max_value + 1) } self.values_to_states = self.states self.states_to_values = { v: k for k, v in self.values_to_states.items() } self._attr_options: list[str] = list(self.values_to_states.values()) self._attr_entity_category = entity_category _LOGGER.debug( f"{DOMAIN} - {self.device.name} - {self.id} - select init - {self.values_to_states} - {self.states_to_values}" ) current_value = str(get_child_value(self.device.state, self.key)) current_option = self.values_to_states.get(current_value, None) if current_option is None: _LOGGER.error( f"{DOMAIN} - {self.device.name} - {self.id} - select init missing value error - value: {current_value} - values_to_states: {self.values_to_states} - states_to_values: {self.states_to_values}" )
def __init__(self, data_handler: NetatmoDataHandler, home_id: str, options: list) -> None: """Initialize the select entity.""" SelectEntity.__init__(self) super().__init__(data_handler) self._home_id = home_id self._climate_state_class = f"{CLIMATE_STATE_CLASS_NAME}-{self._home_id}" self._climate_state: pyatmo.AsyncClimate = data_handler.data[ self._climate_state_class] self._home = self._climate_state.homes[self._home_id] self._data_classes.extend([ { "name": CLIMATE_TOPOLOGY_CLASS_NAME, SIGNAL_NAME: CLIMATE_TOPOLOGY_CLASS_NAME, }, { "name": CLIMATE_STATE_CLASS_NAME, "home_id": self._home_id, SIGNAL_NAME: self._climate_state_class, }, ]) self._device_name = self._home.name self._attr_name = f"{MANUFACTURER} {self._device_name}" self._model: str = "NATherm1" self._netatmo_type = TYPE_ENERGY self._attr_unique_id = f"{self._home_id}-schedule-select" self._attr_current_option = getattr(self._home.get_selected_schedule(), "name") self._attr_options = options