Skip to content

Commit

Permalink
Fix old entity migration
Browse files Browse the repository at this point in the history
  • Loading branch information
dupondje committed Aug 23, 2024
1 parent af069f1 commit 32663fd
Showing 1 changed file with 21 additions and 22 deletions.
43 changes: 21 additions & 22 deletions custom_components/nrgkick/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down

0 comments on commit 32663fd

Please sign in to comment.