Description
Switch cluster (cluster 59) events from MOES Matter Wired Gateway sub-devices fail to decode on both the stable Python Matter Server and the matter.js beta. Button press events (InitialPress, ShortRelease, MultiPressComplete) are received but dropped due to a type mismatch in the TLV decoder.
Environment
- Home Assistant: 2026.4.1
- Home Assistant OS: 17.2 (aarch64 / raspberrypi5-64)
- Matter Server Add-on: 8.4.0
- Matter SDK Wheels: tested with both 2025.7.0 (bundled) and 2024.11.4 (pinned)
- Gateway: MOES Matter Wired Gateway (Tuya-based, Zigbee sub-devices bridged to Matter)
- Affected devices: Tuya wireless scene switches (1GangSwitchAndScene, 4 Scene Switch) connected via MOES gateway
Error (Python Matter Server - stable)
ERROR [chip.clusters.Attribute] Error convering TLV to Cluster Object for path: Endpoint = None/Cluster = 59/Event = 1
ERROR [chip.clusters.Attribute] Failed Cluster Object: <class 'chip.clusters.Objects.Switch.Events.InitialPress'>
ERROR [chip.clusters.Attribute] Failed to decode field .newPosition, expected type <class 'chip.tlv.uint'>, got <class 'int'>
ERROR [chip.clusters.Attribute] Error convering TLV to Cluster Object for path: Endpoint = None/Cluster = 59/Event = 3
ERROR [chip.clusters.Attribute] Failed Cluster Object: <class 'chip.clusters.Objects.Switch.Events.ShortRelease'>
ERROR [chip.clusters.Attribute] Failed to decode field .previousPosition, expected type <class 'chip.tlv.uint'>, got <class 'int'>
ERROR [chip.clusters.Attribute] Error convering TLV to Cluster Object for path: Endpoint = None/Cluster = 59/Event = 6
ERROR [chip.clusters.Attribute] Failed Cluster Object: <class 'chip.clusters.Objects.Switch.Events.MultiPressComplete'>
ERROR [chip.clusters.Attribute] Failed to decode field .previousPosition, expected type <class 'chip.tlv.uint'>, got <class 'int'>
Error (matter.js beta)
ERROR EventDataDecoder Error decoding event 124/59/1: Unexpected type 0, was expecting 4.
ERROR EventDataDecoder Error decoding event 124/59/3: Unexpected type 0, was expecting 4.
ERROR EventDataDecoder Error decoding event 124/59/6: Unexpected type 0, was expecting 4.
Expected Behavior
Button press events (InitialPress event=1, ShortRelease event=3, MultiPressComplete event=6) from Switch cluster 59 should be decoded successfully and forwarded to Home Assistant as event entities, allowing automations to trigger on button presses.
Actual Behavior
Events are received from the MOES gateway but the TLV decoder rejects them because the newPosition and previousPosition fields are encoded as Python int instead of chip.tlv.uint. The events are silently dropped and never reach Home Assistant.
Root Cause
The MOES gateway encodes the position fields as a standard integer (TLV type 0) instead of the unsigned integer type (TLV type 4) expected by the Matter specification. The SDK decoder performs a strict type check and rejects the value.
Suggested Fix
The decoder should accept int as a valid value for uint fields, since they are semantically compatible. A lenient type coercion (e.g., int → uint) would resolve this for all devices with this firmware behavior.
Notes
- This was working in earlier versions of HA (pre-2026.4.x) — the MOES gateway firmware may have updated during a factory reset, or the SDK previously handled this more leniently
- Affects all Tuya/MOES Zigbee sub-devices that send Switch cluster events through the Matter bridge
- The gateway itself and all other functionality (on/off switches, sensors) work correctly — only event decoding is affected
Description
Switch cluster (cluster 59) events from MOES Matter Wired Gateway sub-devices fail to decode on both the stable Python Matter Server and the matter.js beta. Button press events (InitialPress, ShortRelease, MultiPressComplete) are received but dropped due to a type mismatch in the TLV decoder.
Environment
Error (Python Matter Server - stable)
Error (matter.js beta)
Expected Behavior
Button press events (InitialPress event=1, ShortRelease event=3, MultiPressComplete event=6) from Switch cluster 59 should be decoded successfully and forwarded to Home Assistant as event entities, allowing automations to trigger on button presses.
Actual Behavior
Events are received from the MOES gateway but the TLV decoder rejects them because the
newPositionandpreviousPositionfields are encoded as Pythonintinstead ofchip.tlv.uint. The events are silently dropped and never reach Home Assistant.Root Cause
The MOES gateway encodes the position fields as a standard integer (TLV type 0) instead of the unsigned integer type (TLV type 4) expected by the Matter specification. The SDK decoder performs a strict type check and rejects the value.
Suggested Fix
The decoder should accept
intas a valid value foruintfields, since they are semantically compatible. A lenient type coercion (e.g.,int→uint) would resolve this for all devices with this firmware behavior.Notes