homebridge-lib 5.6.0 → 5.6.2
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 +10 -9
- package/lib/SystemInfo.js +5 -3
- package/package.json +3 -3
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,7 @@ class Platform extends homebridgeLib.Delegate {
|
|
|
103
101
|
my: Object.freeze(my.Characteristics)
|
|
104
102
|
})
|
|
105
103
|
}
|
|
104
|
+
context[Platform.name] = { packageJson, platformName }
|
|
106
105
|
homebridge.registerPlatform(
|
|
107
106
|
packageJson.name, platformName, Platform, true
|
|
108
107
|
)
|
|
@@ -120,7 +119,7 @@ class Platform extends homebridgeLib.Delegate {
|
|
|
120
119
|
* @type {object}
|
|
121
120
|
* @readonly
|
|
122
121
|
*/
|
|
123
|
-
get packageJson () { return
|
|
122
|
+
get packageJson () { return this._myContext.packageJson }
|
|
124
123
|
|
|
125
124
|
/** Create a new instance of the platform plugin.
|
|
126
125
|
*
|
|
@@ -140,19 +139,21 @@ class Platform extends homebridgeLib.Delegate {
|
|
|
140
139
|
this._log = log
|
|
141
140
|
this._configJson = configJson
|
|
142
141
|
this._homebridge = homebridge
|
|
143
|
-
this.
|
|
144
|
-
this.
|
|
145
|
-
this.
|
|
142
|
+
this._myContext = context[this.className]
|
|
143
|
+
this._platformName = this._myContext.platformName
|
|
144
|
+
this._pluginName = this._myContext.packageJson.name
|
|
145
|
+
this._pluginVersion = this._myContext.packageJson.version
|
|
146
146
|
|
|
147
147
|
this._accessories = {}
|
|
148
148
|
this._accessoryDelegates = {}
|
|
149
149
|
|
|
150
|
-
if (
|
|
150
|
+
if (this._myContext.platform != null) {
|
|
151
151
|
this.fatal(
|
|
152
|
-
'config.json: duplicate entry for %s platform',
|
|
152
|
+
'config.json: duplicate entry for %s platform',
|
|
153
|
+
this._myContext.platformName
|
|
153
154
|
)
|
|
154
155
|
}
|
|
155
|
-
|
|
156
|
+
this._myContext.platform = this
|
|
156
157
|
this._identify()
|
|
157
158
|
|
|
158
159
|
this._homebridge
|
package/lib/SystemInfo.js
CHANGED
|
@@ -293,10 +293,12 @@ class SystemInfo extends events.EventEmitter {
|
|
|
293
293
|
'plutil', '-p',
|
|
294
294
|
process.env.HOME + '/Library/Preferences/com.apple.SystemProfiler.plist'
|
|
295
295
|
)
|
|
296
|
-
const regexp = RegExp(
|
|
296
|
+
const regexp = RegExp(
|
|
297
|
+
'"(' + id.slice(-4) + '|' + id.slice(-3) + ').*" => "(.*)"'
|
|
298
|
+
)
|
|
297
299
|
const a = regexp.exec(text)
|
|
298
|
-
if (a
|
|
299
|
-
prettyName = a[
|
|
300
|
+
if (a != null) {
|
|
301
|
+
prettyName = a[2]
|
|
300
302
|
}
|
|
301
303
|
} else { // Apple silicon
|
|
302
304
|
text = await this.execShell('ioreg -l | grep product-description')
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Library for homebridge plugins",
|
|
4
4
|
"author": "Erik Baauw",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
|
-
"version": "5.6.
|
|
6
|
+
"version": "5.6.2",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"homekit",
|
|
9
9
|
"homebridge"
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"upnp": "cli/upnp.js"
|
|
22
22
|
},
|
|
23
23
|
"engines": {
|
|
24
|
-
"homebridge": "^1.
|
|
25
|
-
"node": "^16.
|
|
24
|
+
"homebridge": "^1.5.0",
|
|
25
|
+
"node": "^16.16.0"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@homebridge/plugin-ui-utils": "~0.0.19",
|