node-red-contrib-homekit-bridged 1.4.0 → 1.4.3-dev.1
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/CHANGELOG.md +24 -1
- package/README.md +1 -1
- package/build/lib/Storage.d.ts +2 -2
- package/build/lib/Storage.js +8 -6
- package/build/lib/api.js +2 -0
- package/build/lib/utils/ServiceUtils2.js +10 -4
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,29 @@ All notable changes to this project will be documented in this file.
|
|
|
11
11
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres
|
|
12
12
|
to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
13
13
|
|
|
14
|
+
## [1.4.3-dev.1]
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- Pass Characteristic key in event context for Service2
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- Updated hap-nodejs to [0.9.6](https://github.com/homebridge/HAP-NodeJS/releases/tag/v0.9.6) (bug fixes and security fixes)
|
|
23
|
+
|
|
24
|
+
## [1.4.2]
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
|
|
28
|
+
- Resolve issue with customCharacteristics not loading from file
|
|
29
|
+
- Fixed publish process
|
|
30
|
+
|
|
31
|
+
## [1.4.1]
|
|
32
|
+
|
|
33
|
+
### Fixed
|
|
34
|
+
|
|
35
|
+
- Fix readme appearance on `flows.nodered.org`
|
|
36
|
+
|
|
14
37
|
## [1.4.0]
|
|
15
38
|
|
|
16
39
|
### Fixed
|
|
@@ -33,7 +56,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
33
56
|
|
|
34
57
|
### Changed
|
|
35
58
|
|
|
36
|
-
- Updated hap-nodejs to 0.9.5 (added new iOS 15 Services and Characteristics)
|
|
59
|
+
- Updated hap-nodejs to [0.9.5](https://github.com/homebridge/HAP-NodeJS/releases/tag/v0.9.5) (added new iOS 15 Services and Characteristics)
|
|
37
60
|
- Updated dependencies to latest versions
|
|
38
61
|
- Changed `BatteryService` to `Battery` in demo examples as `BatteryService` is deprecated #381 - thanks @crxporter
|
|
39
62
|
- Readme rework - thanks @crxporter
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
#### Do you need setup help? Have a great idea? Want to shoot the breeze with fellow users? [Join us on our Discord server!](https://discord.gg/uvYac5u)
|
|
6
6
|
|
|
7
|
-
### <img src="https://github.com/NRCHKB/NRCHKB.github.io/raw/master/static/images/presentation/demonstration.gif"
|
|
7
|
+
### <img src="https://github.com/NRCHKB/NRCHKB.github.io/raw/master/static/images/presentation/demonstration.gif" alt="NRCHKB Demonstration" align="right"/> About this Contrib
|
|
8
8
|
|
|
9
9
|
This is a collection of nodes which can be used to imitate HomeKit devices inside of Node-RED. Messages coming into these nodes are able to set device states and status in Apple's iOS and MacOS Home apps. Commands from Home apps (or Siri) will be passed from these nodes into your Node-RED flows.
|
|
10
10
|
|
package/build/lib/Storage.d.ts
CHANGED
|
@@ -13,13 +13,13 @@ export declare class Storage {
|
|
|
13
13
|
private static log;
|
|
14
14
|
static storagePath(): string;
|
|
15
15
|
static init(...storagePathSegments: string[]): Promise<InitOptions>;
|
|
16
|
-
static save(type: StorageType, key: string, value: unknown): Promise<storage.WriteFileResult>;
|
|
16
|
+
static save(type: StorageType, key: string | undefined, value: unknown): Promise<storage.WriteFileResult>;
|
|
17
17
|
static saveCallback(eventCallback: EventCallback, ttl?: number): string;
|
|
18
18
|
static saveCustomCharacteristics(value: unknown): Promise<storage.WriteFileResult>;
|
|
19
19
|
static saveService(key: string, value: unknown): Promise<storage.WriteFileResult>;
|
|
20
20
|
static saveAccessory(key: string, value: unknown): Promise<storage.WriteFileResult>;
|
|
21
21
|
static saveHost(key: string, serializedHost: SerializedHostType): Promise<storage.WriteFileResult>;
|
|
22
|
-
static load(type: StorageType, key
|
|
22
|
+
static load(type: StorageType, key?: string): Promise<any>;
|
|
23
23
|
static loadCallback(key: string): EventCallback | undefined;
|
|
24
24
|
static loadCustomCharacteristics(): Promise<any>;
|
|
25
25
|
static loadService(key: string): Promise<SerializedService>;
|
package/build/lib/Storage.js
CHANGED
|
@@ -24,8 +24,9 @@ class Storage {
|
|
|
24
24
|
return node_persist_1.default.init({ dir: Storage.storagePath() });
|
|
25
25
|
}
|
|
26
26
|
static save(type, key, value) {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
const itemName = key ? `${type}-${key}` : type;
|
|
28
|
+
Storage.log.trace(`Saving ${itemName}:${value}`);
|
|
29
|
+
return node_persist_1.default.set(itemName, value);
|
|
29
30
|
}
|
|
30
31
|
static saveCallback(eventCallback, ttl = 10000) {
|
|
31
32
|
const callbackID = (0, uuid_1.v4)();
|
|
@@ -40,7 +41,7 @@ class Storage {
|
|
|
40
41
|
return callbackID;
|
|
41
42
|
}
|
|
42
43
|
static saveCustomCharacteristics(value) {
|
|
43
|
-
return Storage.save(StorageType_1.StorageType.CUSTOM_CHARACTERISTICS,
|
|
44
|
+
return Storage.save(StorageType_1.StorageType.CUSTOM_CHARACTERISTICS, undefined, value);
|
|
44
45
|
}
|
|
45
46
|
static saveService(key, value) {
|
|
46
47
|
return Storage.save(StorageType_1.StorageType.SERVICE, key, value);
|
|
@@ -52,8 +53,9 @@ class Storage {
|
|
|
52
53
|
return Storage.save(StorageType_1.StorageType.HOST, key, serializedHost);
|
|
53
54
|
}
|
|
54
55
|
static load(type, key) {
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
const itemName = key ? `${type}-${key}` : type;
|
|
57
|
+
Storage.log.trace(`Loading ${itemName}`);
|
|
58
|
+
return node_persist_1.default.get(itemName);
|
|
57
59
|
}
|
|
58
60
|
static loadCallback(key) {
|
|
59
61
|
if (key in Storage.memoryStorage) {
|
|
@@ -65,7 +67,7 @@ class Storage {
|
|
|
65
67
|
return undefined;
|
|
66
68
|
}
|
|
67
69
|
static loadCustomCharacteristics() {
|
|
68
|
-
return Storage.load(StorageType_1.StorageType.CUSTOM_CHARACTERISTICS
|
|
70
|
+
return Storage.load(StorageType_1.StorageType.CUSTOM_CHARACTERISTICS);
|
|
69
71
|
}
|
|
70
72
|
static loadService(key) {
|
|
71
73
|
return new Promise((resolve, reject) => {
|
package/build/lib/api.js
CHANGED
|
@@ -123,6 +123,8 @@ module.exports = function (RED) {
|
|
|
123
123
|
const getCustomCharacteristics = () => {
|
|
124
124
|
return Storage_1.Storage.loadCustomCharacteristics()
|
|
125
125
|
.then((value) => {
|
|
126
|
+
log.trace(`loadCustomCharacteristics()`);
|
|
127
|
+
log.trace(value);
|
|
126
128
|
if (Array.isArray(value)) {
|
|
127
129
|
return value;
|
|
128
130
|
}
|
|
@@ -67,7 +67,10 @@ module.exports = function (node) {
|
|
|
67
67
|
}
|
|
68
68
|
catch (_) { }
|
|
69
69
|
}
|
|
70
|
-
output.call(characteristic, allCharacteristics, {
|
|
70
|
+
output.call(characteristic, allCharacteristics, {
|
|
71
|
+
name: "get",
|
|
72
|
+
context: { key: this.displayName },
|
|
73
|
+
}, { oldValue, newValue }, connection);
|
|
71
74
|
};
|
|
72
75
|
if (node.config.useEventCallback) {
|
|
73
76
|
const callbackID = Storage_1.Storage.saveCallback({
|
|
@@ -77,7 +80,7 @@ module.exports = function (node) {
|
|
|
77
80
|
log.debug(`Registered callback ${callbackID} for Characteristic ${characteristic.displayName}`);
|
|
78
81
|
output.call(this, allCharacteristics, {
|
|
79
82
|
name: "get",
|
|
80
|
-
context: { callbackID },
|
|
83
|
+
context: { callbackID, key: this.displayName },
|
|
81
84
|
}, { oldValue }, connection);
|
|
82
85
|
}
|
|
83
86
|
else {
|
|
@@ -93,14 +96,17 @@ module.exports = function (node) {
|
|
|
93
96
|
}
|
|
94
97
|
}
|
|
95
98
|
catch (_) { }
|
|
96
|
-
output.call(this, allCharacteristics,
|
|
99
|
+
output.call(this, allCharacteristics, {
|
|
100
|
+
name: "set",
|
|
101
|
+
context: { key: this.displayName },
|
|
102
|
+
}, { newValue }, connection);
|
|
97
103
|
};
|
|
98
104
|
const onCharacteristicChange = (allCharacteristics) => function (change) {
|
|
99
105
|
const { oldValue, newValue, context, originator, reason } = change;
|
|
100
106
|
if (oldValue != newValue) {
|
|
101
107
|
output.call(this, allCharacteristics, {
|
|
102
108
|
name: "change",
|
|
103
|
-
context: { reason },
|
|
109
|
+
context: { reason, key: this.displayName },
|
|
104
110
|
}, { oldValue, newValue, context }, originator);
|
|
105
111
|
}
|
|
106
112
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-red-contrib-homekit-bridged",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.3-dev.1",
|
|
4
4
|
"description": "Node-RED nodes to simulate Apple HomeKit devices.",
|
|
5
5
|
"main": "build/nodes/nrchkb.js",
|
|
6
6
|
"scripts": {
|
|
@@ -47,29 +47,29 @@
|
|
|
47
47
|
"homepage": "https://github.com/NRCHKB/node-red-contrib-homekit-bridged#readme",
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@nrchkb/logger": "^1.3.3",
|
|
50
|
-
"hap-nodejs": "^0.9.
|
|
50
|
+
"hap-nodejs": "^0.9.6",
|
|
51
51
|
"node-persist": "^3.1.0",
|
|
52
52
|
"semver": "^7.3.5",
|
|
53
53
|
"uuid": "^8.3.2"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@homebridge/ciao": "^1.1.2",
|
|
57
|
-
"@node-red/registry": "^1.3.
|
|
57
|
+
"@node-red/registry": "^1.3.7",
|
|
58
58
|
"@types/mocha": "^9.0.0",
|
|
59
59
|
"@types/node": "^10.17.50",
|
|
60
60
|
"@types/node-persist": "^3.1.2",
|
|
61
61
|
"@types/node-red": "^1.1.1",
|
|
62
62
|
"@types/semver": "^7.3.8",
|
|
63
63
|
"@types/uuid": "^8.3.1",
|
|
64
|
-
"@typescript-eslint/eslint-plugin": "^4.
|
|
65
|
-
"@typescript-eslint/parser": "^4.
|
|
64
|
+
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
|
65
|
+
"@typescript-eslint/parser": "^4.33.0",
|
|
66
66
|
"babel-eslint": "^10.1.0",
|
|
67
67
|
"eslint": "^7.32.0",
|
|
68
68
|
"eslint-config-prettier": "^8.3.0",
|
|
69
69
|
"eslint-plugin-prettier": "^4.0.0",
|
|
70
70
|
"husky": "^7.0.2",
|
|
71
71
|
"mocha": "^9.1.2",
|
|
72
|
-
"node-red": "^1.3.
|
|
72
|
+
"node-red": "^1.3.7",
|
|
73
73
|
"node-red-node-test-helper": "^0.2.7",
|
|
74
74
|
"pinst": "^2.1.6",
|
|
75
75
|
"prettier": "^2.4.1",
|