Open giacomoalonzi opened 1 month ago
I've update the file MqttClient.py at line 145 in this:
def set_install_id(self):
"""Set the installation ID based on the user's default installation."""
default_install = self.user.get("defaultInstall")
if not default_install:
raise ValueError("The user does not have a default installation configured.")
installs = self.user.get("installs")
if not installs:
raise ValueError("No installations found for the user.")
for install in installs:
if install["unique"] == default_install:
self.current_installation = {
"id": install["_id"],
"unique": install["unique"],
"hash": install.get("hash"), # Safe access to 'hash'
}
return
raise ValueError("The default installation was not found among the user's installations.")
Now the error is changed in this:
Error setting up entry REHAU Nea Smart 2.0 API for rehau_nea_smart_2
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 604, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/rehau_nea_smart_2/__init__.py", line 27, in async_setup_entry
await controller.connect()
File "/config/custom_components/rehau_nea_smart_2/rehau_mqtt_client/Controller.py", line 33, in connect
await self.mqtt_client.auth_user()
File "/config/custom_components/rehau_nea_smart_2/rehau_mqtt_client/MqttClient.py", line 318, in auth_user
await self.set_user(user)
File "/config/custom_components/rehau_nea_smart_2/rehau_mqtt_client/MqttClient.py", line 395, in set_user
await self.set_installations(user["installs"])
File "/config/custom_components/rehau_nea_smart_2/rehau_mqtt_client/MqttClient.py", line 341, in set_installations
self.set_install_id()
File "/config/custom_components/rehau_nea_smart_2/rehau_mqtt_client/MqttClient.py", line 149, in set_install_id
raise ValueError("The user does not have a default installation configured.")
ValueError: The user does not have a default installation configured.
hope this help to figuring out, 'cause I do not have any idea about what defaultInstallation is or if I have to do something on my side.
The integration is currently unable to handle cases where the Rehau API doesn't provide a defaultInstall property in the user data.
As a temporary workaround, you can set a default installation in your Rehau app:
This should allow the integration to connect successfully.
I'm aware of this issue and will consider it for a future update.
System Health details
System Information
Home Assistant Community Store
GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok HACS Data | ok GitHub API Calls Remaining | 4974 Installed Version | 2.0.1 Stage | running Available Repositories | 1494 Downloaded Repositories | 19Home Assistant Cloud
logged_in | false -- | -- can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | okDashboards
dashboards | 4 -- | -- resources | 9 views | 21 mode | storageRecorder
oldest_recorder_run | 25 settembre 2024 alle ore 12:39 -- | -- current_recorder_run | 1 ottobre 2024 alle ore 19:19 estimated_db_size | 213.12 MiB database_engine | sqlite database_version | 3.45.3Checklist
Describe the issue
When setting up the REHAU Nea Smart 2.0 integration in Home Assistant, a KeyError occurs due to the absence of the "defaultInstall" key in the user object. This prevents the integration from completing its configuration and functioning properly.
Reproduction steps
Debug logs
Diagnostics dump
home-assistant_rehau_nea_smart_2_2024-10-01T17-56-27.752Z.log