homebridge-lib 5.6.0 → 5.6.1-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Platform.js +13 -9
- package/package.json +1 -1
package/lib/Platform.js
CHANGED
|
@@ -62,8 +62,6 @@ class Platform extends homebridgeLib.Delegate {
|
|
|
62
62
|
static loadPlatform (homebridge, packageJson, platformName, Platform) {
|
|
63
63
|
if (context.homebridge == null) {
|
|
64
64
|
context.homebridge = homebridge
|
|
65
|
-
context.packageJson = packageJson
|
|
66
|
-
context.platformName = platformName
|
|
67
65
|
context.homebridgeVersion = homebridge.serverVersion
|
|
68
66
|
context.PlatformAccessory = homebridge.platformAccessory
|
|
69
67
|
const hap = {
|
|
@@ -103,6 +101,10 @@ class Platform extends homebridgeLib.Delegate {
|
|
|
103
101
|
my: Object.freeze(my.Characteristics)
|
|
104
102
|
})
|
|
105
103
|
}
|
|
104
|
+
context[Platform.name] = {
|
|
105
|
+
packageJson: packageJson,
|
|
106
|
+
platformName: platformName
|
|
107
|
+
}
|
|
106
108
|
homebridge.registerPlatform(
|
|
107
109
|
packageJson.name, platformName, Platform, true
|
|
108
110
|
)
|
|
@@ -120,7 +122,7 @@ class Platform extends homebridgeLib.Delegate {
|
|
|
120
122
|
* @type {object}
|
|
121
123
|
* @readonly
|
|
122
124
|
*/
|
|
123
|
-
get packageJson () { return
|
|
125
|
+
get packageJson () { return this._myContext.packageJson }
|
|
124
126
|
|
|
125
127
|
/** Create a new instance of the platform plugin.
|
|
126
128
|
*
|
|
@@ -140,19 +142,21 @@ class Platform extends homebridgeLib.Delegate {
|
|
|
140
142
|
this._log = log
|
|
141
143
|
this._configJson = configJson
|
|
142
144
|
this._homebridge = homebridge
|
|
143
|
-
this.
|
|
144
|
-
this.
|
|
145
|
-
this.
|
|
145
|
+
this._myContext = context[this.className]
|
|
146
|
+
this._platformName = this._myContext.platformName
|
|
147
|
+
this._pluginName = this._myContext.packageJson.name
|
|
148
|
+
this._pluginVersion = this._myContext.packageJson.version
|
|
146
149
|
|
|
147
150
|
this._accessories = {}
|
|
148
151
|
this._accessoryDelegates = {}
|
|
149
152
|
|
|
150
|
-
if (
|
|
153
|
+
if (this._myContext.platform != null) {
|
|
151
154
|
this.fatal(
|
|
152
|
-
'config.json: duplicate entry for %s platform',
|
|
155
|
+
'config.json: duplicate entry for %s platform',
|
|
156
|
+
this._myContext.platformName
|
|
153
157
|
)
|
|
154
158
|
}
|
|
155
|
-
|
|
159
|
+
this._myContext.platform = this
|
|
156
160
|
this._identify()
|
|
157
161
|
|
|
158
162
|
this._homebridge
|