Matter accessory state supplied during cache re-registration is not reflected in restored endpoint
Analysis
Matter accessory state supplied during cache re-registration is not reflected in restored endpoint
Description
When a plugin re-registers a Matter accessory that Homebridge has already restored from the Matter accessory cache, the cluster state supplied by the plugin can differ from the state exposed by the restored accessory.
For example, the plugin registers an OnOffSwitch with:
clusters: {
onOff: {
onOff: true,
},
},Immediately before calling registerPlatformAccessories(), the accessory passed to Homebridge contains:
"clusters": {
"onOff": {
"onOff": true
}
}Homebridge successfully attaches the plugin registration to the previously restored accessory, but the switch continues to be displayed as Off.
It is unclear whether the intended behavior is for the plugin-provided state to replace the restored state, or for the cached/restored endpoint state to remain authoritative.
Steps to reproduce
- Register a Matter
OnOffSwitch. - Allow Homebridge to save the accessory to its Matter cache with
onOffstate set tofalse. - Restart Homebridge.
- Homebridge restores the Matter accessory from cache.
- Have the plugin re-register the same accessory UUID using
registerPlatformAccessories(), supplying:
clusters: {
onOff: {
onOff: true,
},
},- Observe that Homebridge successfully attaches the plugin registration to the restored accessory.
- Observe that the switch remains displayed as Off rather than reflecting the
truestate supplied during plugin registration.
Expected behavior
The behavior of cluster state during re-registration of a cache-restored accessory should be well defined.
If the plugin registration is intended to be authoritative, the existing Matter endpoint should be synchronized with the cluster state supplied by the plugin.
If restored cached state is intentionally authoritative, this should be documented so plugins know that the clusters values supplied during re-registration will not replace the live restored endpoint state.
Actual behavior
The plugin supplies:
"clusters": {
"onOff": {
"onOff": true
}
}but the restored accessory remains Off.
Homebridge otherwise successfully attaches the plugin to the restored accessory and registers its handlers:
[Matter/API] homebridge-virtual-matter-accessories: Registering 1 Matter accessory for platform 'VirtualMatterAccessoriesForHomebridge'
[Matter/Server] Attached plugin registration to restored accessory Matter Switch 1 (e6095709-b423-46b1-84f7-cfd5c84e5353)
[Matter/Server] Setting up handlers for accessory e6095709-b423-46b1-84f7-cfd5c84e5353
[Matter/RegistryManager] Registered registry for endpoint: e6095709-b423-46b1-84f7-cfd5c84e5353
[Matter/Server] Processing cluster: onOff
[Matter/Behaviors] Registered handler: e6095709-b423-46b1-84f7-cfd5c84e5353.onOff.on
[Matter/Behaviors] Registered handler: e6095709-b423-46b1-84f7-cfd5c84e5353.onOff.offImmediately before registration, the plugin logs the Matter accessory being supplied to Homebridge:
{
"UUID": "e6095709-b423-46b1-84f7-cfd5c84e5353",
"displayName": "Matter Switch 1",
"clusters": {
"onOff": {
"onOff": true
}
},
"handlers": {
"onOff": {}
}
}(handlers.onOff appears empty because functions are omitted by JSON.stringify; separate logging confirms that both on and off are functions.)
Possible cause
The cache-restoration registration path appears to retain the existing Matter endpoint while updating the stored accessory representation and attaching the plugin's live handlers.
Conceptually, this can leave:
Plugin MatterAccessory
clusters.onOff.onOff = true
↓ re-registration
Stored accessory metadata
clusters.onOff.onOff = true
Existing restored Matter endpoint
onOff state = falseIf this is the intended lifecycle, plugins need a documented mechanism for deciding whether to preserve restored state or explicitly synchronize the restored endpoint with their own authoritative state.
Additional information
This issue is distinct from:
- Newly registered Matter accessories not appearing in the Homebridge UI until restart.
- Homebridge UI controls not invoking registered Matter
onOffhandlers.
This report concerns specifically the state supplied by a plugin when attaching to an accessory that Homebridge has already restored from its Matter cache.
Expected Behavior
N/A
Steps To Reproduce
N/A
Logs
N/AConfiguration
{
"bridge": {
"name": "Homebridge D459",
"username": "0E:E3:8A:15:D4:59",
"port": 51046,
"pin": "755-48-265",
"advertiser": "bonjour-hap",
"matter": {
"port": 5530
}
},
"accessories": [],
"platforms": [
{
"name": "Config",
"platform": "config",
"port": 8581,
"tempUnits": "f",
"theme": "orange",
"lightingMode": "auto",
"menuMode": "freeze",
"log": {
"maxSize": 2000000
},
"lang": "auto",
"homebridgeUiUpdatePolicy": "beta",
"homebridgeUpdatePolicy": "beta"
},
{
"name": "Homebridge Dummy",
"accessories": [
{
"id": "3c7862f3-58e1-46d8-9f2a-69d963b98791",
"name": "Dummy 1",
"type": "Switch",
"protocol": "Matter",
"defaultState": "on",
"resetOnRestart": false,
"enableWebhook": false,
"disableLogging": false
}
],
"platform": "HomebridgeDummy"
}
],
"disabledPlugins": []
}Environment
OS: macOS 26.5.1 Homebridge: v2.4.1-beta.11 Homebridge UI: v5.29.1-beta.1 Node: v24.11.0
Process Supervisor
hb-service
Additional Context
No response
Source: homebridge/homebridge