krahabb / meross_lan

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

Cannot connect to a newly paired mss510x #329

Closed wsw70 closed 1 year ago

wsw70 commented 1 year ago

Version of the custom_component

Cloudy.3

Describe the bug

I had issues with a mss510x wall switch that has been working for quite some time but started to misbehave (sometime unreactive, losing connection often, ...). I flashed a new firmware through the Meross application (a 4.x version) and paired it with @bytespider utility with @DominikGebhart PR (https://github.com/bytespider/Meross/pull/60).

The switch was paired to my MQTT, I can see messages when switching it and it was recognized by HA as a new discovery and available on the meross_lan.

I tried to add it and this ended up with

image

The debug logs below show an HTTP TimeoutError so I guess there should be a HTTP endpoint but since I do not know its port I could not check for it.

Debug log

domotique-hass-1  | 2023-10-30 18:34:40.350 DEBUG (MainThread) [custom_components.meross_lan] MerossHttpClient(192.168.10.51:139663704284160): HTTP Request ({"header": {"messageId": "4f4f5be34f6342febb958479bf936777", "namespace": "Appliance.System.All", "method": "GET", "payloadVersion": 1, "from": "Meross", "timestamp": 1698687280, "timestampMs": 0, "sign": "2c9def0b01d089d36d9c0fcc94e6c277"}, "payload": {"all": {}}})
domotique-hass-1  | 2023-10-30 18:37:28.390 DEBUG (MainThread) [custom_components.meross_lan] MerossHttpClient(192.168.10.51:139663683693120): HTTP TimeoutError ()
domotique-hass-1  | 2023-10-30 18:37:28.390 WARNING (MainThread) [custom_components.meross_lan] Error () configuring meross device (host:192.168.10.51)
krahabb commented 1 year ago

The port is usually the http (80) port (meross_lan does not add any fixed port though: it just relies on the standard http port mapping of the libraries..you could also provide the host address as "ip:port" and that would be used instead of the default)

At any rate, if the device is mqtt paired, it should also be automatically discovered and meross_lan would just ask you to confirm the new (discovered) config entry without any further issue.

If this isnt happening maybe the device key provided while pairing the device was different (it is by default empty from what I know of the @bytespider utility)

wsw70 commented 1 year ago

This is really weird. I am starting to wonder if the switches are not failing (but two at the same time?).

I tried a curl on the port 80, it failed, then worked, then failed, ... - I then tried to join it to meross_lan and, behold, it worked.

The device is sometimes available, sometimes not - it is really unstable. I will investigate this more, a dump of the traffic shows some TCP retransmissions, I need to look at that closely.