#4015·homebridge

Matter accessory state supplied during cache re-registration is not reflected in restored endpoint

Author: justjam2013Created Sep 20, 2026Updated Sep 20, 2026
Labelsbug

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:

typescript
clusters: {
  onOff: {
    onOff: true,
  },
},

Immediately before calling registerPlatformAccessories(), the accessory passed to Homebridge contains:

json
"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

  1. Register a Matter OnOffSwitch.
  2. Allow Homebridge to save the accessory to its Matter cache with onOff state set to false.
  3. Restart Homebridge.
  4. Homebridge restores the Matter accessory from cache.
  5. Have the plugin re-register the same accessory UUID using registerPlatformAccessories(), supplying:
typescript
clusters: {
  onOff: {
    onOff: true,
  },
},
  1. Observe that Homebridge successfully attaches the plugin registration to the restored accessory.
  2. Observe that the switch remains displayed as Off rather than reflecting the true state 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:

json
"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.off

Immediately before registration, the plugin logs the Matter accessory being supplied to Homebridge:

json
{
  "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 = false

If 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:

  1. Newly registered Matter accessories not appearing in the Homebridge UI until restart.
  2. Homebridge UI controls not invoking registered Matter onOff handlers.

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

markdown
N/A

Configuration

json
{
    "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