meross-homeassistant
meross-homeassistant copied to clipboard
Integration messed up the `./storage/core.config_entries` file somehow
Hi,
Describe the bug I had the issue that I could not edit, remove and add integrations. See also issue I created this: https://github.com/home-assistant/core/issues/123949
The root cause was, that the meross integration messed up the ./storage/core.config_entries file somehow.
Your environment
- HomeAssistant version:
- Core 2024.12.5
- Supervisor 2024.12.0
- Operating System 14.1
- Frontend 20241127.8
Hardware environment:
- Proxmox LXC container
Donation bot here. Supporters can mark their interest in this issue by adding a comment starting with "+1" (without quotes) or adding the "#supporter_sponsor" keyword (without quotes) in their comments.
You can become a donor by subscribing as Sponsor from the GitHub sponsorship page or from the BuyMeACoffee page.
Issues marked by donors will be labeled accordingly and handled with special care
I have just run into the same issue. I had several integrations unrelated to Meross that would require re-authentication every time I restarted HA. After about a week of troubleshooting I stumbled upon this thread:
https://community.home-assistant.io/t/changes-on-integrations-are-reset-after-reboot/782085/8
That tipped me off to check the Meross config_entries file and I found that this part of the Meross entry:
"mqtt_domain":["mqtt-eu-4.meross.com"]
...looked like this:
"mqtt_domain":[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[["mqtt-eu-4.meross.com"]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
I removed all the unnecessary [ ] and restarted, and all the integrations that were failing worked again. However, when I went back to check the Meross config_entries line, it now looked like:
"mqtt_domain":[["mqtt-eu-4.meross.com"]]
I tried rebooting again, and it looked like:
"mqtt_domain":[[["mqtt-eu-4.meross.com"]]]
So it appears that every restart causes another [ ] pair to be added for some reason. Strangely, the failed integrations still work, so it seems that at some point Home Assistant can't cope with all the brackets and weird stuff starts to happen.
Afraid that's as far as I've got, but hopefully will be of some use...
You are right. It's starting again:
mqtt_domain":[[[[[[[[[[[[[[[[[[[[[[[[[[[["mqtt-eu-4.meross.com"]]]]]]]]]]]]]]]]]]]]]]]]]]]]
ugh
possible fix in /homeassistant/custom_components/meross_cloud/init.py
# Override the new credentials and store them into HA entry
self._cached_creds = self._client.cloud_credentials
self.hass.config_entries.async_update_entry(
entry=self._entry,
data={
CONF_HTTP_ENDPOINT: self._cached_creds.domain,
CONF_STORED_CREDS: {
"token": self._cached_creds.token,
"key": self._cached_creds.key,
"user_id": self._cached_creds.user_id,
"user_email": self._cached_creds.user_email,
"issued_on": self._cached_creds.issued_on.isoformat(),
"domain": self._cached_creds.domain,
"mqtt_domain": [self._cached_creds.mqtt_domain] if isinstance(self._cached_creds.mqtt_domain, str) else [None]
},
},
)
I just had this with the Meross integration. A whole bunch of my integrations were not saving their config. Sanity restored!
@albertogeniola any plans on fixing that?
I had this issue as well. Everytime I restarted HA, I lost authentication on Tuya, Wyze, Toyota USA. It wasn't until I saw others having issues and suspecting this integration was at fault that I removed it, in favor of the MEROSS LAN integration. Since switching, those services no longer lose authentication during restarts.
Solved with the last releases.