Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After migration from 2023.03.24 to 2023.11.30-Beta: "Flow aborted: already_configured" in async_step_dhcp #216

Open
steffenweber opened this issue Dec 13, 2023 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@steffenweber
Copy link
Sponsor Contributor

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:

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"
}
@steffenweber
Copy link
Sponsor Contributor Author

steffenweber commented Dec 13, 2023

If raise data_entry_flow.AbortFlow(error) is the expected code-flow when a device is already configured then maybe the issue is that Luxtronik catches it in the first place (instead of letting Home Assistant catch and handle it itself)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants