krahabb / meross_lan

Home Assistant integration for Meross devices
MIT License
439 stars 47 forks source link

Home Assistant MS315 Outlet states not reflected correctly in Apple HomeKit and Meross App #479

Open phantomski77 opened 2 months ago

phantomski77 commented 2 months ago

Version of the custom_component

5.3.0

Configuration

Describe the bug

I have a strange state synchronisation issue between Home Assistant, Apple HomeKit and Meross app.

I have installed the plug the following way:

Everything is correctly setup, everything works and shows correct entity values and states. There are no errors in the debug logs, all the polling and push (both HTTP and MQTT) seems to operate correctly.

However, there's a strange discrepancy of the outlet state in between the apps:

It's as if the Home Assistant command operates the physical switch, but the switch state is not forwarded as a state change to Meross App and Apple Home app.

To add to a confusion, it happens for all 4 of my MS315 Metering Plugs. It doesn't happen to 5 of my MSS426 Power Surge Protectors. Same setup, same configuration, same basically everything, just different device.

Debug log

Snippet of all 3 ways of switching (no warnings or errors, no obvious issues)


Aug 05 19:29:13 homeassistant homeassistant[582]: 2024-08-05 20:29:13.904 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] Polling begin
Aug 05 19:29:13 homeassistant homeassistant[582]: 2024-08-05 20:29:13.907 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] TX(http) SET Appliance.Control.Multiple (messageId:064aa0f9f46449e3959fee488a190665)
Aug 05 19:29:14 homeassistant homeassistant[582]: 2024-08-05 20:29:14.004 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] RX(http) SETACK Appliance.Control.Multiple (messageId:064aa0f9f46449e3959fee488a190665)
Aug 05 19:29:14 homeassistant homeassistant[582]: 2024-08-05 20:29:14.005 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] Appliance.Control.Multiple requests=3 (responses=3) expected size=1400 (actual=1561)
Aug 05 19:29:14 homeassistant homeassistant[582]: 2024-08-05 20:29:14.006 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] Polling end
Aug 05 19:29:19 homeassistant homeassistant[582]: 2024-08-05 20:29:19.007 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] Polling begin
Aug 05 19:29:19 homeassistant homeassistant[582]: 2024-08-05 20:29:19.010 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] TX(http) SET Appliance.Control.Multiple (messageId:2df4708abcd0421cb3e7bec7ed65239d)
Aug 05 19:29:19 homeassistant homeassistant[582]: 2024-08-05 20:29:19.169 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] RX(http) SETACK Appliance.Control.Multiple (messageId:2df4708abcd0421cb3e7bec7ed65239d)
Aug 05 19:29:19 homeassistant homeassistant[582]: 2024-08-05 20:29:19.171 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] Appliance.Control.Multiple requests=3 (responses=3) expected size=1380 (actual=1548)
Aug 05 19:29:19 homeassistant homeassistant[582]: 2024-08-05 20:29:19.173 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] Polling end
Aug 05 19:29:21 homeassistant homeassistant[582]: 2024-08-05 20:29:21.447 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] RX(mqtt) PUSH Appliance.Control.ToggleX (messageId:c0a09ea6b2eefd876495de74e6e19ca4)
Aug 05 19:29:24 homeassistant homeassistant[582]: 2024-08-05 20:29:24.173 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] Polling begin
Aug 05 19:29:24 homeassistant homeassistant[582]: 2024-08-05 20:29:24.176 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] TX(http) SET Appliance.Control.Multiple (messageId:c352b26787eb4ff6b3d21b1c49098633)
Aug 05 19:29:24 homeassistant homeassistant[582]: 2024-08-05 20:29:24.276 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] RX(http) SETACK Appliance.Control.Multiple (messageId:c352b26787eb4ff6b3d21b1c49098633)
Aug 05 19:29:24 homeassistant homeassistant[582]: 2024-08-05 20:29:24.277 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] Appliance.Control.Multiple requests=3 (responses=3) expected size=1390 (actual=1558)
Aug 05 19:29:24 homeassistant homeassistant[582]: 2024-08-05 20:29:24.278 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] Polling end
Aug 05 19:29:29 homeassistant homeassistant[582]: 2024-08-05 20:29:29.279 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] Polling begin
Aug 05 19:29:29 homeassistant homeassistant[582]: 2024-08-05 20:29:29.282 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] TX(http) SET Appliance.Control.Multiple (messageId:66d4508819154e5583e3edc5638f4148)
Aug 05 19:29:29 homeassistant homeassistant[582]: 2024-08-05 20:29:29.386 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] RX(http) SETACK Appliance.Control.Multiple (messageId:66d4508819154e5583e3edc5638f4148)
Aug 05 19:29:29 homeassistant homeassistant[582]: 2024-08-05 20:29:29.387 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] Appliance.Control.Multiple requests=3 (responses=3) expected size=1400 (actual=1557)
Aug 05 19:29:29 homeassistant homeassistant[582]: 2024-08-05 20:29:29.389 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] Polling end
Aug 05 19:29:30 homeassistant homeassistant[582]: 2024-08-05 20:29:30.491 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] RX(mqtt) PUSH Appliance.Control.ToggleX (messageId:983564d21845e4d9f35d284909701b83)
Aug 05 19:29:34 homeassistant homeassistant[582]: 2024-08-05 20:29:34.390 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] Polling begin
Aug 05 19:29:34 homeassistant homeassistant[582]: 2024-08-05 20:29:34.391 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] TX(http) SET Appliance.Control.Multiple (messageId:42d0dcbd84474278acc293781b356c75)
Aug 05 19:29:34 homeassistant homeassistant[582]: 2024-08-05 20:29:34.491 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] RX(http) SETACK Appliance.Control.Multiple (messageId:42d0dcbd84474278acc293781b356c75)
Aug 05 19:29:34 homeassistant homeassistant[582]: 2024-08-05 20:29:34.492 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] Appliance.Control.Multiple requests=3 (responses=3) expected size=1380 (actual=1548)
Aug 05 19:29:34 homeassistant homeassistant[582]: 2024-08-05 20:29:34.492 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] Polling end
Aug 05 19:29:38 homeassistant homeassistant[582]: 2024-08-05 20:29:38.194 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] TX(http) SET Appliance.Control.ToggleX (messageId:75759a637dfc4bdba1cf596cbc2e65b7)
Aug 05 19:29:38 homeassistant homeassistant[582]: 2024-08-05 20:29:38.310 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] RX(http) SETACK Appliance.Control.ToggleX (messageId:75759a637dfc4bdba1cf596cbc2e65b7)
Aug 05 19:29:39 homeassistant homeassistant[582]: 2024-08-05 20:29:39.493 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] Polling begin
Aug 05 19:29:39 homeassistant homeassistant[582]: 2024-08-05 20:29:39.495 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] TX(http) SET Appliance.Control.Multiple (messageId:0b355f69dc5349db888afd476edc1e75)
Aug 05 19:29:39 homeassistant homeassistant[582]: 2024-08-05 20:29:39.597 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] RX(http) SETACK Appliance.Control.Multiple (messageId:0b355f69dc5349db888afd476edc1e75)
Aug 05 19:29:39 homeassistant homeassistant[582]: 2024-08-05 20:29:39.598 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] Appliance.Control.Multiple requests=3 (responses=3) expected size=1390 (actual=1558)
Aug 05 19:29:39 homeassistant homeassistant[582]: 2024-08-05 20:29:39.600 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] Polling end
Aug 05 19:29:44 homeassistant homeassistant[582]: 2024-08-05 20:29:44.602 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] Polling begin
Aug 05 19:29:44 homeassistant homeassistant[582]: 2024-08-05 20:29:44.604 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] TX(http) SET Appliance.Control.Multiple (messageId:597966671c2249eeb806ec11771cbc17)
Aug 05 19:29:44 homeassistant homeassistant[582]: 2024-08-05 20:29:44.707 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] RX(http) SETACK Appliance.Control.Multiple (messageId:597966671c2249eeb806ec11771cbc17)
Aug 05 19:29:44 homeassistant homeassistant[582]: 2024-08-05 20:29:44.709 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] Appliance.Control.Multiple requests=3 (responses=3) expected size=1400 (actual=1561)
Aug 05 19:29:44 homeassistant homeassistant[582]: 2024-08-05 20:29:44.711 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] Polling end
Aug 05 19:29:46 homeassistant homeassistant[582]: 2024-08-05 20:29:46.405 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] TX(http) SET Appliance.Control.ToggleX (messageId:35a472180ad042149535293f01a965d5)
Aug 05 19:29:46 homeassistant homeassistant[582]: 2024-08-05 20:29:46.523 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] RX(http) SETACK Appliance.Control.ToggleX (messageId:35a472180ad042149535293f01a965d5)
Aug 05 19:29:49 homeassistant homeassistant[582]: 2024-08-05 20:29:49.712 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] Polling begin
Aug 05 19:29:49 homeassistant homeassistant[582]: 2024-08-05 20:29:49.715 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] TX(http) SET Appliance.Control.Multiple (messageId:81d6f7c56d1346b088082f2bcd82b480)
Aug 05 19:29:49 homeassistant homeassistant[582]: 2024-08-05 20:29:49.833 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] RX(http) SETACK Appliance.Control.Multiple (messageId:81d6f7c56d1346b088082f2bcd82b480)
Aug 05 19:29:49 homeassistant homeassistant[582]: 2024-08-05 20:29:49.834 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] Appliance.Control.Multiple requests=3 (responses=3) expected size=1380 (actual=1548)
Aug 05 19:29:49 homeassistant homeassistant[582]: 2024-08-05 20:29:49.835 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] Polling end
Aug 05 19:29:54 homeassistant homeassistant[582]: 2024-08-05 20:29:54.836 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] Polling begin
Aug 05 19:29:54 homeassistant homeassistant[582]: 2024-08-05 20:29:54.839 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] TX(http) SET Appliance.Control.Multiple (messageId:ee306f47e13a49f7918174b28677bbe9)
Aug 05 19:29:54 homeassistant homeassistant[582]: 2024-08-05 20:29:54.957 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] RX(http) SETACK Appliance.Control.Multiple (messageId:ee306f47e13a49f7918174b28677bbe9)
Aug 05 19:29:54 homeassistant homeassistant[582]: 2024-08-05 20:29:54.958 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] Appliance.Control.Multiple requests=3 (responses=3) expected size=1390 (actual=1558)
Aug 05 19:29:54 homeassistant homeassistant[582]: 2024-08-05 20:29:54.959 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] Polling end
Aug 05 19:29:59 homeassistant homeassistant[582]: 2024-08-05 20:29:59.960 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] Polling begin
Aug 05 19:29:59 homeassistant homeassistant[582]: 2024-08-05 20:29:59.963 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] TX(http) SET Appliance.Control.Multiple (messageId:ccc23d77a2de421e954d4e5f9a78dc5f)
Aug 05 19:30:00 homeassistant homeassistant[582]: 2024-08-05 20:30:00.142 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] RX(http) SETACK Appliance.Control.Multiple (messageId:ccc23d77a2de421e954d4e5f9a78dc5f)
Aug 05 19:30:00 homeassistant homeassistant[582]: 2024-08-05 20:30:00.143 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] Appliance.Control.Multiple requests=3 (responses=3) expected size=1433 (actual=1600)
Aug 05 19:30:00 homeassistant homeassistant[582]: 2024-08-05 20:30:00.144 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] Polling end
Aug 05 19:30:05 homeassistant homeassistant[582]: 2024-08-05 20:30:05.145 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] Polling begin
Aug 05 19:30:05 homeassistant homeassistant[582]: 2024-08-05 20:30:05.147 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] TX(http) SET Appliance.Control.Multiple (messageId:c2846cb54f174a11b1d58e2a59e6d67d)
Aug 05 19:30:05 homeassistant homeassistant[582]: 2024-08-05 20:30:05.248 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] RX(http) SETACK Appliance.Control.Multiple (messageId:c2846cb54f174a11b1d58e2a59e6d67d)
Aug 05 19:30:05 homeassistant homeassistant[582]: 2024-08-05 20:30:05.250 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] Appliance.Control.Multiple requests=3 (responses=3) expected size=1390 (actual=1558)
Aug 05 19:30:05 homeassistant homeassistant[582]: 2024-08-05 20:30:05.252 DEBUG (MainThread) [custom_components.meross_lan.mss315_###############################5] Polling end
krahabb commented 2 months ago

A very similar issue (state not reflected in HK and Meross app when operated by meross_lan/HA) was reported in the past and it is likely due to a 'glitch' (say bug) in the device fw where maybe, if the device receives a command over HTTP, it doesn't broadcast the state change over HK. Have you tried 'forcing' the device protocol to use MQTT and see if any difference appears? This is just 'for knowledge' since, if it's a fw issue there's nothing we can do.

phantomski77 commented 2 months ago

I have tried, but unfortunately I'm not able to change the setting. If I select mqtt and submit, I get an error message: Meross cloud profile ([e-mail]) doesn't allow MQTT publishing I have also tried to reconfigure the device for local MQTT binding, but whatever local MQTT broker (local HA, my own with insecure access, both SSL and not) I have I select, I always get unable to connect: TimeoutError (the device is otherwise reachable on the network and can communicate to HA)

krahabb commented 2 months ago

The Meross cloud profile ([e-mail]) doesn't allow MQTT publishing is a reminder you have to configure your Meross account profile (in meross_lan) to allow MQTT publishing. This is an option you'll find by entering your account configuration under the meross_lan integration page. It works as a kind of 'last safety measure' to prevent banning from Meross account services due to MQTT traffic growing too big. There's a rate limiting feature always in place nevertheless that reduces the likelyhood of this (banning due to high traffic) happening so you should be safe enough by allowing MQTT publishing (at least just for trying out if this solves the issue)

phantomski77 commented 2 months ago

First of all - thanks for your patience explaining all this and also for the amount of effort that went into making this integration. Reading through the docs and the functionality available, you've clearly put a lot of thought into this and it seems to use a lot of tools available to us in hass. So thank you.

I have enabled the MQTT publishing in the profile (missed this master option, sorry) and then switched one of the devices to MQTT connection protocol. I've tried to switch the outlet on / off a few times. No obvious errors in the debug log, but HomeKit still didn't play ball - no state changes were reflected there. Soon after that the rate limit was exceeded (probably because rest of the devices are "auto", so started using MQTT as well), so I've disabled it again.

Like you say, it might be a glitch in the device fw. Is there any way how to test it to be sure? is it worth trying to get it through Meross support? When it occurred before, did they respond to bug reports or it just suddenly started working with more recent fw?

kkazempour commented 1 month ago

Same thing is happening for the MSS110. One workaround I thought about was piggy-backing the HomeKit integration through HA and bridging it over to Apple's UI for the family. Watching this thread.

garysargentpersonal commented 3 weeks ago

I'm also getting the same behaviour on the MSS310 - state not reflected back via Matter.