Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Homebridge v2.0.0 beta 21 - TypeError: Class constructor Characteristic #12

Open
fubu2k opened this issue Sep 18, 2024 · 3 comments
Open

Comments

@fubu2k
Copy link

fubu2k commented Sep 18, 2024

Homebride v2.0.0 beta 21
Plugin v0.2.2

Runs without error on Homebridge v1.8.4

Error:

[9/18/2024, 3:17:06 PM] [Sonne] Child bridge starting (pid 550)...
[9/18/2024, 3:17:06 PM] Registering platform 'homebridge-seasons.Seasons'
[9/18/2024, 3:17:06 PM] [Sonne] Child bridge started successfully (plugin v0.2.2).
[9/18/2024, 3:17:06 PM] Loaded 0 cached accessories from cachedAccessories.0E59D532C9DE.
/homebridge/node_modules/homebridge-sun-position/index.js:17
Characteristic.call(this, 'Altitude', ALTITUDE_UUID);
^
TypeError: Class constructor Characteristic cannot be invoked without 'new'
at new AltitudeCharacteristic (/homebridge/node_modules/homebridge-sun-position/index.js:17:18)
at LightSensor.addCharacteristic (/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Service.ts:518:57)
at SunPositionAccessory.getServices (/homebridge/node_modules/homebridge-sun-position/index.js:72:18)
at BridgeService.createHAPAccessory (file:///homebridge/node_modules/homebridge/src/bridgeService.ts:439:41)
at ChildBridgeFork.startBridge (file:///homebridge/node_modules/homebridge/src/childBridgeFork.ts:179:46)
[9/18/2024, 3:17:06 PM] [Sonne] Child bridge ended (code 1, signal null). The child bridge ended unexpectedly, which is normally due to the plugin not catching its errors properly. Please report this to the plugin developer by clicking on the 'Report An Issue' option in the plugin menu dropdown from the Homebridge UI. If there are related logs shown above, please include them in your report.
[9/18/2024, 3:17:06 PM] [Sonne] Child bridge will automatically restart in 40 seconds (restart attempt 4 of 4).

@keybuk
Copy link
Owner

keybuk commented Sep 18, 2024

Thanks for the report, let me know if you have a PR that fixes it

@fubu2k
Copy link
Author

fubu2k commented Sep 18, 2024

Dont have a PR at the Moment :-/

This are the change with HB 2.0:

Common long-deprecated code patterns that may need updating:
BatteryService has been removed in favour of Battery
Use of enums off the Characteristic class is no longer supported:
Instead of const Units = Characteristic.Units; you will need to use const Units = api.hap.Units;
Instead of const Formats = Characteristic.Formats; you will need to use const Formats = api.hap.Formats;
Instead of const Perms = Characteristic.Perms; you will need to use const Perms = api.hap.Perms;
Characteristic.getValue() has been removed in favour of Characteristic.value
Accessory.getServiceByUUIDAndSubType() has been removed: you can swap this for Accessory.getServiceById()
Accessory.updateReachability() has been removed: reachability in general is no longer supported
Accessory.setPrimaryService(Service) has been removed: use Service.setPrimaryService() instead
Remove the long-deprecated init().
Deprecate Core, BridgedCore and legacy Camera characteristics
For deprecated Core and BridgedCore see: https://github.com/homebridge/HAP-NodeJS/wiki/Deprecation-of-Core-and-BridgeCore
For deprecated storagePath switch to HAPStorage.setCustomStoragePath
For AudioCodec switch to AudioStreamingCodec
For VideoCodec switch to H264CodecParameters
For StreamAudioParams switch to AudioStreamingOptions
For StreamVideoParams switch to VideoStreamingOptions
For cameraSource switch to CameraController
Other deprecated code to highlight removed: useLegacyAdvertiser, AccessoryLoader
For Fix: Naming for Characteristic.ProgramMode has been corrected from PROGRAM_SCHEDULED_MANUAL_MODE_ to PROGRAM_SCHEDULED_MANUAL_MODE

@keybuk
Copy link
Owner

keybuk commented Sep 19, 2024

I'm still using HomeBridge 1.6.1, so haven't tested the plugin with anything later than that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants