meross-homeassistant
meross-homeassistant copied to clipboard
MEROSS Integration Corrupts Configuration (mqtt_domain Nested null), Preventing HA from Saving Changes
Describe the bug The MEROSS integration in Home Assistant introduces an issue where, upon each restart of Home Assistant, a nested null value is appended to the mqtt_domain configuration. This repeated nesting grows over time, eventually rendering Home Assistant unable to save new configurations or add new integrations.
Here the complete line after a CLEAN start:
{"created_at":"1970-01-01T00:00:00+00:00","data":{"http_api_endpoint":"https://iot.meross.com","stored_credentials":{"domain":"https://iot.meross.com","issued_on":"2023-10-21T16:04:43.870637","key":"e9ac6fb794f283f320e5c7c95129003c","mqtt_domain":[null],"token":"----------------","user_email":"--------------------","user_id":"---------"}},"disabled_by":null,"discovery_keys":{},"domain":"meross_cloud","entry_id":"----------------","minor_version":1,"modified_at":"2025-01-26T05:53:04.230066+00:00","options":{"custom_user_agent":"MerossHA/1.2.8","lan_transport_mode":"conf_opt_lan_mqtt_only"},"pref_disable_new_entities":false,"pref_disable_polling":false,"source":"user","title":"https://iot.meross.com","unique_id":"https://iot.meross.com","version":1},
Here after one restart of HA:
{"created_at":"1970-01-01T00:00:00+00:00","data":{"http_api_endpoint":"https://iot.meross.com","stored_credentials":{"domain":"https://iot.meross.com","issued_on":"2023-10-21T16:04:43.870637","key":"----------","mqtt_domain":[[null]],"token":"----------","user_email":"----","user_id":"-----"}},"disabled_by":null,"discovery_keys":{},"domain":"meross_cloud","entry_id":"564457861b458c90c1aa4e35a9a7ec96","minor_version":1,"modified_at":"2025-01-26T06:26:02.270774+00:00","options":{"custom_user_agent":"MerossHA/1.2.8","lan_transport_mode":"conf_opt_lan_mqtt_only"},"pref_disable_new_entities":false,"pref_disable_polling":false,"source":"user","title":"https://iot.meross.com","unique_id":"https://iot.meross.com","version":1},
Steps to Reproduce With Meross integration installed:
Restart Home Assistant multiple times.
Inspect the internal configuration storage (.storage/core.config_entries).
Observe that the mqtt_domain entry progressively nests null values like this:
"mqtt_domain": [[null]]
After multiple restarts, the nesting increases:
"mqtt_domain": [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[null]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
Eventually, this corruption prevents Home Assistant from saving any new configurations or integrations, leading to errors.
Your environment HomeAssistant version: 2025.1.4 Hassio Version (if applicable): 14.1 Hardware environment: HA over PROXMOX VM(16G ram) over HP t630 (32G ram)
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
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]
},
},
)
Thanks so mutch! This tipp fixed, what makes me crazy since months!!
I was experiencing this issue the last few days as well, affecting various integrations and it was bothering me, but this solution saved me! Thanks! 👍
Still not fixed (apart form hotfix above) in main integration? Authentication takes an age on HA restart fails, then authenticates after one or more manual reloads.....
I can confirm the above change works for me. I was going crazy setting up Tuya and Tesla Custom Integrations every time HA restarted. Thank you @mauromorello 👍
Same issue and same resolution for me, I hope the fix will be released soon. In my case it broke also Tuya and Tado integrations.
I was struggeling for weeks no with this issue. Tried complete new install with restore, esited several files…. This fix saved my life.
Thank you
Another fix that worked for me is below:
Edit .storage/core.config_entries
find the meross config and delete the mqtt part like below: "mqtt_domain":[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[["mqtt-eu-4.meross.com"]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]],
then save and restart HA.
I've been battling this issue for a few weeks now and it has been driving me crazy! I only stumbled across this thread today. I want to give it a try tomorrow and I am hopeful it will fix my problem.
The text shown a few comments above that goes into init.py .... do I just copy/paste that to the end of the init.py file?
UPDATE: I tried the first way and it didn't work. It stopped the integration from loading at all. I then tried the way suggested one post above and that worked fine. I've had 3 niggling issues and making this change fixed them all!
Updating to v1.3.9+ solves the issue.