Skip to content

Commit

Permalink
Changes for Homebridge 2.0
Browse files Browse the repository at this point in the history
#301 Initial fixes to make the plugin work with Homebridge 2.0
Two basic changes:
1. 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;

2. Change custom characteristics to be classes with constructors, rather than using the inherits() functionality.
  • Loading branch information
dacarson committed Dec 8, 2024
1 parent e73436a commit 276167e
Show file tree
Hide file tree
Showing 3 changed files with 348 additions and 309 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function WeatherPlusPlatform(_log, _config)

// Custom Services and Characteristics
CustomService = require("./util/services")(Service, Characteristic);
CustomCharacteristic = require("./util/characteristics")(Characteristic, this.units);
CustomCharacteristic = require("./util/characteristics")(Characteristic, HomebridgeAPI, this.units);
CurrentConditionsWeatherAccessory = require("./accessories/currentConditions")(Service, Characteristic, CustomService, CustomCharacteristic, FakeGatoHistoryService);
ForecastWeatherAccessory = require("./accessories/forecast")(Service, Characteristic, CustomService, CustomCharacteristic);

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
"weatherflow weather station"
],
"engines": {
"node": ">=10.0.0",
"homebridge": ">=1.0.0"
"node": ">=10.0.0 || ^20.15.1",
"homebridge": ">=1.0.0 || ^2.0.0-beta.0"
},
"author": {
"name": "Arne Blumentritt",
Expand Down
Loading

0 comments on commit 276167e

Please sign in to comment.