mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Use DeviceInfo Class I-K (#58300)
This commit is contained in:
parent
b52c5c82b1
commit
05671557f0
@ -4,6 +4,7 @@ from homeassistant.components.alarm_control_panel.const import (
|
|||||||
SUPPORT_ALARM_ARM_AWAY,
|
SUPPORT_ALARM_ARM_AWAY,
|
||||||
SUPPORT_ALARM_ARM_HOME,
|
SUPPORT_ALARM_ARM_HOME,
|
||||||
)
|
)
|
||||||
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||||
|
|
||||||
from .const import DATA_COORDINATOR, DOMAIN
|
from .const import DATA_COORDINATOR, DOMAIN
|
||||||
@ -19,13 +20,13 @@ class IAlarmPanel(CoordinatorEntity, AlarmControlPanelEntity):
|
|||||||
"""Representation of an iAlarm device."""
|
"""Representation of an iAlarm device."""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_info(self):
|
def device_info(self) -> DeviceInfo:
|
||||||
"""Return device info for this device."""
|
"""Return device info for this device."""
|
||||||
return {
|
return DeviceInfo(
|
||||||
"identifiers": {(DOMAIN, self.unique_id)},
|
identifiers={(DOMAIN, self.unique_id)},
|
||||||
"name": self.name,
|
manufacturer="Antifurto365 - Meian",
|
||||||
"manufacturer": "Antifurto365 - Meian",
|
name=self.name,
|
||||||
}
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def unique_id(self):
|
def unique_id(self):
|
||||||
|
@ -240,8 +240,8 @@ class AqualinkEntity(Entity):
|
|||||||
"""Return the device info."""
|
"""Return the device info."""
|
||||||
return DeviceInfo(
|
return DeviceInfo(
|
||||||
identifiers={(DOMAIN, self.unique_id)},
|
identifiers={(DOMAIN, self.unique_id)},
|
||||||
name=self.name,
|
|
||||||
model=self.dev.__class__.__name__.replace("Aqualink", ""),
|
|
||||||
manufacturer="Jandy",
|
manufacturer="Jandy",
|
||||||
|
model=self.dev.__class__.__name__.replace("Aqualink", ""),
|
||||||
|
name=self.name,
|
||||||
via_device=(DOMAIN, self.dev.system.serial),
|
via_device=(DOMAIN, self.dev.system.serial),
|
||||||
)
|
)
|
||||||
|
@ -115,12 +115,12 @@ class IcloudTrackerEntity(TrackerEntity):
|
|||||||
@property
|
@property
|
||||||
def device_info(self) -> DeviceInfo:
|
def device_info(self) -> DeviceInfo:
|
||||||
"""Return the device information."""
|
"""Return the device information."""
|
||||||
return {
|
return DeviceInfo(
|
||||||
"identifiers": {(DOMAIN, self._device.unique_id)},
|
identifiers={(DOMAIN, self._device.unique_id)},
|
||||||
"name": self._device.name,
|
manufacturer="Apple",
|
||||||
"manufacturer": "Apple",
|
model=self._device.device_model,
|
||||||
"model": self._device.device_model,
|
name=self._device.name,
|
||||||
}
|
)
|
||||||
|
|
||||||
async def async_added_to_hass(self):
|
async def async_added_to_hass(self):
|
||||||
"""Register state update callback."""
|
"""Register state update callback."""
|
||||||
|
@ -93,12 +93,12 @@ class IcloudDeviceBatterySensor(SensorEntity):
|
|||||||
@property
|
@property
|
||||||
def device_info(self) -> DeviceInfo:
|
def device_info(self) -> DeviceInfo:
|
||||||
"""Return the device information."""
|
"""Return the device information."""
|
||||||
return {
|
return DeviceInfo(
|
||||||
"identifiers": {(DOMAIN, self._device.unique_id)},
|
identifiers={(DOMAIN, self._device.unique_id)},
|
||||||
"name": self._device.name,
|
manufacturer="Apple",
|
||||||
"manufacturer": "Apple",
|
model=self._device.device_model,
|
||||||
"model": self._device.device_model,
|
name=self._device.name,
|
||||||
}
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def should_poll(self) -> bool:
|
def should_poll(self) -> bool:
|
||||||
|
@ -83,10 +83,10 @@ class InsteonEntity(Entity):
|
|||||||
"""Return device information."""
|
"""Return device information."""
|
||||||
return DeviceInfo(
|
return DeviceInfo(
|
||||||
identifiers={(DOMAIN, str(self._insteon_device.address))},
|
identifiers={(DOMAIN, str(self._insteon_device.address))},
|
||||||
name=f"{self._insteon_device.description} {self._insteon_device.address}",
|
|
||||||
model=f"{self._insteon_device.model} ({self._insteon_device.cat!r}, 0x{self._insteon_device.subcat:02x})",
|
|
||||||
sw_version=f"{self._insteon_device.firmware:02x} Engine Version: {self._insteon_device.engine_version}",
|
|
||||||
manufacturer="Smart Home",
|
manufacturer="Smart Home",
|
||||||
|
model=f"{self._insteon_device.model} ({self._insteon_device.cat!r}, 0x{self._insteon_device.subcat:02x})",
|
||||||
|
name=f"{self._insteon_device.description} {self._insteon_device.address}",
|
||||||
|
sw_version=f"{self._insteon_device.firmware:02x} Engine Version: {self._insteon_device.engine_version}",
|
||||||
via_device=(DOMAIN, str(devices.modem.address)),
|
via_device=(DOMAIN, str(devices.modem.address)),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ from homeassistant.components.sensor import SensorEntity, SensorEntityDescriptio
|
|||||||
from homeassistant.const import PERCENTAGE
|
from homeassistant.const import PERCENTAGE
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
from homeassistant.helpers.icon import icon_for_battery_level
|
from homeassistant.helpers.icon import icon_for_battery_level
|
||||||
|
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
@ -59,20 +60,20 @@ class IOSSensor(SensorEntity):
|
|||||||
self._attr_unique_id = f"{description.key}_{device_id}"
|
self._attr_unique_id = f"{description.key}_{device_id}"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_info(self):
|
def device_info(self) -> DeviceInfo:
|
||||||
"""Return information about the device."""
|
"""Return information about the device."""
|
||||||
return {
|
return DeviceInfo(
|
||||||
"identifiers": {
|
identifiers={
|
||||||
(
|
(
|
||||||
ios.DOMAIN,
|
ios.DOMAIN,
|
||||||
self._device[ios.ATTR_DEVICE][ios.ATTR_DEVICE_PERMANENT_ID],
|
self._device[ios.ATTR_DEVICE][ios.ATTR_DEVICE_PERMANENT_ID],
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
"name": self._device[ios.ATTR_DEVICE][ios.ATTR_DEVICE_NAME],
|
manufacturer="Apple",
|
||||||
"manufacturer": "Apple",
|
model=self._device[ios.ATTR_DEVICE][ios.ATTR_DEVICE_TYPE],
|
||||||
"model": self._device[ios.ATTR_DEVICE][ios.ATTR_DEVICE_TYPE],
|
name=self._device[ios.ATTR_DEVICE][ios.ATTR_DEVICE_NAME],
|
||||||
"sw_version": self._device[ios.ATTR_DEVICE][ios.ATTR_DEVICE_SYSTEM_VERSION],
|
sw_version=self._device[ios.ATTR_DEVICE][ios.ATTR_DEVICE_SYSTEM_VERSION],
|
||||||
}
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def extra_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
|
@ -191,15 +191,13 @@ class IotaWattSensor(update_coordinator.CoordinatorEntity, SensorEntity):
|
|||||||
return self._sensor_data.getName()
|
return self._sensor_data.getName()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_info(self) -> entity.DeviceInfo | None:
|
def device_info(self) -> entity.DeviceInfo:
|
||||||
"""Return device info."""
|
"""Return device info."""
|
||||||
return {
|
return entity.DeviceInfo(
|
||||||
"connections": {
|
connections={(CONNECTION_NETWORK_MAC, self._sensor_data.hub_mac_address)},
|
||||||
(CONNECTION_NETWORK_MAC, self._sensor_data.hub_mac_address)
|
manufacturer="IoTaWatt",
|
||||||
},
|
model="IoTaWatt",
|
||||||
"manufacturer": "IoTaWatt",
|
)
|
||||||
"model": "IoTaWatt",
|
|
||||||
}
|
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def _handle_coordinator_update(self) -> None:
|
def _handle_coordinator_update(self) -> None:
|
||||||
|
@ -1,13 +1,6 @@
|
|||||||
"""Entities for The Internet Printing Protocol (IPP) integration."""
|
"""Entities for The Internet Printing Protocol (IPP) integration."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from homeassistant.const import (
|
|
||||||
ATTR_IDENTIFIERS,
|
|
||||||
ATTR_MANUFACTURER,
|
|
||||||
ATTR_MODEL,
|
|
||||||
ATTR_NAME,
|
|
||||||
ATTR_SW_VERSION,
|
|
||||||
)
|
|
||||||
from homeassistant.helpers.entity import DeviceInfo
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||||
|
|
||||||
@ -37,15 +30,15 @@ class IPPEntity(CoordinatorEntity):
|
|||||||
self._attr_entity_registry_enabled_default = enabled_default
|
self._attr_entity_registry_enabled_default = enabled_default
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_info(self) -> DeviceInfo:
|
def device_info(self) -> DeviceInfo | None:
|
||||||
"""Return device information about this IPP device."""
|
"""Return device information about this IPP device."""
|
||||||
if self._device_id is None:
|
if self._device_id is None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
return {
|
return DeviceInfo(
|
||||||
ATTR_IDENTIFIERS: {(DOMAIN, self._device_id)},
|
identifiers={(DOMAIN, self._device_id)},
|
||||||
ATTR_NAME: self.coordinator.data.info.name,
|
manufacturer=self.coordinator.data.info.manufacturer,
|
||||||
ATTR_MANUFACTURER: self.coordinator.data.info.manufacturer,
|
model=self.coordinator.data.info.model,
|
||||||
ATTR_MODEL: self.coordinator.data.info.model,
|
name=self.coordinator.data.info.name,
|
||||||
ATTR_SW_VERSION: self.coordinator.data.info.version,
|
sw_version=self.coordinator.data.info.version,
|
||||||
}
|
)
|
||||||
|
@ -161,12 +161,12 @@ class ControllerDevice(ClimateEntity):
|
|||||||
self._fan_to_pizone[_IZONE_FAN_TO_HA[fan]] = fan
|
self._fan_to_pizone[_IZONE_FAN_TO_HA[fan]] = fan
|
||||||
self._available = True
|
self._available = True
|
||||||
|
|
||||||
self._device_info = {
|
self._attr_device_info = DeviceInfo(
|
||||||
"identifiers": {(IZONE, self.unique_id)},
|
identifiers={(IZONE, self.unique_id)},
|
||||||
"name": self.name,
|
manufacturer="IZone",
|
||||||
"manufacturer": "IZone",
|
model=self._controller.sys_type,
|
||||||
"model": self._controller.sys_type,
|
name=self.name,
|
||||||
}
|
)
|
||||||
|
|
||||||
# Create the zones
|
# Create the zones
|
||||||
self.zones = {}
|
self.zones = {}
|
||||||
@ -246,11 +246,6 @@ class ControllerDevice(ClimateEntity):
|
|||||||
for zone in self.zones.values():
|
for zone in self.zones.values():
|
||||||
zone.async_schedule_update_ha_state()
|
zone.async_schedule_update_ha_state()
|
||||||
|
|
||||||
@property
|
|
||||||
def device_info(self):
|
|
||||||
"""Return the device info for the iZone system."""
|
|
||||||
return self._device_info
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def unique_id(self):
|
def unique_id(self):
|
||||||
"""Return the ID of the controller device."""
|
"""Return the ID of the controller device."""
|
||||||
@ -484,12 +479,12 @@ class ZoneDevice(ClimateEntity):
|
|||||||
}
|
}
|
||||||
self._supported_features |= SUPPORT_TARGET_TEMPERATURE
|
self._supported_features |= SUPPORT_TARGET_TEMPERATURE
|
||||||
|
|
||||||
self._device_info = DeviceInfo(
|
self._attr_device_info = DeviceInfo(
|
||||||
identifiers={(IZONE, controller.unique_id, zone.index)},
|
identifiers={(IZONE, controller.unique_id, zone.index)},
|
||||||
name=self.name,
|
|
||||||
manufacturer="IZone",
|
manufacturer="IZone",
|
||||||
via_device=(IZONE, controller.unique_id),
|
|
||||||
model=zone.type.name.title(),
|
model=zone.type.name.title(),
|
||||||
|
name=self.name,
|
||||||
|
via_device=(IZONE, controller.unique_id),
|
||||||
)
|
)
|
||||||
|
|
||||||
async def async_added_to_hass(self):
|
async def async_added_to_hass(self):
|
||||||
@ -517,11 +512,6 @@ class ZoneDevice(ClimateEntity):
|
|||||||
"""Return True if unable to access real state of the entity."""
|
"""Return True if unable to access real state of the entity."""
|
||||||
return self._controller.assumed_state
|
return self._controller.assumed_state
|
||||||
|
|
||||||
@property
|
|
||||||
def device_info(self):
|
|
||||||
"""Return the device info for the iZone system."""
|
|
||||||
return self._device_info
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def unique_id(self):
|
def unique_id(self):
|
||||||
"""Return the ID of the controller device."""
|
"""Return the ID of the controller device."""
|
||||||
|
@ -24,8 +24,8 @@ class JuiceNetDevice(CoordinatorEntity):
|
|||||||
def device_info(self) -> DeviceInfo:
|
def device_info(self) -> DeviceInfo:
|
||||||
"""Return device information about this JuiceNet Device."""
|
"""Return device information about this JuiceNet Device."""
|
||||||
return DeviceInfo(
|
return DeviceInfo(
|
||||||
identifiers={(DOMAIN, self.device.id)},
|
|
||||||
name=self.device.name,
|
|
||||||
manufacturer="JuiceNet",
|
|
||||||
configuration_url=f"https://home.juice.net/Portal/Details?unitID={self.device.id}",
|
configuration_url=f"https://home.juice.net/Portal/Details?unitID={self.device.id}",
|
||||||
|
identifiers={(DOMAIN, self.device.id)},
|
||||||
|
manufacturer="JuiceNet",
|
||||||
|
name=self.device.name,
|
||||||
)
|
)
|
||||||
|
@ -26,6 +26,7 @@ from homeassistant.helpers import entity_registry
|
|||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
|
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
import homeassistant.util.dt as dt_util
|
import homeassistant.util.dt as dt_util
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
@ -217,17 +218,13 @@ class KeeneticTracker(ScannerEntity):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_info(self):
|
def device_info(self) -> DeviceInfo:
|
||||||
"""Return a client description for device registry."""
|
"""Return a client description for device registry."""
|
||||||
info = {
|
return DeviceInfo(
|
||||||
"connections": {(CONNECTION_NETWORK_MAC, self._device.mac)},
|
connections={(CONNECTION_NETWORK_MAC, self._device.mac)},
|
||||||
"identifiers": {(DOMAIN, self._device.mac)},
|
identifiers={(DOMAIN, self._device.mac)},
|
||||||
}
|
name=self._device.name if self._device.name else None,
|
||||||
|
)
|
||||||
if self._device.name:
|
|
||||||
info["name"] = self._device.name
|
|
||||||
|
|
||||||
return info
|
|
||||||
|
|
||||||
async def async_added_to_hass(self):
|
async def async_added_to_hass(self):
|
||||||
"""Client entity created."""
|
"""Client entity created."""
|
||||||
|
@ -19,6 +19,7 @@ from homeassistant.const import (
|
|||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import ConfigEntryNotReady
|
from homeassistant.exceptions import ConfigEntryNotReady
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
||||||
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
from homeassistant.helpers.event import async_call_later
|
from homeassistant.helpers.event import async_call_later
|
||||||
import homeassistant.util.dt as dt_util
|
import homeassistant.util.dt as dt_util
|
||||||
|
|
||||||
@ -66,15 +67,15 @@ class KeeneticRouter:
|
|||||||
return self.config_entry.data[CONF_HOST]
|
return self.config_entry.data[CONF_HOST]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_info(self):
|
def device_info(self) -> DeviceInfo:
|
||||||
"""Return the host of this hub."""
|
"""Return the host of this hub."""
|
||||||
return {
|
return DeviceInfo(
|
||||||
"identifiers": {(DOMAIN, f"router-{self.config_entry.entry_id}")},
|
identifiers={(DOMAIN, f"router-{self.config_entry.entry_id}")},
|
||||||
"manufacturer": self.manufacturer,
|
manufacturer=self.manufacturer,
|
||||||
"model": self.model,
|
model=self.model,
|
||||||
"name": self.name,
|
name=self.name,
|
||||||
"sw_version": self.firmware,
|
sw_version=self.firmware,
|
||||||
}
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
|
@ -62,6 +62,7 @@ from homeassistant.helpers import (
|
|||||||
device_registry,
|
device_registry,
|
||||||
entity_platform,
|
entity_platform,
|
||||||
)
|
)
|
||||||
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
from homeassistant.helpers.event import async_track_time_interval
|
from homeassistant.helpers.event import async_track_time_interval
|
||||||
from homeassistant.helpers.network import is_internal_request
|
from homeassistant.helpers.network import is_internal_request
|
||||||
import homeassistant.util.dt as dt_util
|
import homeassistant.util.dt as dt_util
|
||||||
@ -345,13 +346,13 @@ class KodiEntity(MediaPlayerEntity):
|
|||||||
return self._unique_id
|
return self._unique_id
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_info(self):
|
def device_info(self) -> DeviceInfo:
|
||||||
"""Return device info for this device."""
|
"""Return device info for this device."""
|
||||||
return {
|
return DeviceInfo(
|
||||||
"identifiers": {(DOMAIN, self.unique_id)},
|
identifiers={(DOMAIN, self.unique_id)},
|
||||||
"name": self.name,
|
manufacturer="Kodi",
|
||||||
"manufacturer": "Kodi",
|
name=self.name,
|
||||||
}
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def state(self):
|
def state(self):
|
||||||
|
@ -10,6 +10,7 @@ from homeassistant.const import (
|
|||||||
)
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
|
|
||||||
from .const import DOMAIN as KONNECTED_DOMAIN
|
from .const import DOMAIN as KONNECTED_DOMAIN
|
||||||
|
|
||||||
@ -66,11 +67,11 @@ class KonnectedBinarySensor(BinarySensorEntity):
|
|||||||
return self._device_class
|
return self._device_class
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_info(self):
|
def device_info(self) -> DeviceInfo:
|
||||||
"""Return the device info."""
|
"""Return the device info."""
|
||||||
return {
|
return DeviceInfo(
|
||||||
"identifiers": {(KONNECTED_DOMAIN, self._device_id)},
|
identifiers={(KONNECTED_DOMAIN, self._device_id)},
|
||||||
}
|
)
|
||||||
|
|
||||||
async def async_added_to_hass(self):
|
async def async_added_to_hass(self):
|
||||||
"""Store entity_id and register state change callback."""
|
"""Store entity_id and register state change callback."""
|
||||||
|
@ -15,6 +15,7 @@ from homeassistant.const import (
|
|||||||
)
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
|
|
||||||
from .const import DOMAIN as KONNECTED_DOMAIN, SIGNAL_DS18B20_NEW
|
from .const import DOMAIN as KONNECTED_DOMAIN, SIGNAL_DS18B20_NEW
|
||||||
|
|
||||||
@ -111,7 +112,7 @@ class KonnectedSensor(SensorEntity):
|
|||||||
name += f" {description.name}"
|
name += f" {description.name}"
|
||||||
self._attr_name = name
|
self._attr_name = name
|
||||||
|
|
||||||
self._attr_device_info = {"identifiers": {(KONNECTED_DOMAIN, device_id)}}
|
self._attr_device_info = DeviceInfo(identifiers={(KONNECTED_DOMAIN, device_id)})
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def native_value(self):
|
def native_value(self):
|
||||||
|
@ -11,7 +11,7 @@ from homeassistant.const import (
|
|||||||
)
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
from homeassistant.helpers.entity import ToggleEntity
|
from homeassistant.helpers.entity import DeviceInfo, ToggleEntity
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
CONF_ACTIVATION,
|
CONF_ACTIVATION,
|
||||||
@ -77,11 +77,9 @@ class KonnectedSwitch(ToggleEntity):
|
|||||||
return device_data.get("panel")
|
return device_data.get("panel")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_info(self):
|
def device_info(self) -> DeviceInfo:
|
||||||
"""Return the device info."""
|
"""Return the device info."""
|
||||||
return {
|
return DeviceInfo(identifiers={(KONNECTED_DOMAIN, self._device_id)})
|
||||||
"identifiers": {(KONNECTED_DOMAIN, self._device_id)},
|
|
||||||
}
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def available(self):
|
def available(self):
|
||||||
|
@ -13,6 +13,7 @@ from homeassistant.const import CONF_HOST, CONF_PASSWORD, EVENT_HOMEASSISTANT_ST
|
|||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import ConfigEntryNotReady
|
from homeassistant.exceptions import ConfigEntryNotReady
|
||||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||||
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
from homeassistant.helpers.event import async_call_later
|
from homeassistant.helpers.event import async_call_later
|
||||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
|
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
|
||||||
|
|
||||||
@ -84,14 +85,14 @@ class Plenticore:
|
|||||||
prod1 = device_local["Branding:ProductName1"]
|
prod1 = device_local["Branding:ProductName1"]
|
||||||
prod2 = device_local["Branding:ProductName2"]
|
prod2 = device_local["Branding:ProductName2"]
|
||||||
|
|
||||||
self.device_info = {
|
self.device_info = DeviceInfo(
|
||||||
"identifiers": {(DOMAIN, device_local["Properties:SerialNo"])},
|
identifiers={(DOMAIN, device_local["Properties:SerialNo"])},
|
||||||
"manufacturer": "Kostal",
|
manufacturer="Kostal",
|
||||||
"model": f"{prod1} {prod2}",
|
model=f"{prod1} {prod2}",
|
||||||
"name": settings["scb:network"]["Hostname"],
|
name=settings["scb:network"]["Hostname"],
|
||||||
"sw_version": f'IOC: {device_local["Properties:VersionIOC"]}'
|
sw_version=f'IOC: {device_local["Properties:VersionIOC"]}'
|
||||||
+ f' MC: {device_local["Properties:VersionMC"]}',
|
+ f' MC: {device_local["Properties:VersionMC"]}',
|
||||||
}
|
)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ from homeassistant.config_entries import ConfigEntry
|
|||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers import device_registry
|
from homeassistant.helpers import device_registry
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||||
|
|
||||||
@ -112,12 +113,12 @@ class KrakenSensor(CoordinatorEntity[Optional[KrakenResponse]], SensorEntity):
|
|||||||
self._received_data_at_least_once = False
|
self._received_data_at_least_once = False
|
||||||
self._available = True
|
self._available = True
|
||||||
|
|
||||||
self._attr_device_info = {
|
self._attr_device_info = DeviceInfo(
|
||||||
"identifiers": {(DOMAIN, f"{source_asset}_{self._target_asset}")},
|
entry_type="service",
|
||||||
"name": self._device_name,
|
identifiers={(DOMAIN, f"{source_asset}_{self._target_asset}")},
|
||||||
"manufacturer": "Kraken.com",
|
manufacturer="Kraken.com",
|
||||||
"entry_type": "service",
|
name=self._device_name,
|
||||||
}
|
)
|
||||||
|
|
||||||
async def async_added_to_hass(self) -> None:
|
async def async_added_to_hass(self) -> None:
|
||||||
"""Handle entity which will be added."""
|
"""Handle entity which will be added."""
|
||||||
|
@ -15,6 +15,7 @@ from homeassistant.components.light import (
|
|||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
|
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.event import async_track_time_interval
|
from homeassistant.helpers.event import async_track_time_interval
|
||||||
|
|
||||||
@ -97,13 +98,13 @@ class KulerskyLight(LightEntity):
|
|||||||
return self._light.address
|
return self._light.address
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_info(self):
|
def device_info(self) -> DeviceInfo:
|
||||||
"""Device info for this light."""
|
"""Device info for this light."""
|
||||||
return {
|
return DeviceInfo(
|
||||||
"identifiers": {(DOMAIN, self.unique_id)},
|
identifiers={(DOMAIN, self.unique_id)},
|
||||||
"name": self.name,
|
manufacturer="Brightech",
|
||||||
"manufacturer": "Brightech",
|
name=self.name,
|
||||||
}
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_on(self):
|
def is_on(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user