def device_info(self) -> DeviceInfo: """Return device information about this Wallbox device.""" return DeviceInfo( identifiers={ ( DOMAIN, self.coordinator.data[CHARGER_DATA_KEY][CHARGER_SERIAL_NUMBER_KEY], ) }, name=f"Wallbox - {self.coordinator.data[CHARGER_NAME_KEY]}", manufacturer="Wallbox", model=self.coordinator.data[CHARGER_DATA_KEY][CHARGER_PART_NUMBER_KEY], sw_version=self.coordinator.data[CHARGER_DATA_KEY][CHARGER_SOFTWARE_KEY][ CHARGER_CURRENT_VERSION_KEY ], )
def async_register_addons_in_dev_reg(entry_id: str, dev_reg: dr.DeviceRegistry, addons: list[dict[str, Any]]) -> None: """Register addons in the device registry.""" for addon in addons: params = DeviceInfo( identifiers={(DOMAIN, addon[ATTR_SLUG])}, model=SupervisorEntityModel.ADDON, sw_version=addon[ATTR_VERSION], name=addon[ATTR_NAME], entry_type=dr.DeviceEntryType.SERVICE, configuration_url= f"homeassistant://hassio/addon/{addon[ATTR_SLUG]}", ) if manufacturer := addon.get(ATTR_REPOSITORY) or addon.get(ATTR_URL): params[ATTR_MANUFACTURER] = manufacturer dev_reg.async_get_or_create(config_entry_id=entry_id, **params)
def device_info(self) -> DeviceInfo: """Return the device_info of the device.""" firmware = self._device_info.firmware sw_version = f"{firmware[FIRMWARE_REVISION]}.{firmware[FIRMWARE_SUB_REVISION]}.{firmware[FIRMWARE_BUILD]}" return DeviceInfo( connections={(dr.CONNECTION_NETWORK_MAC, self._device_info.mac_address)}, identifiers={(DOMAIN, self._device_info.serial_number)}, manufacturer=MANUFACTURER, model=self._device_info.model, name=self._device_info.name, suggested_area=self._room_name, sw_version=sw_version, configuration_url= f"http://{self._device_info.hub_address}/api/shades", )
def __init__(self, coordinator: DataUpdateCoordinator, description: EntityDescription) -> None: """Initialize Flipr sensor.""" super().__init__(coordinator) self.entity_description = description if coordinator.config_entry: flipr_id = coordinator.config_entry.data[CONF_FLIPR_ID] self._attr_unique_id = f"{flipr_id}-{description.key}" self._attr_device_info = DeviceInfo( identifiers={(DOMAIN, flipr_id)}, manufacturer=MANUFACTURER, name=NAME, ) self._attr_name = f"Flipr {flipr_id} {description.name}"
def __init__( self, coordinator: BraviaTVCoordinator, unique_id: str, model: str, ) -> None: """Initialize the entity.""" super().__init__(coordinator) self._attr_unique_id = unique_id self._attr_device_info = DeviceInfo( identifiers={(DOMAIN, unique_id)}, manufacturer=ATTR_MANUFACTURER, model=model, name=f"{ATTR_MANUFACTURER} {model}", )
def __init__( self, coordinator: PhilipsTVDataUpdateCoordinator, ) -> None: """Initialize entity.""" super().__init__(coordinator) self._attr_name = f"{coordinator.system['name']} Screen State" self._attr_icon = "mdi:television-shimmer" self._attr_unique_id = f"{coordinator.unique_id}_screenstate" self._attr_device_info = DeviceInfo( identifiers={ (DOMAIN, coordinator.unique_id), } )
def __init__( self, coordinator: SolarlogData, description: SolarLogSensorEntityDescription, ) -> None: """Initialize the sensor.""" super().__init__(coordinator) self.entity_description = description self._attr_name = f"{coordinator.name} {description.name}" self._attr_unique_id = f"{coordinator.unique_id}_{description.key}" self._attr_device_info = DeviceInfo( identifiers={(DOMAIN, coordinator.unique_id)}, manufacturer="Solar-Log", name=coordinator.name, configuration_url=coordinator.host, )
def device_info(self) -> DeviceInfo: """Return device (service) info.""" # we create a virtual service/device for Hue zones/rooms # so we have a parent for grouped lights and scenes model = self.group.type.value.title() return DeviceInfo( identifiers={(DOMAIN, self.group.id)}, entry_type=DeviceEntryType.SERVICE, name=self.group.metadata.name, manufacturer=self.api.config.bridge_device.product_data. manufacturer_name, model=model, suggested_area=self.group.metadata.name if model == "Room" else None, via_device=(DOMAIN, self.api.config.bridge_device.id), )
def device_info(self) -> DeviceInfo: """Device info.""" unique_id = cast(str, self.config_entry.unique_id) configuration_url = URL.build( scheme=self.config_entry.data[CONF_SSL] and "https" or "http", host=self.config_entry.data[CONF_HOST], port=self.config_entry.data[CONF_PORT], path=self.config_entry.data[CONF_PATH], ) return DeviceInfo( identifiers={(DOMAIN, unique_id)}, manufacturer="OctoPrint", name="OctoPrint", configuration_url=str(configuration_url), )
def __init__( self, name: str, unique_id: str, weather_coordinator: WeatherUpdateCoordinator, ) -> None: """Initialize the sensor.""" self._attr_name = name self._attr_unique_id = unique_id self._attr_device_info = DeviceInfo( entry_type=DeviceEntryType.SERVICE, identifiers={(DOMAIN, unique_id)}, manufacturer=MANUFACTURER, name=DEFAULT_NAME, ) self._weather_coordinator = weather_coordinator
def device_info(self) -> DeviceInfo: """Return the device information.""" return DeviceInfo( identifiers={ ( DOMAIN, f"{self._api.information.serial}_{self.camera_data.id}", ) }, name=self.camera_data.name, model=self.camera_data.model, via_device=( DOMAIN, f"{self._api.information.serial}_{SynoSurveillanceStation.INFO_API_KEY}", ), )
def __init__(self, coordinator, device, device_type): """Initialize the Motion Signal Strength Sensor.""" super().__init__(coordinator) if device_type == TYPE_GATEWAY: name = "Motion gateway signal strength" elif device.device_type in DEVICE_TYPES_WIFI: name = f"{device.blind_type} signal strength" else: name = f"{device.blind_type} {device.mac[12:]} signal strength" self._device = device self._device_type = device_type self._attr_device_info = DeviceInfo(identifiers={(DOMAIN, device.mac)}) self._attr_unique_id = f"{device.mac}-RSSI" self._attr_name = name
def device_info(self) -> DeviceInfo: """Return device information for the ecobee weather platform.""" thermostat = self.data.ecobee.get_thermostat(self._index) model: str | None try: model = f"{ECOBEE_MODEL_TO_NAME[thermostat['modelNumber']]} Thermostat" except KeyError: # Ecobee model is not in our list model = None return DeviceInfo( identifiers={(DOMAIN, thermostat["identifier"])}, manufacturer=MANUFACTURER, model=model, name=self.name, )
def device_info(self) -> DeviceInfo: """Device information.""" info = DeviceInfo( identifiers={(DOMAIN, self._device.uuid)}, manufacturer="Awair", model=self._device.model, ) if self._device.name: info[ATTR_NAME] = self._device.name if self._device.mac_address: info[ATTR_CONNECTIONS] = {(dr.CONNECTION_NETWORK_MAC, self._device.mac_address)} return info
def device_info(self) -> DeviceInfo: """Return information about the device.""" return DeviceInfo( identifiers={(DOMAIN, self.soco.uid)}, name=self.speaker.zone_name, model=self.speaker.model_name.replace("Sonos ", ""), sw_version=self.speaker.version, connections={ (dr.CONNECTION_NETWORK_MAC, self.speaker.mac_address), (dr.CONNECTION_UPNP, f"uuid:{self.speaker.uid}"), }, manufacturer="Sonos", suggested_area=self.speaker.zone_name, configuration_url= f"http://{self.soco.ip_address}:1400/support/review", )
def __init__(self, config_entry: ConfigEntry, client: ZwaveClient, node: ZwaveNode) -> None: """Initialize a generic Z-Wave device entity.""" self.config_entry = config_entry self.client = client self.node = node name: str = (self.node.name or self.node.device_config.description or f"Node {self.node.node_id}") # Entity class attributes self._attr_name = f"{name}: Node Status" self._base_unique_id = get_valueless_base_unique_id(client, node) self._attr_unique_id = f"{self._base_unique_id}.node_status" # device is precreated in main handler self._attr_device_info = DeviceInfo( identifiers={get_device_id(self.client, self.node)}, ) self._attr_native_value: str = node.status.name.lower()
def __init__(self, coordinator: DataUpdateCoordinator, device: Device, device_name: str) -> None: """Initialize a devolo home network device.""" super().__init__(coordinator) self.device = device self._attr_device_info = DeviceInfo( configuration_url=f"http://{device.ip}", identifiers={(DOMAIN, str(device.serial_number))}, manufacturer="devolo", model=device.product, name=device_name, sw_version=device.firmware_version, ) self._attr_unique_id = f"{device.serial_number}_{self.entity_description.key}"
def __init__(self, service: dict[str, Any], description: SensorValueEntityDescription) -> None: """Initialize the sensor.""" super().__init__(service["coordinator"]) self.entity_description = description self._attr_unique_id = f"{service[SERVICE_ID]}:{description.key}" self._attr_name = f"{service['name']} {description.name}" self._attr_device_info = DeviceInfo( entry_type=DeviceEntryType.SERVICE, identifiers={(DOMAIN, service[SERVICE_ID])}, manufacturer="Aussie Broadband", configuration_url= f"https://my.aussiebroadband.com.au/#/{service['name'].lower()}/{service[SERVICE_ID]}/", name=service["description"], model=service["name"], )
def __init__( self, coordinator: PhilipsTVDataUpdateCoordinator, ) -> None: """Initialize entity.""" super().__init__(coordinator) self._attr_name = f"{coordinator.system['name']} Ambilight+Hue" self._attr_icon = "mdi:television-ambient-light" self._attr_unique_id = f"{coordinator.unique_id}_ambi_hue" self._attr_device_info = DeviceInfo( identifiers={ (DOMAIN, coordinator.unique_id), } )
def device_info(self) -> DeviceInfo: """Return device information.""" identifier, name = node_device_id_and_name( self.node, self.values.primary.instance ) info = DeviceInfo( name=name, identifiers={identifier}, manufacturer=self.node.manufacturer_name, model=self.node.product_name, ) if self.values.primary.instance > 1: info[ATTR_VIA_DEVICE] = (DOMAIN, self.node_id) elif self.node_id > 1: info[ATTR_VIA_DEVICE] = (DOMAIN, 1) return info
def __init__(self, hass, entry, client, devtype, num=None): """Initialize the spa entity.""" self._client = client self._device_name = self._client.get_model_name() self._type = devtype self._num = num self._entry = entry self._attr_unique_id = f'{self._device_name}-{self._type}{self._num or ""}-{self._client.get_macaddr().replace(":","")[-6:]}' self._attr_name = f'{self._device_name}: {self._type}{self._num or ""}' self._attr_device_info = DeviceInfo( name=self._device_name, manufacturer="Balboa Water Group", model=self._client.get_model_name(), sw_version=self._client.get_ssid(), connections={(CONNECTION_NETWORK_MAC, self._client.get_macaddr())}, )
def __init__(self, nanoleaf: Nanoleaf) -> None: """Initialize an Nanoleaf light.""" self._nanoleaf = nanoleaf self._attr_unique_id = self._nanoleaf.serial_no self._attr_name = self._nanoleaf.name self._attr_device_info = DeviceInfo( identifiers={(DOMAIN, self._nanoleaf.serial_no)}, name=self._nanoleaf.name, manufacturer=self._nanoleaf.manufacturer, model=self._nanoleaf.model, sw_version=self._nanoleaf.firmware_version, ) self._attr_min_mireds = math.ceil(1000000 / self._nanoleaf.color_temperature_max) self._attr_max_mireds = kelvin_to_mired( self._nanoleaf.color_temperature_min)
def device_info(self) -> DeviceInfo: """Return the device_info of the device.""" return DeviceInfo( identifiers={( DOMAIN, self._controller.serial_number, )}, connections={( device_registry.CONNECTION_NETWORK_MAC, self._controller.mac_address, )}, name=self._controller.name, model=self._controller.model, manufacturer=DEFAULT_NAME, configuration_url="https://app.rach.io", )
def __init__( self, entry_id: str, bsblan: BSBLan, info: Info, ) -> None: """Initialize BSBLan climate device.""" self._attr_available = True self._store_hvac_mode = None self.bsblan = bsblan self._attr_name = self._attr_unique_id = info.device_identification self._attr_device_info = DeviceInfo( identifiers={(DOMAIN, info.device_identification)}, manufacturer="BSBLan", model=info.controller_variant, name="BSBLan Device", )
def __init__(self, quasar: YandexQuasar, device: dict): self.quasar = quasar self.device = device self._attr_entity_registry_enabled_default = False self._attr_icon = "mdi:equalizer" self._attr_name = device['name'] + " Эквалайзер" self._attr_options = [i[1] for i in PRESETS] self._attr_unique_id = device['quasar_info']['device_id'] + "_equalizer" self._attr_device_info = DeviceInfo( identifiers={(DOMAIN, device['quasar_info']['device_id'])}, name=self.device['name'], ) self.entity_id = "media_player.yandex_station_" + \ self._attr_unique_id.lower() + "_equalizer"
def device_info(self) -> DeviceInfo: """Return device information for the controller.""" controller_type = self.config_data["controller_type"] hardware_type = self.config_data["hardware_type"] try: equipment_model = EQUIPMENT.CONTROLLER_HARDWARE[controller_type][ hardware_type ] except KeyError: equipment_model = f"Unknown Model C:{controller_type} H:{hardware_type}" return DeviceInfo( connections={(dr.CONNECTION_NETWORK_MAC, self.mac)}, manufacturer="Pentair", model=equipment_model, name=self.gateway_name, sw_version=self.gateway.version, )
def device_info(self) -> DeviceInfo: """Return the device info.""" device: TailscaleDevice = self.coordinator.data[self.device_id] configuration_url = "https://login.tailscale.com/admin/machines/" if device.addresses: configuration_url += device.addresses[0] return DeviceInfo( configuration_url=configuration_url, entry_type=DeviceEntryType.SERVICE, identifiers={(DOMAIN, device.device_id)}, manufacturer="Tailscale Inc.", model=device.os, name=device.name.split(".")[0], sw_version=device.client_version, )
def __init__( self, bridge: SamsungTVBridge, config_entry: ConfigEntry, on_script: Script | None, ) -> None: """Initialize the Samsung device.""" self._config_entry = config_entry self._host: str | None = config_entry.data[CONF_HOST] self._mac: str | None = config_entry.data.get(CONF_MAC) self._on_script = on_script # Assume that the TV is in Play mode self._playing: bool = True self._attr_name: str | None = config_entry.data.get(CONF_NAME) self._attr_state: str | None = None self._attr_unique_id = config_entry.unique_id self._attr_is_volume_muted: bool = False self._attr_device_class = MediaPlayerDeviceClass.TV self._attr_source_list = list(SOURCES) self._app_list: dict[str, str] | None = None self._app_list_event: asyncio.Event = asyncio.Event() self._attr_supported_features = SUPPORT_SAMSUNGTV if self._on_script or self._mac: # Add turn-on if on_script or mac is available self._attr_supported_features |= SUPPORT_TURN_ON self._attr_device_info = DeviceInfo( name=self.name, manufacturer=config_entry.data.get(CONF_MANUFACTURER), model=config_entry.data.get(CONF_MODEL), ) if self.unique_id: self._attr_device_info["identifiers"] = {(DOMAIN, self.unique_id)} if self._mac: self._attr_device_info["connections"] = {(CONNECTION_NETWORK_MAC, self._mac)} # Mark the end of a shutdown command (need to wait 15 seconds before # sending the next command to avoid turning the TV back ON). self._end_of_power_off: datetime | None = None self._bridge = bridge self._auth_failed = False self._bridge.register_reauth_callback(self.access_denied) self._bridge.register_app_list_callback(self._app_list_callback)
def device_info(self) -> DeviceInfo | None: """Return device information about the application.""" if self._device_id is None: return None configuration_url = "https://" if self.sonarr.tls else "http://" configuration_url += f"{self.sonarr.host}:{self.sonarr.port}" configuration_url += self.sonarr.base_path.replace("/api", "") return DeviceInfo( identifiers={(DOMAIN, self._device_id)}, name="Activity Sensor", manufacturer="Sonarr", sw_version=self.sonarr.app.info.version, entry_type=DeviceEntryType.SERVICE, configuration_url=configuration_url, )
def __init__(self, slimserver: SlimServer, player: SlimClient) -> None: """Initialize MediaPlayer entity.""" self.slimserver = slimserver self.player = player self._attr_unique_id = player.player_id self._attr_device_info = DeviceInfo( identifiers={(DOMAIN, self.player.player_id)}, manufacturer=DEFAULT_NAME, model=self.player.device_model or self.player.device_type, name=self.player.name, hw_version=self.player.firmware, ) # PiCore + SqueezeESP32 player has web interface if "-pCP" in self.player.firmware or self.player.device_model == "SqueezeESP32": self._attr_device_info[ "configuration_url"] = f"http://{self.player.device_address}" self.update_attributes()