From c8a6cb09c94382e2f9de6a56ff9642974bf9cf87 Mon Sep 17 00:00:00 2001 From: "Ian C." <108159253+ic-dev21@users.noreply.github.com> Date: Sat, 12 Sep 2026 19:55:12 -0400 Subject: [PATCH 1/3] Ajout de guarding pour backward compatibility --- custom_components/hilo/__init__.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/custom_components/hilo/__init__.py b/custom_components/hilo/__init__.py index 0933d95d..d63951ca 100644 --- a/custom_components/hilo/__init__.py +++ b/custom_components/hilo/__init__.py @@ -23,6 +23,7 @@ CONF_USERNAME, EVENT_HOMEASSISTANT_STOP, Platform, + __short_version__ as current_version, ) from homeassistant.core import Context, HomeAssistant, callback from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady @@ -34,6 +35,7 @@ from homeassistant.helpers.aiohttp_client import async_create_clientsession from homeassistant.helpers.dispatcher import async_dispatcher_send from homeassistant.helpers.update_coordinator import DataUpdateCoordinator +from packaging.version import Version from pyhilo import API from pyhilo.device import HiloDevice from pyhilo.devices import Devices @@ -781,7 +783,13 @@ async def _fetch_legacy_gateway_dsn(self, new_mac: str) -> str | None: returns its old DSN-based identifier if it exists. If it doesn't, it returns Noneto use the MAC address instead.""" device_registry = dr.async_get(self._hass) - for device in device_registry.devices: + devices = device_registry.devices + device_iter = ( + devices + if Version(current_version) >= Version("2026.9") + else devices.values() + ) + for device in device_iter: if device.manufacturer != "Hilo" or device.model != "EQ000017": continue for domain, identifier in device.identifiers: From a66773340dd1ecb46a02d5bbbfdcef85dd1d3c7d Mon Sep 17 00:00:00 2001 From: "Ian C." <108159253+ic-dev21@users.noreply.github.com> Date: Sat, 12 Sep 2026 21:02:20 -0400 Subject: [PATCH 2/3] Further guarding --- custom_components/hilo/__init__.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/custom_components/hilo/__init__.py b/custom_components/hilo/__init__.py index d63951ca..3ca5b708 100644 --- a/custom_components/hilo/__init__.py +++ b/custom_components/hilo/__init__.py @@ -159,11 +159,22 @@ def _async_migrate_gateway_device_identifier( return device_registry = dr.async_get(hass) - old_device = device_registry.async_get_device(identifiers={(DOMAIN, old_dsn)}) + if Version(current_version) >= Version("2026.8"): + old_device = device_registry.async_get_device_by_identifier( + (DOMAIN, old_dsn, entry.entry_id) + ) + else: + old_device = device_registry.async_get_device(identifiers={(DOMAIN, old_dsn)}) + if old_device is None: return # fresh install, or already migrated - new_device = device_registry.async_get_device(identifiers={(DOMAIN, new_mac)}) + if Version(current_version) >= Version("2026.8"): + new_device = device_registry.async_get_device_by_identifier( + (DOMAIN, new_mac), entry.entry_id + ) + else: + new_device = device_registry.async_get_device(identifiers={(DOMAIN, new_mac)}) if new_device is not None and new_device.id != old_device.id: LOG.warning( "Gateway device already registered under new identifier %s, skipping device migration", From 53e8ec8e26883ec083745d4745cb3d40e5274bfd Mon Sep 17 00:00:00 2001 From: "Ian C." <108159253+ic-dev21@users.noreply.github.com> Date: Sat, 12 Sep 2026 21:05:16 -0400 Subject: [PATCH 3/3] Update hacs.json Let's drop support for old versions of HA. --- hacs.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hacs.json b/hacs.json index 0a505b86..baa86060 100644 --- a/hacs.json +++ b/hacs.json @@ -1,5 +1,5 @@ { "name": "Hilo", "render_readme": true, - "homeassistant": "2024.7.0" + "homeassistant": "2025.8.0" }