Compare commits

...

3 Commits

Author SHA1 Message Date
Carter Green
8460d4f5e2 Yolink diagnostic sensors (#160749) 2026-01-12 10:33:49 +01:00
Artur Pragacz
8fd35cd70d Rename registry imports in entity platform (#160766) 2026-01-12 10:27:03 +01:00
MarkGodwin
88be115699 Bump tplink_omada quality scale to bronze (#160762) 2026-01-12 09:52:46 +01:00
5 changed files with 14 additions and 13 deletions

View File

@@ -6,5 +6,6 @@
"documentation": "https://www.home-assistant.io/integrations/tplink_omada",
"integration_type": "hub",
"iot_class": "local_polling",
"quality_scale": "bronze",
"requirements": ["tplink-omada-client==1.5.3"]
}

View File

@@ -212,6 +212,7 @@ SENSOR_TYPES: tuple[YoLinkSensorEntityDescription, ...] = (
key="battery",
device_class=SensorDeviceClass.BATTERY,
native_unit_of_measurement=PERCENTAGE,
entity_category=EntityCategory.DIAGNOSTIC,
state_class=SensorStateClass.MEASUREMENT,
exists_fn=lambda device: device.device_type in BATTERY_POWER_SENSOR,
should_update_entity=lambda value: value is not None,
@@ -251,9 +252,11 @@ SENSOR_TYPES: tuple[YoLinkSensorEntityDescription, ...] = (
# mcu temperature
YoLinkSensorEntityDescription(
key="devTemperature",
translation_key="device_temperature",
device_class=SensorDeviceClass.TEMPERATURE,
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
exists_fn=lambda device: device.device_type in MCU_DEV_TEMPERATURE_SENSOR,
should_update_entity=lambda value: value is not None,
value=lambda device, data: data.get("devTemperature"),

View File

@@ -67,6 +67,9 @@
"current_power": {
"name": "Current power"
},
"device_temperature": {
"name": "Device temperature"
},
"power_consumption": {
"name": "Power consumption"
},

View File

@@ -38,12 +38,7 @@ from homeassistant.setup import SetupPhases, async_start_setup
from homeassistant.util.async_ import create_eager_task
from homeassistant.util.hass_dict import HassKey
from . import (
device_registry as dev_reg,
entity_registry as ent_reg,
service,
translation,
)
from . import device_registry as dr, entity_registry as er, service, translation
from .deprecation import deprecated_function
from .entity_registry import EntityRegistry, RegistryEntryDisabler, RegistryEntryHider
from .event import async_call_later
@@ -624,7 +619,7 @@ class EntityPlatform:
event loop and will finish faster if we run them concurrently.
"""
results: list[BaseException | None] | None = None
entity_registry = ent_reg.async_get(self.hass)
entity_registry = er.async_get(self.hass)
try:
async with self.hass.timeout.async_timeout(timeout, self.domain):
results = await asyncio.gather(
@@ -676,7 +671,7 @@ class EntityPlatform:
to the event loop so we can await the coros directly without
scheduling them as tasks.
"""
entity_registry = ent_reg.async_get(self.hass)
entity_registry = er.async_get(self.hass)
try:
async with self.hass.timeout.async_timeout(timeout, self.domain):
for entity in entities:
@@ -852,16 +847,16 @@ class EntityPlatform:
entity.add_to_platform_abort()
return
device: dev_reg.DeviceEntry | None
device: dr.DeviceEntry | None
if self.config_entry:
if device_info := entity.device_info:
try:
device = dev_reg.async_get(self.hass).async_get_or_create(
device = dr.async_get(self.hass).async_get_or_create(
config_entry_id=self.config_entry.entry_id,
config_subentry_id=config_subentry_id,
**device_info,
)
except dev_reg.DeviceInfoError as exc:
except dr.DeviceInfoError as exc:
self.logger.error(
"%s: Not adding entity with invalid device info: %s",
self.platform_name,
@@ -1236,7 +1231,7 @@ class EntityPlatform:
@callback
def async_calculate_suggested_object_id(
entity: Entity, device: dev_reg.DeviceEntry | None
entity: Entity, device: dr.DeviceEntry | None
) -> str | None:
"""Calculate the suggested object ID for an entity."""
calculated_object_id: str | None = None

View File

@@ -2000,7 +2000,6 @@ INTEGRATIONS_WITHOUT_SCALE = [
"touchline",
"touchline_sl",
"tplink_lte",
"tplink_omada",
"traccar",
"traccar_server",
"tractive",