homebridge-freeathome-local-api 1.4.3 → 1.4.4
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 +7 -0
- package/dist/roomTemperatureControllerAccessory.d.ts +7 -0
- package/dist/roomTemperatureControllerAccessory.d.ts.map +1 -1
- package/dist/roomTemperatureControllerAccessory.js +31 -13
- package/dist/roomTemperatureControllerAccessory.js.map +1 -1
- package/dist/util.d.ts +13 -0
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +21 -2
- package/dist/util.js.map +1 -1
- package/package.json +11 -11
- package/test/platform.spec.ts +21 -0
- package/test/roomTemperatureControllerAccessory.spec.ts +143 -239
- package/test/util.spec.ts +35 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.4.4](https://github.com/pgerke/homebridge-freeathome-local-api/releases/tag/1.4.4) - 15.01.2023
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- [#42](https://github.com/pgerke/homebridge-freeathome-local-api/issues/42):
|
|
13
|
+
Resolve correct data points for room temperature controller using the pairing ID.
|
|
14
|
+
|
|
8
15
|
## [1.4.3](https://github.com/pgerke/homebridge-freeathome-local-api/releases/tag/1.4.3) - 04.01.2023
|
|
9
16
|
|
|
10
17
|
### Changed
|
|
@@ -12,6 +12,13 @@ export declare class RoomTemperatureControllerAccessory extends FreeAtHomeAccess
|
|
|
12
12
|
private coolingOn;
|
|
13
13
|
private stateCurrentTemperature;
|
|
14
14
|
private stateTargetTemperature;
|
|
15
|
+
private readonly pdControllerOnOff;
|
|
16
|
+
private readonly pdControllerOnOffRequest;
|
|
17
|
+
private readonly pdHeatingOn;
|
|
18
|
+
private readonly pdCoolingOn;
|
|
19
|
+
private readonly pdCurrentTemperature;
|
|
20
|
+
private readonly pdTargetTemperature;
|
|
21
|
+
private readonly pdTargetTemperatureRequest;
|
|
15
22
|
private get stateCurrentHeatingCoolingState();
|
|
16
23
|
private get stateTargetHeatingCoolingState();
|
|
17
24
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"roomTemperatureControllerAccessory.d.ts","sourceRoot":"","sources":["../src/roomTemperatureControllerAccessory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,iBAAiB,EAAW,MAAM,YAAY,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"roomTemperatureControllerAccessory.d.ts","sourceRoot":"","sources":["../src/roomTemperatureControllerAccessory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,iBAAiB,EAAW,MAAM,YAAY,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC;AAW1D,+CAA+C;AAC/C,qBAAa,kCAAmC,SAAQ,mBAAmB;IA0CvE,QAAQ,CAAC,QAAQ,EAAE,4BAA4B;IAC/C,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAC,iBAAiB,CAAC;IA1C1D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAU;IAClC,OAAO,CAAC,eAAe,CAAU;IACjC,OAAO,CAAC,SAAS,CAAU;IAC3B,OAAO,CAAC,SAAS,CAAU;IAC3B,OAAO,CAAC,uBAAuB,CAAS;IACxC,OAAO,CAAC,sBAAsB,CAAS;IACvC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAS;IAC3C,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAS;IAClD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAS;IAC9C,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAS;IAC7C,OAAO,CAAC,QAAQ,CAAC,0BAA0B,CAAS;IAEpD,OAAO,KAAK,+BAA+B,GAc1C;IACD,OAAO,KAAK,8BAA8B,GAIzC;IAED;;;;OAIG;gBAEQ,QAAQ,EAAE,4BAA4B,EACtC,SAAS,EAAE,iBAAiB,CAAC,iBAAiB,CAAC;YAqG5C,oBAAoB;YA6BpB,4BAA4B;IA0B1B,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;CAyDxE"}
|
|
@@ -3,6 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.RoomTemperatureControllerAccessory = void 0;
|
|
4
4
|
const freeAtHomeAccessory_1 = require("./freeAtHomeAccessory");
|
|
5
5
|
const util_1 = require("./util");
|
|
6
|
+
const pidControllerOnOff = 56;
|
|
7
|
+
const pidControllerOnOffRequest = 66;
|
|
8
|
+
const pidHeatingOn = 48;
|
|
9
|
+
const pidCoolingOn = 50;
|
|
10
|
+
const pidCurrentTemperature = 304;
|
|
11
|
+
const pidTargetTemperature = 51;
|
|
12
|
+
const pidTargetTemperatureRequest = 320;
|
|
6
13
|
/** A room temperature controller accessory. */
|
|
7
14
|
class RoomTemperatureControllerAccessory extends freeAtHomeAccessory_1.FreeAtHomeAccessory {
|
|
8
15
|
get stateCurrentHeatingCoolingState() {
|
|
@@ -32,16 +39,27 @@ class RoomTemperatureControllerAccessory extends freeAtHomeAccessory_1.FreeAtHom
|
|
|
32
39
|
* @param accessory The platform accessory.
|
|
33
40
|
*/
|
|
34
41
|
constructor(platform, accessory) {
|
|
35
|
-
var _a, _b, _c, _d, _e
|
|
42
|
+
var _a, _b, _c, _d, _e;
|
|
36
43
|
super(platform, accessory);
|
|
37
44
|
this.platform = platform;
|
|
38
45
|
this.accessory = accessory;
|
|
46
|
+
// Resolve data points
|
|
47
|
+
if (!this.accessory.context.channel.outputs ||
|
|
48
|
+
!this.accessory.context.channel.inputs)
|
|
49
|
+
throw new Error("Channel lacks expected input or output data points.");
|
|
50
|
+
this.pdControllerOnOff = (0, util_1.getDataPointByPairingID)(this.accessory.context.channel.outputs, pidControllerOnOff);
|
|
51
|
+
this.pdControllerOnOffRequest = (0, util_1.getDataPointByPairingID)(this.accessory.context.channel.inputs, pidControllerOnOffRequest);
|
|
52
|
+
this.pdHeatingOn = (0, util_1.getDataPointByPairingID)(this.accessory.context.channel.outputs, pidHeatingOn);
|
|
53
|
+
this.pdCoolingOn = (0, util_1.getDataPointByPairingID)(this.accessory.context.channel.outputs, pidCoolingOn);
|
|
54
|
+
this.pdCurrentTemperature = (0, util_1.getDataPointByPairingID)(this.accessory.context.channel.outputs, pidCurrentTemperature);
|
|
55
|
+
this.pdTargetTemperature = (0, util_1.getDataPointByPairingID)(this.accessory.context.channel.outputs, pidTargetTemperature);
|
|
56
|
+
this.pdTargetTemperatureRequest = (0, util_1.getDataPointByPairingID)(this.accessory.context.channel.inputs, pidTargetTemperatureRequest);
|
|
39
57
|
// set initial state
|
|
40
|
-
this.controllerOnOff = !!parseInt((
|
|
41
|
-
this.heatingOn = !!parseInt((
|
|
42
|
-
this.coolingOn = !!parseInt((
|
|
43
|
-
this.stateCurrentTemperature = parseFloat((
|
|
44
|
-
this.stateTargetTemperature = parseFloat((
|
|
58
|
+
this.controllerOnOff = !!parseInt((_a = this.accessory.context.channel.outputs[this.pdControllerOnOff].value) !== null && _a !== void 0 ? _a : "0");
|
|
59
|
+
this.heatingOn = !!parseInt((_b = this.accessory.context.channel.outputs[this.pdHeatingOn].value) !== null && _b !== void 0 ? _b : "0");
|
|
60
|
+
this.coolingOn = !!parseInt((_c = this.accessory.context.channel.outputs[this.pdCoolingOn].value) !== null && _c !== void 0 ? _c : "0");
|
|
61
|
+
this.stateCurrentTemperature = parseFloat((_d = this.accessory.context.channel.outputs[this.pdCurrentTemperature].value) !== null && _d !== void 0 ? _d : "0.0");
|
|
62
|
+
this.stateTargetTemperature = parseFloat((_e = this.accessory.context.channel.outputs[this.pdTargetTemperature].value) !== null && _e !== void 0 ? _e : "0.0");
|
|
45
63
|
// get the Thermostat service if it exists, otherwise create a new service instance
|
|
46
64
|
this.service =
|
|
47
65
|
this.accessory.getService(this.platform.Service.Thermostat) ||
|
|
@@ -88,7 +106,7 @@ class RoomTemperatureControllerAccessory extends freeAtHomeAccessory_1.FreeAtHom
|
|
|
88
106
|
// Heating Cooling State must not be OFF to set the target temperature
|
|
89
107
|
await this.setTargetHeatingCoolingState(this.platform.Characteristic.TargetHeatingCoolingState.AUTO);
|
|
90
108
|
// set data point at SysAP
|
|
91
|
-
await this.platform.sysap.setDatapoint(util_1.EmptyGuid, this.accessory.context.deviceSerial, this.accessory.context.channelId,
|
|
109
|
+
await this.platform.sysap.setDatapoint(util_1.EmptyGuid, this.accessory.context.deviceSerial, this.accessory.context.channelId, this.pdTargetTemperatureRequest, this.stateTargetTemperature.toFixed(1));
|
|
92
110
|
}
|
|
93
111
|
async setTargetHeatingCoolingState(value) {
|
|
94
112
|
// avoid unncessary updates or update cache
|
|
@@ -99,30 +117,30 @@ class RoomTemperatureControllerAccessory extends freeAtHomeAccessory_1.FreeAtHom
|
|
|
99
117
|
// log event
|
|
100
118
|
this.platform.log.info(`${this.accessory.displayName} (Room Temperature Controller ${this.serialNumber}) set characteristic TargetHeatingCoolingState -> ${value.toString()}`);
|
|
101
119
|
// set data point at SysAP
|
|
102
|
-
await this.platform.sysap.setDatapoint(util_1.EmptyGuid, this.accessory.context.deviceSerial, this.accessory.context.channelId,
|
|
120
|
+
await this.platform.sysap.setDatapoint(util_1.EmptyGuid, this.accessory.context.deviceSerial, this.accessory.context.channelId, this.pdControllerOnOffRequest, value === this.platform.Characteristic.TargetHeatingCoolingState.OFF
|
|
103
121
|
? "0"
|
|
104
122
|
: "1");
|
|
105
123
|
}
|
|
106
124
|
updateDatapoint(datapoint, value) {
|
|
107
125
|
switch (datapoint) {
|
|
108
|
-
case
|
|
126
|
+
case this.pdHeatingOn:
|
|
109
127
|
this.heatingOn = !!parseInt(value);
|
|
110
128
|
this.doUpdateDatapoint("Room Temperature Controller", this.service, this.platform.Characteristic.CurrentHeatingCoolingState, this.stateCurrentHeatingCoolingState);
|
|
111
129
|
return;
|
|
112
|
-
case
|
|
130
|
+
case this.pdCoolingOn:
|
|
113
131
|
this.coolingOn = !!parseInt(value);
|
|
114
132
|
this.doUpdateDatapoint("Room Temperature Controller", this.service, this.platform.Characteristic.CurrentHeatingCoolingState, this.stateCurrentHeatingCoolingState);
|
|
115
133
|
return;
|
|
116
|
-
case
|
|
134
|
+
case this.pdControllerOnOff:
|
|
117
135
|
this.controllerOnOff = !!parseInt(value);
|
|
118
136
|
this.doUpdateDatapoint("Room Temperature Controller", this.service, this.platform.Characteristic.CurrentHeatingCoolingState, this.stateCurrentHeatingCoolingState);
|
|
119
137
|
this.doUpdateDatapoint("Room Temperature Controller", this.service, this.platform.Characteristic.TargetHeatingCoolingState, this.stateTargetHeatingCoolingState);
|
|
120
138
|
return;
|
|
121
|
-
case
|
|
139
|
+
case this.pdTargetTemperature:
|
|
122
140
|
this.stateTargetTemperature = parseFloat(value);
|
|
123
141
|
this.doUpdateDatapoint("Room Temperature Controller", this.service, this.platform.Characteristic.TargetTemperature, this.stateTargetTemperature);
|
|
124
142
|
return;
|
|
125
|
-
case
|
|
143
|
+
case this.pdCurrentTemperature:
|
|
126
144
|
this.stateCurrentTemperature = parseFloat(value);
|
|
127
145
|
this.doUpdateDatapoint("Room Temperature Controller", this.service, this.platform.Characteristic.CurrentTemperature, this.stateCurrentTemperature);
|
|
128
146
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"roomTemperatureControllerAccessory.js","sourceRoot":"","sources":["../src/roomTemperatureControllerAccessory.ts"],"names":[],"mappings":";;;AACA,+DAA4D;AAG5D,
|
|
1
|
+
{"version":3,"file":"roomTemperatureControllerAccessory.js","sourceRoot":"","sources":["../src/roomTemperatureControllerAccessory.ts"],"names":[],"mappings":";;;AACA,+DAA4D;AAG5D,iCAA4D;AAE5D,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAC9B,MAAM,yBAAyB,GAAG,EAAE,CAAC;AACrC,MAAM,YAAY,GAAG,EAAE,CAAC;AACxB,MAAM,YAAY,GAAG,EAAE,CAAC;AACxB,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAClC,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAChC,MAAM,2BAA2B,GAAG,GAAG,CAAC;AAExC,+CAA+C;AAC/C,MAAa,kCAAmC,SAAQ,yCAAmB;IAezE,IAAY,+BAA+B;QACzC,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE;YACzB,OAAO,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,0BAA0B,CAAC,GAAG,CAAC;SACpE;aAAM,IAAI,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YAC5C,OAAO,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,0BAA0B,CAAC,IAAI,CAAC;SACrE;aAAM,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,EAAE;YAC5C,OAAO,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,0BAA0B,CAAC,IAAI,CAAC;SACrE;aAAM;YACL,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS;gBAClC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CACrB,iEAAiE,CAClE,CAAC;YACJ,OAAO,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,0BAA0B,CAAC,G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7B,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,0BAA0B,EACvD,IAAI,CAAC,+BAA+B,CACrC,CAAC;gBACF,IAAI,CAAC,iBAAiB,CACpB,6BAA6B,EAC7B,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,yBAAyB,EACtD,IAAI,CAAC,8BAA8B,CACpC,CAAC;gBACF,OAAO;YACT,KAAK,IAAI,CAAC,mBAAmB;gBAC3B,IAAI,CAAC,sBAAsB,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;gBAChD,IAAI,CAAC,iBAAiB,CACpB,6BAA6B,EAC7B,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,iBAAiB,EAC9C,IAAI,CAAC,sBAAsB,CAC5B,CAAC;gBACF,OAAO;YACT,KAAK,IAAI,CAAC,oBAAoB;gBAC5B,IAAI,CAAC,uBAAuB,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;gBACjD,IAAI,CAAC,iBAAiB,CACpB,6BAA6B,EAC7B,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,kBAAkB,EAC/C,IAAI,CAAC,uBAAuB,CAC7B,CAAC;gBACF,OAAO;YACT;gBACE,OAAO;SACV;IACH,CAAC;CACF;AAhQD,gFAgQC"}
|
package/dist/util.d.ts
CHANGED
|
@@ -1,2 +1,15 @@
|
|
|
1
|
+
import { InOutPut } from "freeathome-local-api-client";
|
|
2
|
+
/**
|
|
3
|
+
* In the local API the system access point UUID is always an empty UUID. Could be extended later to also support the cloud API.
|
|
4
|
+
*/
|
|
1
5
|
export declare const EmptyGuid = "00000000-0000-0000-0000-000000000000";
|
|
6
|
+
/**
|
|
7
|
+
* Gets the name of the data point with the specified pairing ID.
|
|
8
|
+
* @param datapoints The data points
|
|
9
|
+
* @param pairingID The pairing ID.
|
|
10
|
+
* @returns The data point name or null, if no data point was found for the specified pairing ID.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getDataPointByPairingID(datapoints: {
|
|
13
|
+
[key: string]: InOutPut;
|
|
14
|
+
} | undefined, pairingID: number): string;
|
|
2
15
|
//# sourceMappingURL=util.d.ts.map
|
package/dist/util.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD;;GAEG;AACH,eAAO,MAAM,SAAS,yCAAyC,CAAC;AAEhE;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAA;CAAE,GAAG,SAAS,EACnD,SAAS,EAAE,MAAM,GAChB,MAAM,CAUR"}
|
package/dist/util.js
CHANGED
|
@@ -1,6 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EmptyGuid = void 0;
|
|
4
|
-
|
|
3
|
+
exports.getDataPointByPairingID = exports.EmptyGuid = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* In the local API the system access point UUID is always an empty UUID. Could be extended later to also support the cloud API.
|
|
6
|
+
*/
|
|
5
7
|
exports.EmptyGuid = "00000000-0000-0000-0000-000000000000";
|
|
8
|
+
/**
|
|
9
|
+
* Gets the name of the data point with the specified pairing ID.
|
|
10
|
+
* @param datapoints The data points
|
|
11
|
+
* @param pairingID The pairing ID.
|
|
12
|
+
* @returns The data point name or null, if no data point was found for the specified pairing ID.
|
|
13
|
+
*/
|
|
14
|
+
function getDataPointByPairingID(datapoints, pairingID) {
|
|
15
|
+
if (!datapoints)
|
|
16
|
+
throw new Error("Data point object is undefined");
|
|
17
|
+
for (const e of Object.keys(datapoints)) {
|
|
18
|
+
if (datapoints[e].pairingID === pairingID) {
|
|
19
|
+
return e;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
throw new Error(`No data point found for pairing ID ${pairingID}`);
|
|
23
|
+
}
|
|
24
|
+
exports.getDataPointByPairingID = getDataPointByPairingID;
|
|
6
25
|
//# sourceMappingURL=util.js.map
|
package/dist/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACU,QAAA,SAAS,GAAG,sCAAsC,CAAC;AAEhE;;;;;GAKG;AACH,SAAgB,uBAAuB,CACrC,UAAmD,EACnD,SAAiB;IAEjB,IAAI,CAAC,UAAU;QAAE,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IAEnE,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;QACvC,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,KAAK,SAAS,EAAE;YACzC,OAAO,CAAC,CAAC;SACV;KACF;IAED,MAAM,IAAI,KAAK,CAAC,sCAAsC,SAAS,EAAE,CAAC,CAAC;AACrE,CAAC;AAbD,0DAaC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "free@home Local API",
|
|
3
3
|
"name": "homebridge-freeathome-local-api",
|
|
4
|
-
"version": "1.4.
|
|
4
|
+
"version": "1.4.4",
|
|
5
5
|
"preview": false,
|
|
6
6
|
"description": "Control your free@home setup using the local API provided by your System Access Point",
|
|
7
7
|
"license": "MIT",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"smarthome"
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"freeathome-local-api-client": "^1.3.
|
|
49
|
-
"node-fetch": "^2.6.
|
|
48
|
+
"freeathome-local-api-client": "^1.3.6",
|
|
49
|
+
"node-fetch": "^2.6.8",
|
|
50
50
|
"rxjs": "^7.8.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
@@ -55,12 +55,12 @@
|
|
|
55
55
|
"@types/jasmine": "^4.3.1",
|
|
56
56
|
"@types/node": "^18.11.18",
|
|
57
57
|
"@types/node-fetch": "^2.6.2",
|
|
58
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
59
|
-
"@typescript-eslint/parser": "^5.
|
|
60
|
-
"eslint": "^8.
|
|
61
|
-
"eslint-config-prettier": "^8.
|
|
62
|
-
"eslint-plugin-import": "^2.
|
|
63
|
-
"eslint-plugin-n": "^15.6.
|
|
58
|
+
"@typescript-eslint/eslint-plugin": "^5.48.1",
|
|
59
|
+
"@typescript-eslint/parser": "^5.48.1",
|
|
60
|
+
"eslint": "^8.32.0",
|
|
61
|
+
"eslint-config-prettier": "^8.6.0",
|
|
62
|
+
"eslint-plugin-import": "^2.27.4",
|
|
63
|
+
"eslint-plugin-n": "^15.6.1",
|
|
64
64
|
"eslint-plugin-prettier": "^4.2.1",
|
|
65
65
|
"eslint-plugin-promise": "^6.1.1",
|
|
66
66
|
"homebridge": "^1.6.0",
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
"jasmine-spec-reporter": "^7.0.0",
|
|
69
69
|
"nodemon": "^2.0.20",
|
|
70
70
|
"nyc": "^15.1.0",
|
|
71
|
-
"prettier": "^2.8.
|
|
72
|
-
"rimraf": "^
|
|
71
|
+
"prettier": "^2.8.3",
|
|
72
|
+
"rimraf": "^4.0.5",
|
|
73
73
|
"ts-node": "^10.9.1",
|
|
74
74
|
"typescript": "^4.9.4"
|
|
75
75
|
}
|
package/test/platform.spec.ts
CHANGED
|
@@ -62,6 +62,27 @@ const configuration: Configuration = {
|
|
|
62
62
|
channels: {
|
|
63
63
|
ch0000: {
|
|
64
64
|
functionID: "23",
|
|
65
|
+
outputs: {
|
|
66
|
+
odp0000: {
|
|
67
|
+
pairingID: 48,
|
|
68
|
+
},
|
|
69
|
+
odp0001: {
|
|
70
|
+
pairingID: 50,
|
|
71
|
+
},
|
|
72
|
+
odp0006: {
|
|
73
|
+
pairingID: 51,
|
|
74
|
+
},
|
|
75
|
+
odp0008: {
|
|
76
|
+
pairingID: 56,
|
|
77
|
+
},
|
|
78
|
+
odp0010: {
|
|
79
|
+
pairingID: 304,
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
inputs: {
|
|
83
|
+
idp0012: { pairingID: 66 },
|
|
84
|
+
idp0016: { pairingID: 320 },
|
|
85
|
+
},
|
|
65
86
|
},
|
|
66
87
|
ch0001: {
|
|
67
88
|
functionID: "20",
|
|
@@ -18,7 +18,29 @@ describe("Room Temperature Controller Accessory", () => {
|
|
|
18
18
|
let platformAccessory: PlatformAccessory<FreeAtHomeContext>;
|
|
19
19
|
|
|
20
20
|
beforeEach(() => {
|
|
21
|
-
channel = {
|
|
21
|
+
channel = {
|
|
22
|
+
outputs: {
|
|
23
|
+
odp0000: {
|
|
24
|
+
pairingID: 48,
|
|
25
|
+
},
|
|
26
|
+
odp0001: {
|
|
27
|
+
pairingID: 50,
|
|
28
|
+
},
|
|
29
|
+
odp0006: {
|
|
30
|
+
pairingID: 51,
|
|
31
|
+
},
|
|
32
|
+
odp0008: {
|
|
33
|
+
pairingID: 56,
|
|
34
|
+
},
|
|
35
|
+
odp0010: {
|
|
36
|
+
pairingID: 304,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
inputs: {
|
|
40
|
+
idp0012: { pairingID: 66 },
|
|
41
|
+
idp0016: { pairingID: 320 },
|
|
42
|
+
},
|
|
43
|
+
};
|
|
22
44
|
device = {};
|
|
23
45
|
platform = new MockFreeAtHomeHomebridgePlatform();
|
|
24
46
|
platformAccessory = new PlatformAccessory(
|
|
@@ -36,6 +58,14 @@ describe("Room Temperature Controller Accessory", () => {
|
|
|
36
58
|
platform.resetLoggerCalls();
|
|
37
59
|
});
|
|
38
60
|
|
|
61
|
+
it("should throw if expected data points are missing on channel", () => {
|
|
62
|
+
channel.inputs = undefined;
|
|
63
|
+
|
|
64
|
+
expect(
|
|
65
|
+
() => new RoomTemperatureControllerAccessory(platform, platformAccessory)
|
|
66
|
+
).toThrowError("Channel lacks expected input or output data points.");
|
|
67
|
+
});
|
|
68
|
+
|
|
39
69
|
it("should be created with default state", async () => {
|
|
40
70
|
const accessory = new RoomTemperatureControllerAccessory(
|
|
41
71
|
platform,
|
|
@@ -74,23 +104,14 @@ describe("Room Temperature Controller Accessory", () => {
|
|
|
74
104
|
});
|
|
75
105
|
|
|
76
106
|
it("should be created with heating state", async () => {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
value: "21.5",
|
|
86
|
-
},
|
|
87
|
-
odp0008: {
|
|
88
|
-
value: "1",
|
|
89
|
-
},
|
|
90
|
-
odp0010: {
|
|
91
|
-
value: "20",
|
|
92
|
-
},
|
|
93
|
-
};
|
|
107
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
108
|
+
channel.outputs!.odp0000.value = "1";
|
|
109
|
+
channel.outputs!.odp0001.value = "0";
|
|
110
|
+
channel.outputs!.odp0006.value = "21.5";
|
|
111
|
+
channel.outputs!.odp0008.value = "1";
|
|
112
|
+
channel.outputs!.odp0010.value = "20";
|
|
113
|
+
/* eslint-enable @typescript-eslint/no-non-null-assertion */
|
|
114
|
+
|
|
94
115
|
const accessory = new RoomTemperatureControllerAccessory(
|
|
95
116
|
platform,
|
|
96
117
|
platformAccessory
|
|
@@ -122,23 +143,14 @@ describe("Room Temperature Controller Accessory", () => {
|
|
|
122
143
|
});
|
|
123
144
|
|
|
124
145
|
it("should be created with cooling state", async () => {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
value: "21.5",
|
|
134
|
-
},
|
|
135
|
-
odp0008: {
|
|
136
|
-
value: "1",
|
|
137
|
-
},
|
|
138
|
-
odp0010: {
|
|
139
|
-
value: "23",
|
|
140
|
-
},
|
|
141
|
-
};
|
|
146
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
147
|
+
channel.outputs!.odp0000.value = "0";
|
|
148
|
+
channel.outputs!.odp0001.value = "1";
|
|
149
|
+
channel.outputs!.odp0006.value = "21.5";
|
|
150
|
+
channel.outputs!.odp0008.value = "1";
|
|
151
|
+
channel.outputs!.odp0010.value = "23";
|
|
152
|
+
/* eslint-enable @typescript-eslint/no-non-null-assertion */
|
|
153
|
+
|
|
142
154
|
const accessory = new RoomTemperatureControllerAccessory(
|
|
143
155
|
platform,
|
|
144
156
|
platformAccessory
|
|
@@ -170,23 +182,14 @@ describe("Room Temperature Controller Accessory", () => {
|
|
|
170
182
|
});
|
|
171
183
|
|
|
172
184
|
it("should be created with controller active but not heating or cooling", async () => {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
value: "21.5",
|
|
182
|
-
},
|
|
183
|
-
odp0008: {
|
|
184
|
-
value: "1",
|
|
185
|
-
},
|
|
186
|
-
odp0010: {
|
|
187
|
-
value: "23",
|
|
188
|
-
},
|
|
189
|
-
};
|
|
185
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
186
|
+
channel.outputs!.odp0000.value = "0";
|
|
187
|
+
channel.outputs!.odp0001.value = "0";
|
|
188
|
+
channel.outputs!.odp0006.value = "21.5";
|
|
189
|
+
channel.outputs!.odp0008.value = "1";
|
|
190
|
+
channel.outputs!.odp0010.value = "23";
|
|
191
|
+
/* eslint-enable @typescript-eslint/no-non-null-assertion */
|
|
192
|
+
|
|
190
193
|
const accessory = new RoomTemperatureControllerAccessory(
|
|
191
194
|
platform,
|
|
192
195
|
platformAccessory
|
|
@@ -218,23 +221,14 @@ describe("Room Temperature Controller Accessory", () => {
|
|
|
218
221
|
});
|
|
219
222
|
|
|
220
223
|
it("should be created with invalid CurrentHeatingCooling state", async () => {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
value: "21.5",
|
|
230
|
-
},
|
|
231
|
-
odp0008: {
|
|
232
|
-
value: "1",
|
|
233
|
-
},
|
|
234
|
-
odp0010: {
|
|
235
|
-
value: "23",
|
|
236
|
-
},
|
|
237
|
-
};
|
|
224
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
225
|
+
channel.outputs!.odp0000.value = "1";
|
|
226
|
+
channel.outputs!.odp0001.value = "1";
|
|
227
|
+
channel.outputs!.odp0006.value = "21.5";
|
|
228
|
+
channel.outputs!.odp0008.value = "1";
|
|
229
|
+
channel.outputs!.odp0010.value = "23";
|
|
230
|
+
/* eslint-enable @typescript-eslint/no-non-null-assertion */
|
|
231
|
+
|
|
238
232
|
const accessory = new RoomTemperatureControllerAccessory(
|
|
239
233
|
platform,
|
|
240
234
|
platformAccessory
|
|
@@ -270,23 +264,14 @@ describe("Room Temperature Controller Accessory", () => {
|
|
|
270
264
|
});
|
|
271
265
|
|
|
272
266
|
it("should not handle a request to set TargetTemperature characteristic if the value has not changed", async () => {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
value: "21.5",
|
|
282
|
-
},
|
|
283
|
-
odp0008: {
|
|
284
|
-
value: "1",
|
|
285
|
-
},
|
|
286
|
-
odp0010: {
|
|
287
|
-
value: "20",
|
|
288
|
-
},
|
|
289
|
-
};
|
|
267
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
268
|
+
channel.outputs!.odp0000.value = "1";
|
|
269
|
+
channel.outputs!.odp0001.value = "0";
|
|
270
|
+
channel.outputs!.odp0006.value = "21.5";
|
|
271
|
+
channel.outputs!.odp0008.value = "1";
|
|
272
|
+
channel.outputs!.odp0010.value = "20";
|
|
273
|
+
/* eslint-enable @typescript-eslint/no-non-null-assertion */
|
|
274
|
+
|
|
290
275
|
const accessory = new RoomTemperatureControllerAccessory(
|
|
291
276
|
platform,
|
|
292
277
|
platformAccessory
|
|
@@ -305,23 +290,14 @@ describe("Room Temperature Controller Accessory", () => {
|
|
|
305
290
|
});
|
|
306
291
|
|
|
307
292
|
it("should handle request to set TargetTemperature characteristic if the value has changed", async () => {
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
value: "21.5",
|
|
317
|
-
},
|
|
318
|
-
odp0008: {
|
|
319
|
-
value: "1",
|
|
320
|
-
},
|
|
321
|
-
odp0010: {
|
|
322
|
-
value: "20",
|
|
323
|
-
},
|
|
324
|
-
};
|
|
293
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
294
|
+
channel.outputs!.odp0000.value = "1";
|
|
295
|
+
channel.outputs!.odp0001.value = "0";
|
|
296
|
+
channel.outputs!.odp0006.value = "21.5";
|
|
297
|
+
channel.outputs!.odp0008.value = "1";
|
|
298
|
+
channel.outputs!.odp0010.value = "20";
|
|
299
|
+
/* eslint-enable @typescript-eslint/no-non-null-assertion */
|
|
300
|
+
|
|
325
301
|
const accessory = new RoomTemperatureControllerAccessory(
|
|
326
302
|
platform,
|
|
327
303
|
platformAccessory
|
|
@@ -351,23 +327,14 @@ describe("Room Temperature Controller Accessory", () => {
|
|
|
351
327
|
});
|
|
352
328
|
|
|
353
329
|
it("should not handle a request to set TargetHeatingCoolingState characteristic if the value has not changed", async () => {
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
value: "21.5",
|
|
363
|
-
},
|
|
364
|
-
odp0008: {
|
|
365
|
-
value: "1",
|
|
366
|
-
},
|
|
367
|
-
odp0010: {
|
|
368
|
-
value: "20",
|
|
369
|
-
},
|
|
370
|
-
};
|
|
330
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
331
|
+
channel.outputs!.odp0000.value = "1";
|
|
332
|
+
channel.outputs!.odp0001.value = "0";
|
|
333
|
+
channel.outputs!.odp0006.value = "21.5";
|
|
334
|
+
channel.outputs!.odp0008.value = "1";
|
|
335
|
+
channel.outputs!.odp0010.value = "20";
|
|
336
|
+
/* eslint-enable @typescript-eslint/no-non-null-assertion */
|
|
337
|
+
|
|
371
338
|
const accessory = new RoomTemperatureControllerAccessory(
|
|
372
339
|
platform,
|
|
373
340
|
platformAccessory
|
|
@@ -390,23 +357,14 @@ describe("Room Temperature Controller Accessory", () => {
|
|
|
390
357
|
});
|
|
391
358
|
|
|
392
359
|
it("should handle request to set TargetHeatingCoolingState characteristic to off", async () => {
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
value: "21.5",
|
|
402
|
-
},
|
|
403
|
-
odp0008: {
|
|
404
|
-
value: "1",
|
|
405
|
-
},
|
|
406
|
-
odp0010: {
|
|
407
|
-
value: "20",
|
|
408
|
-
},
|
|
409
|
-
};
|
|
360
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
361
|
+
channel.outputs!.odp0000.value = "1";
|
|
362
|
+
channel.outputs!.odp0001.value = "0";
|
|
363
|
+
channel.outputs!.odp0006.value = "21.5";
|
|
364
|
+
channel.outputs!.odp0008.value = "1";
|
|
365
|
+
channel.outputs!.odp0010.value = "20";
|
|
366
|
+
/* eslint-enable @typescript-eslint/no-non-null-assertion */
|
|
367
|
+
|
|
410
368
|
const accessory = new RoomTemperatureControllerAccessory(
|
|
411
369
|
platform,
|
|
412
370
|
platformAccessory
|
|
@@ -443,23 +401,14 @@ describe("Room Temperature Controller Accessory", () => {
|
|
|
443
401
|
});
|
|
444
402
|
|
|
445
403
|
it("should handle request to set TargetHeatingCoolingState characteristic to off", async () => {
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
value: "21.5",
|
|
455
|
-
},
|
|
456
|
-
odp0008: {
|
|
457
|
-
value: "0",
|
|
458
|
-
},
|
|
459
|
-
odp0010: {
|
|
460
|
-
value: "20",
|
|
461
|
-
},
|
|
462
|
-
};
|
|
404
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
405
|
+
channel.outputs!.odp0000.value = "1";
|
|
406
|
+
channel.outputs!.odp0001.value = "0";
|
|
407
|
+
channel.outputs!.odp0006.value = "21.5";
|
|
408
|
+
channel.outputs!.odp0008.value = "0";
|
|
409
|
+
channel.outputs!.odp0010.value = "20";
|
|
410
|
+
/* eslint-enable @typescript-eslint/no-non-null-assertion */
|
|
411
|
+
|
|
463
412
|
const accessory = new RoomTemperatureControllerAccessory(
|
|
464
413
|
platform,
|
|
465
414
|
platformAccessory
|
|
@@ -535,23 +484,14 @@ describe("Room Temperature Controller Accessory", () => {
|
|
|
535
484
|
});
|
|
536
485
|
|
|
537
486
|
it("should process update to heating mode datapoint", async () => {
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
value: "21.5",
|
|
547
|
-
},
|
|
548
|
-
odp0008: {
|
|
549
|
-
value: "1",
|
|
550
|
-
},
|
|
551
|
-
odp0010: {
|
|
552
|
-
value: "20",
|
|
553
|
-
},
|
|
554
|
-
};
|
|
487
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
488
|
+
channel.outputs!.odp0000.value = "0";
|
|
489
|
+
channel.outputs!.odp0001.value = "0";
|
|
490
|
+
channel.outputs!.odp0006.value = "21.5";
|
|
491
|
+
channel.outputs!.odp0008.value = "1";
|
|
492
|
+
channel.outputs!.odp0010.value = "20";
|
|
493
|
+
/* eslint-enable @typescript-eslint/no-non-null-assertion */
|
|
494
|
+
|
|
555
495
|
const accessory = new RoomTemperatureControllerAccessory(
|
|
556
496
|
platform,
|
|
557
497
|
platformAccessory
|
|
@@ -596,23 +536,14 @@ describe("Room Temperature Controller Accessory", () => {
|
|
|
596
536
|
});
|
|
597
537
|
|
|
598
538
|
it("should process update to cooling mode datapoint", async () => {
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
value: "21.5",
|
|
608
|
-
},
|
|
609
|
-
odp0008: {
|
|
610
|
-
value: "1",
|
|
611
|
-
},
|
|
612
|
-
odp0010: {
|
|
613
|
-
value: "23",
|
|
614
|
-
},
|
|
615
|
-
};
|
|
539
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
540
|
+
channel.outputs!.odp0000.value = "0";
|
|
541
|
+
channel.outputs!.odp0001.value = "0";
|
|
542
|
+
channel.outputs!.odp0006.value = "21.5";
|
|
543
|
+
channel.outputs!.odp0008.value = "1";
|
|
544
|
+
channel.outputs!.odp0010.value = "23";
|
|
545
|
+
/* eslint-enable @typescript-eslint/no-non-null-assertion */
|
|
546
|
+
|
|
616
547
|
const accessory = new RoomTemperatureControllerAccessory(
|
|
617
548
|
platform,
|
|
618
549
|
platformAccessory
|
|
@@ -657,23 +588,14 @@ describe("Room Temperature Controller Accessory", () => {
|
|
|
657
588
|
});
|
|
658
589
|
|
|
659
590
|
it("should process update to controller on/off datapoint", async () => {
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
value: "21.5",
|
|
669
|
-
},
|
|
670
|
-
odp0008: {
|
|
671
|
-
value: "0",
|
|
672
|
-
},
|
|
673
|
-
odp0010: {
|
|
674
|
-
value: "20",
|
|
675
|
-
},
|
|
676
|
-
};
|
|
591
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
592
|
+
channel.outputs!.odp0000.value = "1";
|
|
593
|
+
channel.outputs!.odp0001.value = "0";
|
|
594
|
+
channel.outputs!.odp0006.value = "21.5";
|
|
595
|
+
channel.outputs!.odp0008.value = "0";
|
|
596
|
+
channel.outputs!.odp0010.value = "20";
|
|
597
|
+
/* eslint-enable @typescript-eslint/no-non-null-assertion */
|
|
598
|
+
|
|
677
599
|
const accessory = new RoomTemperatureControllerAccessory(
|
|
678
600
|
platform,
|
|
679
601
|
platformAccessory
|
|
@@ -724,23 +646,14 @@ describe("Room Temperature Controller Accessory", () => {
|
|
|
724
646
|
});
|
|
725
647
|
|
|
726
648
|
it("should process update to target temperature datapoint", async () => {
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
value: "21.5",
|
|
736
|
-
},
|
|
737
|
-
odp0008: {
|
|
738
|
-
value: "1",
|
|
739
|
-
},
|
|
740
|
-
odp0010: {
|
|
741
|
-
value: "20",
|
|
742
|
-
},
|
|
743
|
-
};
|
|
649
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
650
|
+
channel.outputs!.odp0000.value = "1";
|
|
651
|
+
channel.outputs!.odp0001.value = "0";
|
|
652
|
+
channel.outputs!.odp0006.value = "21.5";
|
|
653
|
+
channel.outputs!.odp0008.value = "1";
|
|
654
|
+
channel.outputs!.odp0010.value = "20";
|
|
655
|
+
/* eslint-enable @typescript-eslint/no-non-null-assertion */
|
|
656
|
+
|
|
744
657
|
const accessory = new RoomTemperatureControllerAccessory(
|
|
745
658
|
platform,
|
|
746
659
|
platformAccessory
|
|
@@ -785,23 +698,14 @@ describe("Room Temperature Controller Accessory", () => {
|
|
|
785
698
|
});
|
|
786
699
|
|
|
787
700
|
it("should process update to current temperature datapoint", async () => {
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
value: "21.5",
|
|
797
|
-
},
|
|
798
|
-
odp0008: {
|
|
799
|
-
value: "1",
|
|
800
|
-
},
|
|
801
|
-
odp0010: {
|
|
802
|
-
value: "20",
|
|
803
|
-
},
|
|
804
|
-
};
|
|
701
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
702
|
+
channel.outputs!.odp0000.value = "1";
|
|
703
|
+
channel.outputs!.odp0001.value = "0";
|
|
704
|
+
channel.outputs!.odp0006.value = "21.5";
|
|
705
|
+
channel.outputs!.odp0008.value = "1";
|
|
706
|
+
channel.outputs!.odp0010.value = "20";
|
|
707
|
+
/* eslint-enable @typescript-eslint/no-non-null-assertion */
|
|
708
|
+
|
|
805
709
|
const accessory = new RoomTemperatureControllerAccessory(
|
|
806
710
|
platform,
|
|
807
711
|
platformAccessory
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { InOutPut } from "freeathome-local-api-client";
|
|
2
|
+
import { getDataPointByPairingID } from "../src/util";
|
|
3
|
+
|
|
4
|
+
const datapoints: { [key: string]: InOutPut } = {
|
|
5
|
+
dp0: {
|
|
6
|
+
pairingID: 0,
|
|
7
|
+
value: "0",
|
|
8
|
+
},
|
|
9
|
+
dp1: {
|
|
10
|
+
pairingID: 1,
|
|
11
|
+
value: "1",
|
|
12
|
+
},
|
|
13
|
+
dp2: {
|
|
14
|
+
pairingID: 2,
|
|
15
|
+
value: "2",
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
describe("getDataPointByPairingID", () => {
|
|
20
|
+
it("should throw if datapoints are undefined", () => {
|
|
21
|
+
expect(() => getDataPointByPairingID(undefined, 1)).toThrowError(
|
|
22
|
+
"Data point object is undefined"
|
|
23
|
+
);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it("should throw no datapoint is found for the specified pairing ID", () => {
|
|
27
|
+
expect(() => getDataPointByPairingID(datapoints, 4)).toThrowError(
|
|
28
|
+
"No data point found for pairing ID 4"
|
|
29
|
+
);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it("should get data point for existing pairing ID", () => {
|
|
33
|
+
expect(getDataPointByPairingID(datapoints, 1)).toBe("dp1");
|
|
34
|
+
});
|
|
35
|
+
});
|