From 32663fd610273c3785b7eb08db0eabfee8596bb1 Mon Sep 17 00:00:00 2001 From: Jean-Louis Dupond Date: Fri, 23 Aug 2024 22:49:51 +0200 Subject: [PATCH] Fix old entity migration --- custom_components/nrgkick/__init__.py | 43 +++++++++++++-------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/custom_components/nrgkick/__init__.py b/custom_components/nrgkick/__init__.py index fe685bb..14d8085 100644 --- a/custom_components/nrgkick/__init__.py +++ b/custom_components/nrgkick/__init__.py @@ -22,28 +22,27 @@ def update_unique_id(entry: er.RegistryEntry) -> dict[str, str] | None: replacements = { "charge_current_max_adapter": "connector_max_current", "wifi_network": "network_ssid", - "charge_current_user_set": "control_current_set", - "energy_limit_value": "control_energy_limit", - "total_charged_energy": "values_energy_total_charged_energy", - "charged_energy": "values_energy_charged_energy", - "charging_voltage": "values_powerflow_charging_voltage", - "charge_current_value": "values_powerflow_charging_current", - "grid_frequency": "values_powerflow_grid_frequency", - "peak_charging_power": "values_powerflow_peak_power", - "charging_power": "values_powerflow_total_active_power", - "voltage_phase_a": "values_powerflow_l1_voltage", - "charging_current_phase_a": "values_powerflow_l1_current", - "charging_power_phase_a": "values_powerflow_l1_active_power", - "voltage_phase_b": "values_powerflow_l2_voltage", - "charging_current_phase_b": "values_powerflow_l2_current", - "charging_power_phase_b": "values_powerflow_l2_active_power", - "voltage_phase_c": "values_powerflow_l3_voltage", - "charging_current_phase_c": "values_powerflow_l3_current", - "charging_power_phase_c": "values_powerflow_l3_active_power", - "charging_rate": "values_general_charging_rate", - "charging_state": "values_general_status", - "total_charging_cycles": "values_general_charge_count", - "control_pilot_status": "values_general_error_code", + "charge_current_user_set": "current_set", + "energy_limit_value": "energy_limit", + "total_charged_energy": "energy_total_charged_energy", + "charged_energy": "energy_charged_energy", + "charging_voltage": "powerflow_charging_voltage", + "charge_current_value": "powerflow_charging_current", + "peak_charging_power": "powerflow_peak_power", + "charging_power": "powerflow_total_active_power", + "voltage_phase_a": "powerflow_l1_voltage", + "charging_current_phase_a": "powerflow_l1_current", + "charging_power_phase_a": "powerflow_l1_active_power", + "voltage_phase_b": "powerflow_l2_voltage", + "charging_current_phase_b": "powerflow_l2_current", + "charging_power_phase_b": "powerflow_l2_active_power", + "voltage_phase_c": "powerflow_l3_voltage", + "charging_current_phase_c": "powerflow_l3_current", + "charging_power_phase_c": "powerflow_l3_active_power", + "charging_rate": "general_charging_rate", + "charging_state": "general_status", + "total_charging_cycles": "general_charge_count", + "control_pilot_status": "general_error_code", } if (key := entry.unique_id.split("_", 1)[-1]) in replacements: new_unique_id = entry.unique_id.replace(key, replacements[key])