homebridge: Homebridge not starting after Update

Analysis

After Updating Homebridge to v1.7.0 it’s not starting anymore, could you please assist?

[1/9/2024, 12:23:07 PM] [HB Supervisor] Restarting Homebridge...
[1/9/2024, 12:23:07 PM] [HB Supervisor] Starting Homebridge with extra flags: -I -P /var/lib/homebridge/node_modules --strict-plugin-resolution
[1/9/2024, 12:23:07 PM] [HB Supervisor] Started Homebridge v1.7.0 with PID: 11896
[1/9/2024, 12:23:08 PM] Loaded config.json with 2 accessories and 7 platforms.
[1/9/2024, 12:23:08 PM] Loaded 28 cached accessories from cachedAccessories.
[1/9/2024, 12:23:09 PM] TypeError: Cannot read properties of undefined (reading 'getCharacteristic')
    at Accessory._sideloadServices (/homebridge/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/Accessory.js:1800:13)
    at Function.Accessory.deserialize (/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:2188:15)
    at Function.deserialize (/homebridge/node_modules/homebridge/src/platformAccessory.ts:172:33)
    at /homebridge/node_modules/homebridge/src/bridgeService.ts:240:34
    at Array.map (<anonymous>)
    at BridgeService.loadCachedPlatformAccessoriesFromDisk (/homebridge/node_modules/homebridge/src/bridgeService.ts:239:58)
    at Server.start (/homebridge/node_modules/homebridge/src/server.ts:170:5)
[1/9/2024, 12:23:09 PM] Got SIGTERM, shutting down Homebridge...
[1/9/2024, 12:23:09 PM] AssertionError [ERR_ASSERTION]: Cannot generate setupURI on an accessory that isn't published yet!
    at Bridge.Accessory.setupURI (/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:994:11)
    at Server.setServerStatus (/homebridge/node_modules/homebridge/src/server.ts:155:45)
    at Server.teardown (/homebridge/node_modules/homebridge/src/server.ts:199:10)
    at signalHandler (/homebridge/node_modules/homebridge/src/cli.ts:93:12)
    at process.emit (node:events:514:28)
    at process.emit (/homebridge/node_modules/homebridge/node_modules/source-map-support/source-map-support.js:516:21)
[1/9/2024, 12:23:14 PM] [HB Supervisor] Homebridge Process Ended. Code: 143, Signal: null
[1/9/2024, 12:23:19 PM] [HB Supervisor] Restarting Homebridge...
[1/9/2024, 12:23:19 PM] [HB Supervisor] Starting Homebridge with extra flags: -I -P /var/lib/homebridge/node_modules --strict-plugin-resolution
[1/9/2024, 12:23:19 PM] [HB Supervisor] Started Homebridge v1.7.0 with PID: 11910
[1/9/2024, 12:23:19 PM] Loaded config.json with 2 accessories and 7 platforms.
[1/9/2024, 12:23:20 PM] Loaded 28 cached accessories from cachedAccessories.
[1/9/2024, 12:23:20 PM] TypeError: Cannot read properties of undefined (reading 'getCharacteristic')
    at Accessory._sideloadServices (/homebridge/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/Accessory.js:1800:13)
    at Function.Accessory.deserialize (/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:2188:15)
    at Function.deserialize (/homebridge/node_modules/homebridge/src/platformAccessory.ts:172:33)
    at /homebridge/node_modules/homebridge/src/bridgeService.ts:240:34
    at Array.map (<anonymous>)
    at BridgeService.loadCachedPlatformAccessoriesFromDisk (/homebridge/node_modules/homebridge/src/bridgeService.ts:239:58)
    at Server.start (/homebridge/node_modules/homebridge/src/server.ts:170:5)
[1/9/2024, 12:23:20 PM] Got SIGTERM, shutting down Homebridge...
[1/9/2024, 12:23:20 PM] AssertionError [ERR_ASSERTION]: Cannot generate setupURI on an accessory that isn't published yet!
    at Bridge.Accessory.setupURI (/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:994:11)
    at Server.setServerStatus (/homebridge/node_modules/homebridge/src/server.ts:155:45)
    at Server.teardown (/homebridge/node_modules/homebridge/src/server.ts:199:10)
    at signalHandler (/homebridge/node_modules/homebridge/src/cli.ts:93:12)
    at process.emit (node:events:514:28)
    at process.emit (/homebridge/node_modules/homebridge/node_modules/source-map-support/source-map-support.js:516:21)
[1/9/2024, 12:23:25 PM] [HB Supervisor] Homebridge Process Ended. Code: 143, Signal: null

Expected Behavior

Homebridge should start again

Steps To Reproduce

Logs

[1/9/2024, 12:23:07 PM] [HB Supervisor] Restarting Homebridge...
[1/9/2024, 12:23:07 PM] [HB Supervisor] Starting Homebridge with extra flags: -I -P /var/lib/homebridge/node_modules --strict-plugin-resolution
[1/9/2024, 12:23:07 PM] [HB Supervisor] Started Homebridge v1.7.0 with PID: 11896
[1/9/2024, 12:23:08 PM] Loaded config.json with 2 accessories and 7 platforms.
[1/9/2024, 12:23:08 PM] Loaded 28 cached accessories from cachedAccessories.
[1/9/2024, 12:23:09 PM] TypeError: Cannot read properties of undefined (reading 'getCharacteristic')
    at Accessory._sideloadServices (/homebridge/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/Accessory.js:1800:13)
    at Function.Accessory.deserialize (/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:2188:15)
    at Function.deserialize (/homebridge/node_modules/homebridge/src/platformAccessory.ts:172:33)
    at /homebridge/node_modules/homebridge/src/bridgeService.ts:240:34
    at Array.map (<anonymous>)
    at BridgeService.loadCachedPlatformAccessoriesFromDisk (/homebridge/node_modules/homebridge/src/bridgeService.ts:239:58)
    at Server.start (/homebridge/node_modules/homebridge/src/server.ts:170:5)
[1/9/2024, 12:23:09 PM] Got SIGTERM, shutting down Homebridge...
[1/9/2024, 12:23:09 PM] AssertionError [ERR_ASSERTION]: Cannot generate setupURI on an accessory that isn't published yet!
    at Bridge.Accessory.setupURI (/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:994:11)
    at Server.setServerStatus (/homebridge/node_modules/homebridge/src/server.ts:155:45)
    at Server.teardown (/homebridge/node_modules/homebridge/src/server.ts:199:10)
    at signalHandler (/homebridge/node_modules/homebridge/src/cli.ts:93:12)
    at process.emit (node:events:514:28)
    at process.emit (/homebridge/node_modules/homebridge/node_modules/source-map-support/source-map-support.js:516:21)
[1/9/2024, 12:23:14 PM] [HB Supervisor] Homebridge Process Ended. Code: 143, Signal: null
[1/9/2024, 12:23:19 PM] [HB Supervisor] Restarting Homebridge...
[1/9/2024, 12:23:19 PM] [HB Supervisor] Starting Homebridge with extra flags: -I -P /var/lib/homebridge/node_modules --strict-plugin-resolution
[1/9/2024, 12:23:19 PM] [HB Supervisor] Started Homebridge v1.7.0 with PID: 11910
[1/9/2024, 12:23:19 PM] Loaded config.json with 2 accessories and 7 platforms.
[1/9/2024, 12:23:20 PM] Loaded 28 cached accessories from cachedAccessories.
[1/9/2024, 12:23:20 PM] TypeError: Cannot read properties of undefined (reading 'getCharacteristic')
    at Accessory._sideloadServices (/homebridge/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/Accessory.js:1800:13)
    at Function.Accessory.deserialize (/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:2188:15)
    at Function.deserialize (/homebridge/node_modules/homebridge/src/platformAccessory.ts:172:33)
    at /homebridge/node_modules/homebridge/src/bridgeService.ts:240:34
    at Array.map (<anonymous>)
    at BridgeService.loadCachedPlatformAccessoriesFromDisk (/homebridge/node_modules/homebridge/src/bridgeService.ts:239:58)
    at Server.start (/homebridge/node_modules/homebridge/src/server.ts:170:5)
[1/9/2024, 12:23:20 PM] Got SIGTERM, shutting down Homebridge...
[1/9/2024, 12:23:20 PM] AssertionError [ERR_ASSERTION]: Cannot generate setupURI on an accessory that isn't published yet!
    at Bridge.Accessory.setupURI (/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:994:11)
    at Server.setServerStatus (/homebridge/node_modules/homebridge/src/server.ts:155:45)
    at Server.teardown (/homebridge/node_modules/homebridge/src/server.ts:199:10)
    at signalHandler (/homebridge/node_modules/homebridge/src/cli.ts:93:12)
    at process.emit (node:events:514:28)
    at process.emit (/homebridge/node_modules/homebridge/node_modules/source-map-support/source-map-support.js:516:21)
[1/9/2024, 12:23:25 PM] [HB Supervisor] Homebridge Process Ended. Code: 143, Signal: null

Configuration

{
    "bridge": {
        "name": "Homebridge A296",
        "username": "",
        "port": 53784,
        "pin": ""
    },
    "accessories": [
        {
            "name": "Saugroboter",
            "ip": "192.168.0.59",
            "token": "",
            "waterBox": false,
            "silent": false,
            "pause": true,
            "pauseWord": "pause",
            "findMe": false,
            "findMeWord": "where are you",
            "dock": true,
            "cleanword": "cleaning",
            "roomTimeout": 0,
            "autoroom": false,
            "accessory": "XiaomiRoborockVacuum"
        },
        {
            "name": "Luftreiniger",
            "address": "192.168.0.35",
            "token": "",
            "enableAirQuality": true,
            "enableTemperature": true,
            "enableHumidity": true,
            "filterChangeThreshold": 5,
            "enableFanSpeedControl": false,
            "enableChildLockControl": false,
            "accessory": "XiaomiMiAirPurifier"
        }
    ],
    "platforms": [
        {
            "name": "Config",
            "port": 8581,
            "platform": "config"
        },
        {
            "name": "Hue",
            "anyOn": true,
            "effects": true,
            "hosts": [
                "192.168.0.4"
            ],
            "lights": true,
            "nativeHomeKitLights": true,
            "nativeHomeKitSensors": true,
            "resource": true,
            "platform": "Hue",
            "users": {
                "": ""
            }
        },
        {
            "platform": "AutomationSwitches",
            "switches": [
                {
                    "type": "switch",
                    "name": "Heizung Sommer Schaltung",
                    "stored": true,
                    "default": false
                },
                {
                    "type": "switch",
                    "name": "Olivia anwesend",
                    "stored": true,
                    "default": false
                },
                {
                    "type": "switch",
                    "name": "Marco anwesend",
                    "stored": true,
                    "default": false
                },
                {
                    "type": "switch",
                    "name": "EsszimmerSzene aktiv",
                    "stored": true,
                    "default": false
                },
                {
                    "type": "switch",
                    "name": "WohnzimmerSzene aktiv",
                    "stored": true,
                    "default": false
                },
                {
                    "type": "switch",
                    "name": "WohnEsszimmerSzene aktiv",
                    "stored": true,
                    "default": false
                }
            ]
        },
        {
            "name": "Nuki",
            "platform": "NB"
        },
        {
            "mqtt": {
                "base_topic": "zigbee2mqtt",
                "server": "mqtt://192.168.0.10:1883",
                "reject_unauthorized": false,
                "keepalive": 60,
                "version": 4,
                "disable_qos": false
            },
            "defaults": {
                "exclude": false
            },
            "exclude_grouped_devices": false,
            "platform": "zigbee2mqtt"
        },
        {
            "clientid": "",
            "simulator": false,
            "language": {
                "api": "de-DE"
            },
            "platform": "HomeConnect"
        },
        {
            "authCode": "032-104",
            "pollInterval": 60,
            "platform": "laundrify"
        }
    ],
    "disabledPlugins": [
        "homebridge-fhem"
    ]
}

Environment

  • OS: (Docker) Ubuntu Focal Fossa (20.04.5 LTS)
  • Node.js Version | v20.10.0
  • HB-Version v1.7.0

Process Supervisor

Docker (Mention image name in Additional Context)

Additional Context

oznu/homebridge/

About this issue

  • Original URL
  • State: open
  • Created 6 months ago
  • Comments: 20 (6 by maintainers)

Most upvoted comments

had to delete cachedAccessories under /homebridge - now it’s working again

I am not a programmer so take this with a big grain of salt. I compared the two files and in the working file, the nextAID value is 326, and there is no entry for 5c7554d8-f473-432c-b4c0-6bf68482b2e2.

In the crashing file, the nextAID value is 327, and the entry for 5c7554d8-f473-432c-b4c0-6bf68482b2e2 is present with a value of 326.

Could this discrepancy be due to a synchronization issue or a state change that was captured in the crashing file but not in the working file?

This is a very bad error message (no clarity for end-user) and even worse solution is proposed here as removing ALL cached accessories will ruin lots of your Home app automations and you’d have to re-create them from scratch MANUALLY. Total insanity for larger homes with dozens of automations accumulated over the years.

Anyhow, a bit late for me, as my home setup is pretty much ruined by this upgrade, but for others: do NOT reset your accessories cache unless your setup is very simple. Instead, manually open your /var/lib/homebridge/accessories/cachedAccessories (location may vary, see https://github.com/homebridge/homebridge/wiki/How-To-Fix-Node.js-Install-Issues-On-Linux#homebridge-storage-folder),

then inside cachedAccessories look for an accessory that seems very empty (i.e. empty arrays, some nulls etc), example:

{
        "category": 1,
        "context": {
            "device": {
                "definition": null,
                "disabled": false,
                "endpoints": {
                    "1": {
                        "bindings": [],
                        "clusters": {
                            "input": [],
                            "output": []
                        },
                        "configured_reportings": [],
                        "scenes": []
                    },
                    "2": {
                        "bindings": [],
                        "clusters": {
                            "input": [],
                            "output": []
                        },
                        "configured_reportings": [],
                        "scenes": []
                    },
                    "3": {
                        "bindings": [],
                        "clusters": {
                            "input": [],
                            "output": []
                        },
                        "configured_reportings": [],
                        "scenes": []
                    },
                    "4": {
                        "bindings": [],
                        "clusters": {
                            "input": [],
                            "output": []
                        },
                        "configured_reportings": [],
                        "scenes": []
                    },
                    "5": {
                        "bindings": [],
                        "clusters": {
                            "input": [],
                            "output": []
                        },
                        "configured_reportings": [],
                        "scenes": []
                    },
                    "6": {
                        "bindings": [],
                        "clusters": {
                            "input": [],
                            "output": []
                        },
                        "configured_reportings": [],
                        "scenes": []
                    },
                    "8": {
                        "bindings": [],
                        "clusters": {
                            "input": [],
                            "output": []
                        },
                        "configured_reportings": [],
                        "scenes": []
                    },
                    "10": {
                        "bindings": [],
                        "clusters": {
                            "input": [],
                            "output": []
                        },
                        "configured_reportings": [],
                        "scenes": []
                    },
                    "11": {
                        "bindings": [],
                        "clusters": {
                            "input": [
                                "ssIasAce"
                            ],
                            "output": [
                                "ssIasWd",
                                "ssIasZone"
                            ]
                        },
                        "configured_reportings": [],
                        "scenes": []
                    },
                    "12": {
                        "bindings": [],
                        "clusters": {
                            "input": [],
                            "output": []
                        },
                        "configured_reportings": [],
                        "scenes": []
                    },
                    "13": {
                        "bindings": [],
                        "clusters": {
                            "input": [
                                "genOta"
                            ],
                            "output": []
                        },
                        "configured_reportings": [],
                        "scenes": []
                    },
                    "47": {
                        "bindings": [],
                        "clusters": {
                            "input": [],
                            "output": []
                        },
                        "configured_reportings": [],
                        "scenes": []
                    },
                    "110": {
                        "bindings": [],
                        "clusters": {
                            "input": [],
                            "output": []
                        },
                        "configured_reportings": [],
                        "scenes": []
                    },
                    "242": {
                        "bindings": [],
                        "clusters": {
                            "input": [],
                            "output": []
                        },
                        "configured_reportings": [],
                        "scenes": []
                    }
                },
                "friendly_name": "Coordinator",
                "ieee_address": "0x00124b00258d3b72",
                "interview_completed": true,
                "interviewing": false,
                "network_address": 0,
                "supported": true,
                "type": "Coordinator"
            }
        },
        "displayName": "Coordinator",
        "platform": "zigbee2mqtt",
        "plugin": "homebridge-z2m",
        "services": [],
        "UUID": "ea330e77-e868-431d-a14c-9acaca3e32c6"
    }
    

Now you can go back to Homebridge UI and in settings instead of removing all cached accessories, remove this single one and see if it helps. There might be several of these, so remove them one by one to find the culprit.

Hope it saves someone a day of restoring your home to a working condition.

To devs: this error message is very generic and essentially useless as it lacks any details about the failed accessory. It may be a good idea to improve parsing function so the UUID of a failed device ends up in catch block so user can somehow act upon it, or even remove such device from cache automatically.