Aqara hub M3 joins but fails with java.lang.IndexOutOfBoundsException

I have an Aqara hub M3, and joined to that hub a Aqara Matter Contact Sensor P2.
When i join the Aqara hub to Hubitat over matter, it seems to pair nicely and shows connected to Hubitat.
but when I click configure, i'm presented with the error: java.lang.IndexOutOfBoundsException: Index -1 out of bounds for length 0 on line 284 (method configure)

The log from clicking configure to the error:

[dev:6927](https://192.168.1.5/logs?tab=past&deviceId=6927#)2024-12-21 17:58:59.551[error](https://192.168.1.5/logs?tab=past&deviceId=6927#)java.lang.IndexOutOfBoundsException: Index -1 out of bounds for length 0 on line 284 (method configure)

[dev:6927](https://192.168.1.5/logs?tab=past&deviceId=6927#)2024-12-21 17:58:59.543[debug](https://192.168.1.5/logs?tab=past&deviceId=6927#)Endpoints found: []

[dev:6927](https://192.168.1.5/logs?tab=past&deviceId=6927#)2024-12-21 17:58:59.503[warn](https://192.168.1.5/logs?tab=past&deviceId=6927#)configure()

Strange thing is that when I use kkossev's matter bridge driver, I'm not presented with any error, but the contact sensor is also not found.

When I pair the sensor itself from the Aqara hub with a matter code to Hubitat, the sensor is found and works like a charm.

Is this a known issue?

Aqara Matter Contact Sensor P2 is a Matter-over-thread device, it should not be exposed via the Aqar Matter bridge. This device must be paired to HE using the Matter code generated in the Aqara app.

1 Like

Ok, but why the error in the generic matter bridge driver?

I would guess it is bug in the built in Matter bridge driver. Based on the error it probably only happens if you try to configure the bridge when no importable devices are present, which would not be a normal scenario because whats the point.

Basically, when you run configure it is expecting there to be a device, the code does not account for no devices being present.

You are probably right because I get the exact same error with the zemismart M1 with no device attached.

2 Likes

FYI @bcopeland see above

1 Like

Without any devices paired to the tuya hub, I also get these errors.

By the way, also getting java.lang.NullPointerException: Cannot invoke method toInteger() on null object on line 650 (method parse) error once in a while with HUE hubs connected with Matter.