luxtronik
luxtronik copied to clipboard
After migration from 2023.03.24 to 2023.11.30-Beta: "Flow aborted: already_configured" in async_step_dhcp
First of all, thank you very much for this integration!
I've just migrated from version 2023.03.24 to 2023.11.30-Beta which seems to have worked fine. However, there is one error logged after each Home Assistant startup (I've redacted the macaddress
):
2023-12-13 20:08:03.583 ERROR (MainThread) [custom_components.luxtronik2] Could not handle config_flow.async_step_dhcp DhcpServiceInfo(ip='192.168.178.123', hostname='swcv-92h3', macaddress='...')
Traceback (most recent call last):
File "/config/custom_components/luxtronik2/config_flow.py", line 269, in async_step_dhcp
self._abort_if_unique_id_configured()
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1568, in _abort_if_unique_id_configured
raise data_entry_flow.AbortFlow(error)
homeassistant.data_entry_flow.AbortFlow: Flow aborted: already_configured
I've searched for other issues mentioning this error:
- https://github.com/BenPru/luxtronik/issues/144 says that the issue was resolved after re-installing the integration. I'll try this later if I cannot find a solution (not completely sure whether states + statistics will be retained) but I wanted to report this issue nevertheless.
- https://github.com/BenPru/luxtronik/issues/151 is closed but doesn't mention a solution.
- https://github.com/BenPru/luxtronik/issues/192 says that the cause was a disabled Luxtronik integration. I don't have any disabled integrations according to Settings -> Devices & Services -> Filter "Show disabled integrations".
I've then tried to understand what could be causing this error. This integration's async_step_dhcp
function calls Home Assistant's function _abort_if_unique_id_configured
which in turn raises an AbortFlow('already_configured')
exception.
According to https://developers.home-assistant.io/docs/config_entries_config_flow_handler/#discovery-steps, an async_step_dhcp
function needs to "make sure that the device is not already set up". Where does Luxtronik2's async_step_dhcp
function check this?
It seems to me like Luxtronik2 doesn't check whether the device is already configured or not before calling _abort_if_unique_id_configured
. But maybe I'm wrong?
The luxtronik2 entry in my config/.storage/core.config_entries
file:
{
"entry_id": "68ca43448c08201ea741a1220c7dc41f",
"version": 7,
"domain": "luxtronik2",
"title": "Wärmepumpe",
"data": {
"host": "192.168.178.123",
"port": 8889,
"safe": false,
"lock_timeout": 30,
"update_immediately_after_write": true,
"control_mode_home_assistant": false,
"ha_sensor_indoor_temperature": "",
"language_sensor_names": "en",
"ha_sensor_prefix": "luxtronik2",
"timeout": 60.0,
"max_data_length": 10000
},
"options": {},
"pref_disable_new_entities": false,
"pref_disable_polling": false,
"source": "dhcp",
"unique_id": "123456_7890",
"disabled_by": null
},
The luxtronik2 entries in my config/.storage/core.device_registry
file:
{
"area_id": "utility_room",
"config_entries": [
"68ca43448c08201ea741a1220c7dc41f"
],
"configuration_url": "http://192.168.178.123/",
"connections": [
[
"luxtronik2",
"123456_7890_heatpump"
]
],
"disabled_by": null,
"entry_type": null,
"hw_version": null,
"id": "a9b2d68e69aa55d41a4aacf279434893",
"identifiers": [
[
"luxtronik2",
"123456_7890_heatpump"
]
],
"manufacturer": null,
"model": null,
"name_by_user": null,
"name": "HP",
"sw_version": "V3.89.3",
"via_device_id": null
},
{
"area_id": "utility_room",
"config_entries": [
"68ca43448c08201ea741a1220c7dc41f"
],
"configuration_url": "http://192.168.178.123/",
"connections": [
[
"luxtronik2",
"123456_7890_heating"
]
],
"disabled_by": null,
"entry_type": null,
"hw_version": null,
"id": "46a759b9b1b6cbba98184df8dc08194d",
"identifiers": [
[
"luxtronik2",
"123456_7890_heating"
]
],
"manufacturer": null,
"model": null,
"name_by_user": null,
"name": "Heat",
"sw_version": "V3.89.3",
"via_device_id": "a9b2d68e69aa55d41a4aacf279434893"
},
{
"area_id": "utility_room",
"config_entries": [
"68ca43448c08201ea741a1220c7dc41f"
],
"configuration_url": "http://192.168.178.123/",
"connections": [
[
"luxtronik2",
"123456_7890_domestic_water"
]
],
"disabled_by": null,
"entry_type": null,
"hw_version": null,
"id": "2de3545c26ba7fe5fde838447889498f",
"identifiers": [
[
"luxtronik2",
"123456_7890_domestic_water"
]
],
"manufacturer": null,
"model": null,
"name_by_user": null,
"name": "DHW",
"sw_version": "V3.89.3",
"via_device_id": "a9b2d68e69aa55d41a4aacf279434893"
}