From 977cc7bd571e3d8b0e8a4ccb56dfa61439c48a5f Mon Sep 17 00:00:00 2001 From: "Ian C." <108159253+ic-dev21@users.noreply.github.com> Date: Fri, 22 May 2026 21:14:45 -0400 Subject: [PATCH] Hardcode hilo_energy_total MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Un autre que j'avais manqué. Si on fait pas ça sur des nouveaux installs le select, check_tarif etc sont brisés. TODO: à rendre plus brillant/joli que ça --- custom_components/hilo/__init__.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/custom_components/hilo/__init__.py b/custom_components/hilo/__init__.py index a56a8b47..fbb3194a 100644 --- a/custom_components/hilo/__init__.py +++ b/custom_components/hilo/__init__.py @@ -202,6 +202,15 @@ async def async_setup_entry( # noqa: C901 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): + 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.""" LOG.debug("HILO_DEBUG: Event received: %s", event)