Can't add Meros smart plug MSS115

The plug connected to the Meros Android app quickly but I can’t add it to HA. I run both HA (the latest version) and the matter server in containers and HA can see the matter integration with no errors. When I try to pair with HA the app completes a number of stages but at the end says that something went wrong. Here is the log from the matter service:

2024-05-05 02:10:42.444 (MainThread) INFO [matter_server.server.device_controller] Starting Matter commissioning using Node ID 4 and IP fe80::4ae1:e9ff:fedc:c4ca (attempt 1/3).
2024-05-05 02:10:46.244 (Dummy-2) CHIP_ERROR [chip.native.EM] Failed to Send CHIP MessageCounter:121153542 on exchange 53347i with Node: <0000000000000000, 0> sendCount: 4 max retries: 4
2024-05-05 02:10:48.672 (Dummy-2) CHIP_ERROR [chip.native.SC] PASESession timed out while waiting for a response from the peer. Expected message type was 332024-05-05 02:10:48.672 (Dummy-2) CHIP_ERROR [chip.native.ZCL] Secure Pairing Failed
2024-05-05 02:10:48.672 (Dummy-2) WARNING [root] Failed to establish secure session to device: src/controller/python/ChipDeviceController-ScriptDevicePairingDelegate.cpp:89: CHIP Error 0x00000003: Incorrect state
2024-05-05 02:10:48.673 (Dummy-2) WARNING [root] Failed to commission: src/controller/python/ChipDeviceController-ScriptDevicePairingDelegate.cpp:89: CHIP Error 0x00000003: Incorrect state
2024-05-05 02:10:53.679 (MainThread) INFO [matter_server.server.device_controller] Starting Matter commissioning using Node ID 4 and IP fe80::4ae1:e9ff:fedc:c4ca (attempt 2/3).
2024-05-05 02:10:57.344 (Dummy-2) CHIP_ERROR [chip.native.EM] Failed to Send CHIP MessageCounter:121153543 on exchange 53348i with Node: <0000000000000000, 0> sendCount: 4 max retries: 4
2024-05-05 02:10:59.907 (Dummy-2) CHIP_ERROR [chip.native.SC] PASESession timed out while waiting for a response from the peer. Expected message type was 332024-05-05 02:10:59.907 (Dummy-2) CHIP_ERROR [chip.native.ZCL] Secure Pairing Failed
2024-05-05 02:10:59.908 (Dummy-2) WARNING [root] Failed to establish secure session to device: src/controller/python/ChipDeviceController-ScriptDevicePairingDelegate.cpp:89: CHIP Error 0x00000003: Incorrect state
2024-05-05 02:10:59.908 (Dummy-2) WARNING [root] Failed to commission: src/controller/python/ChipDeviceController-ScriptDevicePairingDelegate.cpp:89: CHIP Error 0x00000003: Incorrect state
2024-05-05 02:11:04.912 (MainThread) INFO [matter_server.server.device_controller] Starting Matter commissioning using Node ID 4 and IP fe80::4ae1:e9ff:fedc:c4ca (attempt 3/3).
2024-05-05 02:11:08.694 (Dummy-2) CHIP_ERROR [chip.native.EM] Failed to Send CHIP MessageCounter:121153544 on exchange 53349i with Node: <0000000000000000, 0> sendCount: 4 max retries: 4
2024-05-05 02:11:11.140 (Dummy-2) CHIP_ERROR [chip.native.SC] PASESession timed out while waiting for a response from the peer. Expected message type was 332024-05-05 02:11:11.140 (Dummy-2) CHIP_ERROR [chip.native.ZCL] Secure Pairing Failed
2024-05-05 02:11:11.140 (Dummy-2) WARNING [root] Failed to establish secure session to device: src/controller/python/ChipDeviceController-ScriptDevicePairingDelegate.cpp:89: CHIP Error 0x00000003: Incorrect state
2024-05-05 02:11:11.141 (Dummy-2) WARNING [root] Failed to commission: src/controller/python/ChipDeviceController-ScriptDevicePairingDelegate.cpp:89: CHIP Error 0x00000003: Incorrect state
2024-05-05 02:11:11.142 (MainThread) ERROR [matter_server.server.client_handler] [140416868541456] Error while handling: commission_on_network: Commissioning failed for node 4.

Maybe you need to set the device in pairing mode

Yes, I tried that and it didn’t help. I also tried a bunch of other things that are supposed to fix matter issues: tried on/off mDNS on my Unifi router, added wireless adapter to the server running the HA and matter containers so that it is on the same ip subnet as the plug (matter uses tcp multicast and ipv6), etc… I have some background in network engineering and tcp programming but I have no desire to study matter specs just to get one cheap plug to work.

I ended up adding the native Meross integration for HA from HACS and the plug paired with HA instantaneously. IMHO Matter is not as ready as the marketing materials would want to present it.

Hmm, that sounds like multiple NICs, which will not work.
HA, Matter addon, Matter device and commisioning device all need to be on the same IPv6 network and HA and the Matter addon can not have multiple NICs, because there is no way to control IPv6 interfaces in those.

Interesting, thanks for the information. Is the multiple NICs limitation something specific to HA? I have never dealt with ipv6 before. Can’t I just tweak the docker settings in the HA and Matter containers to only use the virtual interface corresponding to the wifi NIC? Also my router supports both ipv6 routing and mDNS forwarding. The mandatory single subnet requirement looks like a major flaw in the standard. I have both wired and wifi networks which use different subnets. Also it is not uncommon to have a separate subnet for IoT devices while sharing the servers for many things (like I do).

The IPv6 protocol is vastly different from the IPv4 protocol.
You should not assume you can use any information from IPv4 in the IPv6 protocol.
Sadly this seems also to be the case with the HA devs, so HA is lacking really important features to setup and manage an IPv6 network. It is not the protocol! It is HA.
Currently you can only expect HA and matter to work with a single NIC in HA and probably also only with the IPv6 set to automatic configuration.

You need to understand that you will have multiple IP-adresses per interface and some will be randomized, some will be semi-randomized, some could be DHCP managed, some could be static and some could be semi-static.
Of these IP-addresses, some will be non-routable, some will be local-routable and some will be global-routable.
You will also have the same network address on multiple, and even on every interface, but it is not the same network, which is what causes the most issue with the Matter addon.
Matter will try to use the FE80 network, which will exist on all your interfaces, but the Matter devices will only be on one of them.
You might even be in a situation where you have different devices with the same IP-address, but on different interfaces.

@alex-v, did you ever get this to work? I am having the same issue. I purchased the MSS115 because it supported Matter and would rather not have to use the Meross integration.

Thanks.

These Incorrect state have likely been caused by re-entrancy issues in the Python Matter SDK layer. I’ve fixed this recently in this PR. Can you try pairing with the latest Python Matter Server 6.1.0?