39 files
This commit is contained in:
@@ -169,6 +169,9 @@ async def async_setup_entry( # noqa: C901
|
||||
await hilo.async_init(scan_interval)
|
||||
except HiloError as err:
|
||||
raise ConfigEntryNotReady from err
|
||||
except (TimeoutError, client_exceptions.ClientError) as err:
|
||||
LOG.debug("Timeout with API connection")
|
||||
raise ConfigEntryNotReady from err
|
||||
|
||||
hass.data.setdefault(DOMAIN, {})
|
||||
hass.data[DOMAIN][entry.entry_id] = hilo
|
||||
@@ -198,18 +201,36 @@ async def async_setup_entry( # noqa: C901
|
||||
"sensor.hilo_gateway": "sensor.hilo_gateway",
|
||||
}
|
||||
for old_id, new_id in gateway_entity_renames.items():
|
||||
if old_id != new_id and entity_registry.async_get(old_id):
|
||||
if old_id == new_id or not entity_registry.async_get(old_id):
|
||||
continue
|
||||
if entity_registry.async_get(new_id):
|
||||
LOG.info(
|
||||
"Skipping migration %s -> %s, target entity ID already registered",
|
||||
old_id,
|
||||
new_id,
|
||||
)
|
||||
entity_registry.async_update_entity(old_id, new_entity_id=new_id)
|
||||
LOG.info("Migrated entity ID %s -> %s", old_id, new_id)
|
||||
continue
|
||||
entity_registry.async_update_entity(old_id, new_entity_id=new_id)
|
||||
LOG.info("Migrated entity ID %s -> %s", old_id, new_id)
|
||||
|
||||
# Note (ic-dev21): this new renaming by HA also breaks sensor.hilo_energy_total, which is used in check_tarif
|
||||
energy_entity_renames = {
|
||||
"sensor.meter00_hilo_energy_total": "sensor.hilo_energy_total"
|
||||
}
|
||||
for old_id, new_id in energy_entity_renames.items():
|
||||
if old_id != new_id and entity_registry.async_get(old_id):
|
||||
if old_id == new_id or not entity_registry.async_get(old_id):
|
||||
continue
|
||||
if entity_registry.async_get(new_id):
|
||||
LOG.info(
|
||||
"Skipping migration %s -> %s, target entity ID already registered",
|
||||
old_id,
|
||||
new_id,
|
||||
)
|
||||
entity_registry.async_update_entity(old_id, new_entity_id=new_id)
|
||||
LOG.info("Migrated entity ID %s -> %s", old_id, new_id)
|
||||
continue
|
||||
entity_registry.async_update_entity(old_id, new_entity_id=new_id)
|
||||
LOG.info("Migrated entity ID %s -> %s", old_id, new_id)
|
||||
|
||||
async def handle_debug_event(event: Event):
|
||||
"""Handle an event."""
|
||||
|
||||
@@ -12,5 +12,5 @@
|
||||
"iot_class": "cloud_push",
|
||||
"issue_tracker": "https://github.com/dvd-dev/hilo/issues",
|
||||
"requirements": ["python-hilo>=2026.3.5"],
|
||||
"version": "2026.5.2"
|
||||
"version": "2026.8.1"
|
||||
}
|
||||
|
||||
@@ -349,7 +349,18 @@ class EnergySensor(IntegrationSensor):
|
||||
identifiers={(DOMAIN, self._device.identifier)},
|
||||
)
|
||||
|
||||
if Version(current_version) >= Version("2025.8"):
|
||||
if Version(current_version) >= Version("2026.8"):
|
||||
super().__init__(
|
||||
integration_method=METHOD_LEFT,
|
||||
max_sub_interval=timedelta(seconds=MAX_SUB_INTERVAL),
|
||||
name=self._attr_name,
|
||||
round_digits=2,
|
||||
source_entity=self._source,
|
||||
unique_id=self._attr_unique_id,
|
||||
unit_prefix="k",
|
||||
unit_time="h",
|
||||
)
|
||||
elif Version(current_version) >= Version("2025.8"):
|
||||
super().__init__(
|
||||
hass,
|
||||
integration_method=METHOD_LEFT,
|
||||
|
||||
Reference in New Issue
Block a user