grover/homebridge-automation-switches

v.3.2.1 on Homebridge v.2.0.0 beta 20 - TypeError: Service.BridgingState is not a constructor

Opened this issue · 2 comments

Homebridge v2.0.0. beta 20
Plugin: v3.2.1

Runs without error on Homebridge v1.8.4

Crashes with

[9/12/2024, 8:15:25 AM] TypeError: Service.BridgingState is not a constructor
at SwitchAccessory.getBridgingStateService (/homebridge/node_modules/homebridge-automation-switches/src/AutomationSwitchAccessory.js:64:12)
at SwitchAccessory.createServices (/homebridge/node_modules/homebridge-automation-switches/src/AutomationSwitchAccessory.js:46:12)
at new SwitchAccessory (/homebridge/node_modules/homebridge-automation-switches/src/AutomationSwitchAccessory.js:31:27)
at AutomationSwitchesPlatform._createAutomationSwitch (/homebridge/node_modules/homebridge-automation-switches/src/index.js:131:12)
at /homebridge/node_modules/homebridge-automation-switches/src/index.js:96:25
at Array.forEach ()
at AutomationSwitchesPlatform.accessories (/homebridge/node_modules/homebridge-automation-switches/src/index.js:73:14)
at file:///homebridge/node_modules/homebridge/src/bridgeService.ts:494:24
at new Promise ()
at BridgeService.loadPlatformAccessories (file:///homebridge/node_modules/homebridge/src/bridgeService.ts:488:12)
at file:///homebridge/node_modules/homebridge/src/server.ts:464:42
at Array.forEach ()
at Server.loadPlatforms (file:///homebridge/node_modules/homebridge/src/server.ts:386:27)
at Server.start (file:///homebridge/node_modules/homebridge/src/server.ts:167:29)
[9/12/2024, 8:15:25 AM] Got SIGTERM, shutting down Homebridge...
[9/12/2024, 8:15:25 AM] AssertionError [ERR_ASSERTION]: Cannot generate setupURI on an accessory that isn't published yet!
at Bridge.setupURI (/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:897:11)
at Server.setServerStatus (file:///homebridge/node_modules/homebridge/src/server.ts:146:45)
at Server.teardown (file:///homebridge/node_modules/homebridge/src/server.ts:190:10)
at signalHandler (file:///homebridge/node_modules/homebridge/src/cli.ts:94:12)
at process.emit (node:events:519:28)
at process.emit (/homebridge/node_modules/homebridge/node_modules/source-map-support/source-map-support.js:516:21)

I hope there will be an update to match Homebridge v2.0 support because I use the plugin every day.

I just tested this plugin in an new LXC with homebridge 2.0 beta 23.
The plugin will break Homebridge 2.0:

[10/27/2024, 7:44:33 PM] TypeError: Cannot read properties of undefined (reading 'forEach')
at AutomationSwitchesPlatform.accessories (/var/lib/homebridge/node_modules/homebridge-automation-switches/src/index.js:73:14)
at file:///var/lib/homebridge/node_modules/homebridge/src/bridgeService.ts:495:24
at new Promise ()
at BridgeService.loadPlatformAccessories (file:///var/lib/homebridge/node_modules/homebridge/src/bridgeService.ts:489:12)
at file:///var/lib/homebridge/node_modules/homebridge/src/server.ts:464:42
at Array.forEach ()
at Server.loadPlatforms (file:///var/lib/homebridge/node_modules/homebridge/src/server.ts:386:27)
at Server.start (file:///var/lib/homebridge/node_modules/homebridge/src/server.ts:167:29)
[10/27/2024, 7:44:33 PM] Got SIGTERM, shutting down Homebridge...
[10/27/2024, 7:44:33 PM] AssertionError [ERR_ASSERTION]: Cannot generate setupURI on an accessory that isn't published yet!
at Bridge.setupURI (/var/lib/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:897:11)
at Server.setServerStatus (file:///var/lib/homebridge/node_modules/homebridge/src/server.ts:146:45)
at Server.teardown (file:///var/lib/homebridge/node_modules/homebridge/src/server.ts:190:10)
at signalHandler (file:///var/lib/homebridge/node_modules/homebridge/src/cli.ts:94:12)
at process.emit (node:events:519:28)
at process.emit (/var/lib/homebridge/node_modules/homebridge/node_modules/source-map-support/source-map-support.js:516:21)
[10/27/2024, 7:44:38 PM] [HB Supervisor] Homebridge Process Ended. Code: 143, Signal: null

and

[10/27/2024, 7:47:21 PM] AssertionError [ERR_ASSERTION]: Cannot generate setupURI on an accessory that isn't published yet!
at Bridge.setupURI (/var/lib/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:897:11)
at Server.setServerStatus (file:///var/lib/homebridge/node_modules/homebridge/src/server.ts:146:45)
at Server.teardown (file:///var/lib/homebridge/node_modules/homebridge/src/server.ts:190:10)
at signalHandler (file:///var/lib/homebridge/node_modules/homebridge/src/cli.ts:94:12)
at process.emit (node:events:519:28)
at process.emit (/var/lib/homebridge/node_modules/homebridge/node_modules/source-map-support/source-map-support.js:516:21)