@pietrolubini/homebridge-ecoflow 1.6.0-alpha.0 → 1.7.0-alpha.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/.gitattributes +1 -0
- package/README.md +174 -63
- package/config.schema.json +46 -1
- package/dist/accessories/discovery/discoveryAccessory.d.ts +10 -0
- package/dist/accessories/discovery/discoveryAccessory.js +21 -0
- package/dist/accessories/discovery/discoveryAccessory.js.map +1 -0
- package/dist/accessories/discovery/interfaces/discoveryHttpApiContracts.d.ts +2 -0
- package/dist/accessories/discovery/interfaces/discoveryHttpApiContracts.js +3 -0
- package/dist/accessories/discovery/interfaces/discoveryHttpApiContracts.js.map +1 -0
- package/dist/accessories/discovery/simulations/discoverySimulator.d.ts +5 -0
- package/dist/accessories/discovery/simulations/discoverySimulator.js +17 -0
- package/dist/accessories/discovery/simulations/discoverySimulator.js.map +1 -0
- package/dist/accessories/ecoFlowAccessoryBase.d.ts +4 -1
- package/dist/accessories/ecoFlowAccessoryBase.js +27 -2
- package/dist/accessories/ecoFlowAccessoryBase.js.map +1 -1
- package/dist/accessories/powerocean/interfaces/powerOceanHttpApiContracts.d.ts +7 -0
- package/dist/accessories/powerocean/interfaces/powerOceanHttpApiContracts.js +3 -0
- package/dist/accessories/powerocean/interfaces/powerOceanHttpApiContracts.js.map +1 -0
- package/dist/accessories/powerocean/interfaces/powerOceanMqttApiContracts.d.ts +5 -0
- package/dist/accessories/powerocean/interfaces/powerOceanMqttApiContracts.js +3 -0
- package/dist/accessories/powerocean/interfaces/powerOceanMqttApiContracts.js.map +1 -0
- package/dist/accessories/powerocean/powerOceanAccessory.d.ts +24 -0
- package/dist/accessories/powerocean/powerOceanAccessory.js +87 -0
- package/dist/accessories/powerocean/powerOceanAccessory.js.map +1 -0
- package/dist/accessories/powerocean/simulations/powerOceanSimulator.d.ts +5 -0
- package/dist/accessories/powerocean/simulations/powerOceanSimulator.js +23 -0
- package/dist/accessories/powerocean/simulations/powerOceanSimulator.js.map +1 -0
- package/dist/accessories/powerstream/powerStreamAccessory.js +4 -5
- package/dist/accessories/powerstream/powerStreamAccessory.js.map +1 -1
- package/dist/apis/containers/mqttDevice.d.ts +2 -0
- package/dist/apis/containers/mqttDevice.js +7 -0
- package/dist/apis/containers/mqttDevice.js.map +1 -1
- package/dist/apis/ecoFlowMqttApiManager.d.ts +2 -0
- package/dist/apis/ecoFlowMqttApiManager.js +6 -0
- package/dist/apis/ecoFlowMqttApiManager.js.map +1 -1
- package/dist/apis/interfaces/mqttApiContracts.d.ts +11 -1
- package/dist/apis/interfaces/mqttApiContracts.js +1 -0
- package/dist/apis/interfaces/mqttApiContracts.js.map +1 -1
- package/dist/apis/simulations/mockMqttClient.d.ts +3 -1
- package/dist/apis/simulations/mockMqttClient.js +24 -5
- package/dist/apis/simulations/mockMqttClient.js.map +1 -1
- package/dist/apis/simulations/simulator.d.ts +2 -1
- package/dist/apis/simulations/simulator.js +12 -0
- package/dist/apis/simulations/simulator.js.map +1 -1
- package/dist/config.d.ts +8 -3
- package/dist/config.js +3 -1
- package/dist/config.js.map +1 -1
- package/dist/homebridge-ui/public/index.html +1 -1
- package/dist/homebridge-ui/public/index.js +1 -1
- package/dist/platform.js +14 -6
- package/dist/platform.js.map +1 -1
- package/dist/services/contactSensorService.d.ts +1 -0
- package/dist/services/contactSensorService.js +6 -3
- package/dist/services/contactSensorService.js.map +1 -1
- package/dist/services/fanServiceBase.d.ts +3 -1
- package/dist/services/fanServiceBase.js +21 -15
- package/dist/services/fanServiceBase.js.map +1 -1
- package/dist/services/lightBulbServiceBase.d.ts +3 -1
- package/dist/services/lightBulbServiceBase.js +21 -15
- package/dist/services/lightBulbServiceBase.js.map +1 -1
- package/dist/{accessories/powerstream/services/outletInvService.d.ts → services/outletReadOnlyService.d.ts} +2 -2
- package/dist/{accessories/powerstream/services/outletService.js → services/outletReadOnlyService.js} +4 -4
- package/dist/services/outletReadOnlyService.js.map +1 -0
- package/dist/services/outletReadOnlyService.spec.d.ts +1 -0
- package/dist/services/outletServiceBase.d.ts +1 -0
- package/dist/services/outletServiceBase.js +8 -5
- package/dist/services/outletServiceBase.js.map +1 -1
- package/dist/services/serviceBase.d.ts +6 -1
- package/dist/services/serviceBase.js +23 -10
- package/dist/services/serviceBase.js.map +1 -1
- package/dist/services/switchServiceBase.d.ts +1 -0
- package/dist/services/switchServiceBase.js +8 -5
- package/dist/services/switchServiceBase.js.map +1 -1
- package/dist/services/temperatureSensorService.d.ts +1 -1
- package/dist/services/temperatureSensorService.js +4 -3
- package/dist/services/temperatureSensorService.js.map +1 -1
- package/dist/services/thermostatFridgeServiceBase.d.ts +6 -3
- package/dist/services/thermostatFridgeServiceBase.js +50 -30
- package/dist/services/thermostatFridgeServiceBase.js.map +1 -1
- package/junit.xml +1038 -818
- package/package.json +1 -1
- package/dist/accessories/powerstream/services/outletInvService.js +0 -14
- package/dist/accessories/powerstream/services/outletInvService.js.map +0 -1
- package/dist/accessories/powerstream/services/outletService.d.ts +0 -9
- package/dist/accessories/powerstream/services/outletService.js.map +0 -1
- /package/dist/accessories/{powerstream/services/outletInvService.spec.d.ts → discovery/discoveryAccessory.spec.d.ts} +0 -0
- /package/dist/accessories/{powerstream/services/outletService.spec.d.ts → powerocean/powerOceanAccessory.spec.d.ts} +0 -0
package/dist/platform.js
CHANGED
|
@@ -6,8 +6,8 @@ const delta2MaxAccessory_1 = require("@ecoflow/accessories/batteries/delta2/delt
|
|
|
6
6
|
const delta2Simulator_1 = require("@ecoflow/accessories/batteries/delta2/simulations/delta2Simulator");
|
|
7
7
|
const deltaPro3Accessory_1 = require("@ecoflow/accessories/batteries/deltapro3/deltaPro3Accessory");
|
|
8
8
|
const deltaPro3Simulator_1 = require("@ecoflow/accessories/batteries/deltapro3/simulations/deltaPro3Simulator");
|
|
9
|
-
const
|
|
10
|
-
const
|
|
9
|
+
const discoveryAccessory_1 = require("@ecoflow/accessories/discovery/discoveryAccessory");
|
|
10
|
+
const discoverySimulator_1 = require("@ecoflow/accessories/discovery/simulations/discoverySimulator");
|
|
11
11
|
const powerStreamAccessory_1 = require("@ecoflow/accessories/powerstream/powerStreamAccessory");
|
|
12
12
|
const powerStreamSimulator_1 = require("@ecoflow/accessories/powerstream/simulations/powerStreamSimulator");
|
|
13
13
|
const smartPlugSimulator_1 = require("@ecoflow/accessories/smartplug/simulations/smartPlugSimulator");
|
|
@@ -189,6 +189,18 @@ class EcoFlowHomebridgePlatform {
|
|
|
189
189
|
// EcoFlowAccessoryType = DeltaProUltraAccessory;
|
|
190
190
|
// EcoFlowAccessorySimulatorType = DeltaProUltraSimulator;
|
|
191
191
|
// break;
|
|
192
|
+
case config_1.DeviceModel.Discovery:
|
|
193
|
+
EcoFlowAccessoryType = discoveryAccessory_1.DiscoveryAccessory;
|
|
194
|
+
EcoFlowAccessorySimulatorType = discoverySimulator_1.DiscoverySimulator;
|
|
195
|
+
break;
|
|
196
|
+
// case DeviceModel.Glacier:
|
|
197
|
+
// EcoFlowAccessoryType = GlacierAccessory;
|
|
198
|
+
// EcoFlowAccessorySimulatorType = GlacierSimulator;
|
|
199
|
+
// break;
|
|
200
|
+
// case DeviceModel.PowerOcean:
|
|
201
|
+
// EcoFlowAccessoryType = PowerOceanAccessory;
|
|
202
|
+
// EcoFlowAccessorySimulatorType = PowerOceanSimulator;
|
|
203
|
+
// break;
|
|
192
204
|
case config_1.DeviceModel.PowerStream:
|
|
193
205
|
EcoFlowAccessoryType = powerStreamAccessory_1.PowerStreamAccessory;
|
|
194
206
|
EcoFlowAccessorySimulatorType = powerStreamSimulator_1.PowerStreamSimulator;
|
|
@@ -197,10 +209,6 @@ class EcoFlowHomebridgePlatform {
|
|
|
197
209
|
EcoFlowAccessoryType = smartPlugAccessory_1.SmartPlugAccessory;
|
|
198
210
|
EcoFlowAccessorySimulatorType = smartPlugSimulator_1.SmartPlugSimulator;
|
|
199
211
|
break;
|
|
200
|
-
case config_1.DeviceModel.Glacier:
|
|
201
|
-
EcoFlowAccessoryType = glacierAccessory_1.GlacierAccessory;
|
|
202
|
-
EcoFlowAccessorySimulatorType = glacierSimulator_1.GlacierSimulator;
|
|
203
|
-
break;
|
|
204
212
|
default:
|
|
205
213
|
log.warn(`"${config.model}" is not supported. Ignoring the device`);
|
|
206
214
|
}
|
package/dist/platform.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform.js","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":";;;AAYA,2FAAwF;AACxF,iGAA8F;AAC9F,uGAAoG;AACpG,oGAAiG;AACjG,gHAA6G;
|
|
1
|
+
{"version":3,"file":"platform.js","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":";;;AAYA,2FAAwF;AACxF,iGAA8F;AAC9F,uGAAoG;AACpG,oGAAiG;AACjG,gHAA6G;AAC7G,0FAAuF;AACvF,sGAAmG;AAEnG,gGAA6F;AAC7F,4GAAyG;AACzG,sGAAmG;AACnG,0FAAuF;AACvF,+EAA4E;AAC5E,+EAA4E;AAE5E,wFAMuD;AACvD,4CAA2E;AAC3E,kFAA+E;AAC/E,oDAAiD;AACjD,0EAAuE;AACvE,gDAA+D;AAU/D,MAAa,yBAAyB;IAiBjB;IACD;IACA;IAlBD,aAAa,CAAgB;IAC9B,OAAO,CAAiB;IACxB,cAAc,CAAwB;IAEtD,oDAAoD;IACpC,WAAW,GAAwB,EAAE,CAAC;IAErC,cAAc,GAA0B,IAAI,6CAAqB,EAAE,CAAC;IACpE,cAAc,GAA0B,IAAI,6CAAqB,CAChF,IAAI,CAAC,cAAc,EACnB,IAAI,qCAAiB,EAAE,CACxB,CAAC;IAEe,qBAAqB,GAA0B,IAAI,6CAAqB,EAAE,CAAC;IAE5F,YACmB,SAAkB,EACnB,MAAsB,EACtB,GAAQ;QAFP,cAAS,GAAT,SAAS,CAAS;QACnB,WAAM,GAAN,MAAM,CAAgB;QACtB,QAAG,GAAH,GAAG,CAAK;QAExB,yBAAyB,CAAC,yBAAyB,CAAC,GA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AC5D,WAAW;YACX,KAAK,oBAAW,CAAC,SAAS;gBACxB,oBAAoB,GAAG,uCAAkB,CAAC;gBAC1C,6BAA6B,GAAG,uCAAkB,CAAC;gBACnD,MAAM;YACR,4BAA4B;YAC5B,6CAA6C;YAC7C,sDAAsD;YACtD,WAAW;YACX,+BAA+B;YAC/B,gDAAgD;YAChD,yDAAyD;YACzD,WAAW;YACX,KAAK,oBAAW,CAAC,WAAW;gBAC1B,oBAAoB,GAAG,2CAAoB,CAAC;gBAC5C,6BAA6B,GAAG,2CAAoB,CAAC;gBACrD,MAAM;YACR,KAAK,oBAAW,CAAC,SAAS;gBACxB,oBAAoB,GAAG,uCAAkB,CAAC;gBAC1C,6BAA6B,GAAG,uCAAkB,CAAC;gBACnD,MAAM;YACR;gBACE,GAAG,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,KAAK,yCAAyC,CAAC,CAAC;QACxE,CAAC;QACD,MAAM,CAAC,SAAS,GAAG,6BAA6B,CAAC;QACjD,IAAI,oBAAoB,KAAK,IAAI,EAAE,CAAC;YAClC,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,IAAI,oBAAoB,CAC7B,IAAI,EACJ,SAAS,EACT,MAAM,EACN,GAAG,EACH,IAAI,CAAC,cAAc,EACnB,IAAI,CAAC,cAAc,EACnB,IAAI,CAAC,qBAAqB,CAC3B,CAAC;IACJ,CAAC;CACF;AAtPD,8DAsPC"}
|
|
@@ -3,6 +3,7 @@ import { ServiceBase } from '@ecoflow/services/serviceBase';
|
|
|
3
3
|
import { Characteristic } from 'homebridge';
|
|
4
4
|
export declare class ContactSensorService extends ServiceBase {
|
|
5
5
|
protected readonly ecoFlowAccessory: EcoFlowAccessoryBase;
|
|
6
|
+
private contactState;
|
|
6
7
|
constructor(ecoFlowAccessory: EcoFlowAccessoryBase, serviceSubType?: string);
|
|
7
8
|
protected addCharacteristics(): Characteristic[];
|
|
8
9
|
updateState(closed: boolean): void;
|
|
@@ -4,17 +4,20 @@ exports.ContactSensorService = void 0;
|
|
|
4
4
|
const serviceBase_1 = require("@ecoflow/services/serviceBase");
|
|
5
5
|
class ContactSensorService extends serviceBase_1.ServiceBase {
|
|
6
6
|
ecoFlowAccessory;
|
|
7
|
+
contactState = this.platform.Characteristic.ContactSensorState.CONTACT_DETECTED;
|
|
7
8
|
constructor(ecoFlowAccessory, serviceSubType) {
|
|
8
9
|
super(ecoFlowAccessory.platform.Service.ContactSensor, ecoFlowAccessory, serviceSubType);
|
|
9
10
|
this.ecoFlowAccessory = ecoFlowAccessory;
|
|
10
11
|
}
|
|
11
12
|
addCharacteristics() {
|
|
12
|
-
|
|
13
|
+
const contactSensorStateCharacteristic = this.addCharacteristic(this.platform.Characteristic.ContactSensorState).onGet(() => this.processOnGet(this.contactState));
|
|
14
|
+
return [contactSensorStateCharacteristic];
|
|
13
15
|
}
|
|
14
16
|
updateState(closed) {
|
|
15
|
-
this.
|
|
17
|
+
this.contactState = closed
|
|
16
18
|
? this.platform.Characteristic.ContactSensorState.CONTACT_DETECTED
|
|
17
|
-
: this.platform.Characteristic.ContactSensorState.CONTACT_NOT_DETECTED
|
|
19
|
+
: this.platform.Characteristic.ContactSensorState.CONTACT_NOT_DETECTED;
|
|
20
|
+
this.updateCharacteristic(this.platform.Characteristic.ContactSensorState, 'State', this.contactState);
|
|
18
21
|
}
|
|
19
22
|
}
|
|
20
23
|
exports.ContactSensorService = ContactSensorService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contactSensorService.js","sourceRoot":"","sources":["../../src/services/contactSensorService.ts"],"names":[],"mappings":";;;AACA,+DAA4D;AAG5D,MAAa,oBAAqB,SAAQ,yBAAW;
|
|
1
|
+
{"version":3,"file":"contactSensorService.js","sourceRoot":"","sources":["../../src/services/contactSensorService.ts"],"names":[],"mappings":";;;AACA,+DAA4D;AAG5D,MAAa,oBAAqB,SAAQ,yBAAW;IAI9B;IAHb,YAAY,GAAW,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,kBAAkB,CAAC,gBAAgB,CAAC;IAEhG,YACqB,gBAAsC,EACzD,cAAuB;QAEvB,KAAK,CAAC,gBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC,aAAa,EAAE,gBAAgB,EAAE,cAAc,CAAC,CAAC;QAHtE,qBAAgB,GAAhB,gBAAgB,CAAsB;IAI3D,CAAC;IAEkB,kBAAkB;QACnC,MAAM,gCAAgC,GAAG,IAAI,CAAC,iBAAiB,CAC7D,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,kBAAkB,CAChD,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;QACpD,OAAO,CAAC,gCAAgC,CAAC,CAAC;IAC5C,CAAC;IAEM,WAAW,CAAC,MAAe;QAChC,IAAI,CAAC,YAAY,GAAG,MAAM;YACxB,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,kBAAkB,CAAC,gBAAgB;YAClE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,kBAAkB,CAAC,oBAAoB,CAAC;QAEzE,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,kBAAkB,EAAE,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IACzG,CAAC;CACF;AAxBD,oDAwBC"}
|
|
@@ -4,7 +4,9 @@ import { Characteristic } from 'homebridge';
|
|
|
4
4
|
export declare abstract class FanServiceBase extends ServiceBase {
|
|
5
5
|
protected readonly ecoFlowAccessory: EcoFlowAccessoryBase;
|
|
6
6
|
private readonly maxRotationSpeed;
|
|
7
|
-
private
|
|
7
|
+
private state;
|
|
8
|
+
private rotationSpeedPercents;
|
|
9
|
+
private rotationSpeed;
|
|
8
10
|
private rotationSpeedCharacteristic;
|
|
9
11
|
constructor(ecoFlowAccessory: EcoFlowAccessoryBase, maxRotationSpeed: number, serviceSubType: string);
|
|
10
12
|
protected addCharacteristics(): Characteristic[];
|
|
@@ -5,7 +5,9 @@ const serviceBase_1 = require("@ecoflow/services/serviceBase");
|
|
|
5
5
|
class FanServiceBase extends serviceBase_1.ServiceBase {
|
|
6
6
|
ecoFlowAccessory;
|
|
7
7
|
maxRotationSpeed;
|
|
8
|
-
|
|
8
|
+
state = false;
|
|
9
|
+
rotationSpeedPercents = 0;
|
|
10
|
+
rotationSpeed = 0;
|
|
9
11
|
rotationSpeedCharacteristic = null;
|
|
10
12
|
constructor(ecoFlowAccessory, maxRotationSpeed, serviceSubType) {
|
|
11
13
|
super(ecoFlowAccessory.platform.Service.Fan, ecoFlowAccessory, serviceSubType);
|
|
@@ -13,26 +15,30 @@ class FanServiceBase extends serviceBase_1.ServiceBase {
|
|
|
13
15
|
this.maxRotationSpeed = maxRotationSpeed;
|
|
14
16
|
}
|
|
15
17
|
addCharacteristics() {
|
|
16
|
-
const onCharacteristic = this.addCharacteristic(this.platform.Characteristic.On)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
this.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
this.rotationSpeedCharacteristic.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
this.
|
|
26
|
-
|
|
18
|
+
const onCharacteristic = this.addCharacteristic(this.platform.Characteristic.On)
|
|
19
|
+
.onGet(() => this.processOnGet(this.state))
|
|
20
|
+
.onSet(value => this.processOnSet(this.platform.Characteristic.On.name, () => {
|
|
21
|
+
this.state = value;
|
|
22
|
+
this.processOnSetOn(this.state, () => this.updateState(!this.state));
|
|
23
|
+
}));
|
|
24
|
+
this.rotationSpeedCharacteristic = this.addCharacteristic(this.platform.Characteristic.RotationSpeed)
|
|
25
|
+
.onGet(() => this.processOnGet(this.rotationSpeedPercents))
|
|
26
|
+
.onSet(percents => this.processOnSet(this.platform.Characteristic.RotationSpeed.name, () => {
|
|
27
|
+
this.rotationSpeedPercents = percents;
|
|
28
|
+
const prevRotationSpeed = this.rotationSpeed;
|
|
29
|
+
this.rotationSpeed = this.covertPercentsToValue(this.rotationSpeedPercents, this.maxRotationSpeed);
|
|
30
|
+
this.processOnSetRotationSpeed(this.rotationSpeed, () => this.updateRotationSpeed(prevRotationSpeed));
|
|
31
|
+
}));
|
|
27
32
|
return [onCharacteristic, this.rotationSpeedCharacteristic];
|
|
28
33
|
}
|
|
29
34
|
updateState(state) {
|
|
35
|
+
this.state = state;
|
|
30
36
|
this.updateCharacteristic(this.platform.Characteristic.On, 'State', state);
|
|
31
37
|
}
|
|
32
38
|
updateRotationSpeed(value) {
|
|
33
|
-
|
|
34
|
-
this.updateCharacteristic(this.platform.Characteristic.RotationSpeed, 'RotationSpeed',
|
|
35
|
-
this.
|
|
39
|
+
this.rotationSpeedPercents = this.covertValueToPercents(value, this.maxRotationSpeed);
|
|
40
|
+
this.updateCharacteristic(this.platform.Characteristic.RotationSpeed, 'RotationSpeed', this.rotationSpeedPercents);
|
|
41
|
+
this.rotationSpeed = value;
|
|
36
42
|
}
|
|
37
43
|
setRotationSpeed(value) {
|
|
38
44
|
this.rotationSpeedCharacteristic?.setValue(value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fanServiceBase.js","sourceRoot":"","sources":["../../src/services/fanServiceBase.ts"],"names":[],"mappings":";;;AACA,+DAA4D;AAG5D,MAAsB,cAAe,SAAQ,yBAAW;
|
|
1
|
+
{"version":3,"file":"fanServiceBase.js","sourceRoot":"","sources":["../../src/services/fanServiceBase.ts"],"names":[],"mappings":";;;AACA,+DAA4D;AAG5D,MAAsB,cAAe,SAAQ,yBAAW;IAOjC;IACF;IAPX,KAAK,GAAY,KAAK,CAAC;IACvB,qBAAqB,GAAW,CAAC,CAAC;IAClC,aAAa,GAAG,CAAC,CAAC;IAClB,2BAA2B,GAA0B,IAAI,CAAC;IAElE,YACqB,gBAAsC,EACxC,gBAAwB,EACzC,cAAsB;QAEtB,KAAK,CAAC,gBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,E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B,CAAC,CAAC;YACnG,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,aAAa,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,CAAC,CAAC;QACxG,CAAC,CAAC,CACH,CAAC;QAEJ,OAAO,CAAC,gBAAgB,EAAE,IAAI,CAAC,2BAA2B,CAAC,CAAC;IAC9D,CAAC;IAEM,WAAW,CAAC,KAAc;QAC/B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IAC7E,CAAC;IAEM,mBAAmB,CAAC,KAAa;QACtC,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC,qBAAqB,CAAC,KAAK,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACtF,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,aAAa,EAAE,eAAe,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;QACnH,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;IAC7B,CAAC;IAES,gBAAgB,CAAC,KAAa;QACtC,IAAI,CAAC,2BAA2B,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;IACpD,CAAC;CAKF;AAxDD,wCAwDC"}
|
|
@@ -4,7 +4,9 @@ import { Characteristic } from 'homebridge';
|
|
|
4
4
|
export declare abstract class LightBulbServiceBase extends ServiceBase {
|
|
5
5
|
protected readonly ecoFlowAccessory: EcoFlowAccessoryBase;
|
|
6
6
|
private readonly maxBrightness;
|
|
7
|
-
private
|
|
7
|
+
private state;
|
|
8
|
+
private brightnessPercents;
|
|
9
|
+
private brightness;
|
|
8
10
|
private brightnessCharacteristic;
|
|
9
11
|
constructor(ecoFlowAccessory: EcoFlowAccessoryBase, maxBrightness: number, serviceSubType: string);
|
|
10
12
|
protected addCharacteristics(): Characteristic[];
|
|
@@ -5,7 +5,9 @@ const serviceBase_1 = require("@ecoflow/services/serviceBase");
|
|
|
5
5
|
class LightBulbServiceBase extends serviceBase_1.ServiceBase {
|
|
6
6
|
ecoFlowAccessory;
|
|
7
7
|
maxBrightness;
|
|
8
|
-
|
|
8
|
+
state = false;
|
|
9
|
+
brightnessPercents = 0;
|
|
10
|
+
brightness = 0;
|
|
9
11
|
brightnessCharacteristic = null;
|
|
10
12
|
constructor(ecoFlowAccessory, maxBrightness, serviceSubType) {
|
|
11
13
|
super(ecoFlowAccessory.platform.Service.Lightbulb, ecoFlowAccessory, serviceSubType);
|
|
@@ -13,26 +15,30 @@ class LightBulbServiceBase extends serviceBase_1.ServiceBase {
|
|
|
13
15
|
this.maxBrightness = maxBrightness;
|
|
14
16
|
}
|
|
15
17
|
addCharacteristics() {
|
|
16
|
-
const onCharacteristic = this.addCharacteristic(this.platform.Characteristic.On)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
this.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
this.brightnessCharacteristic.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
this.
|
|
26
|
-
|
|
18
|
+
const onCharacteristic = this.addCharacteristic(this.platform.Characteristic.On)
|
|
19
|
+
.onGet(() => this.processOnGet(this.state))
|
|
20
|
+
.onSet(value => this.processOnSet(this.platform.Characteristic.On.name, () => {
|
|
21
|
+
this.state = value;
|
|
22
|
+
this.processOnSetOn(this.state, () => this.updateState(!this.state));
|
|
23
|
+
}));
|
|
24
|
+
this.brightnessCharacteristic = this.addCharacteristic(this.platform.Characteristic.Brightness)
|
|
25
|
+
.onGet(() => this.processOnGet(this.brightnessPercents))
|
|
26
|
+
.onSet(percents => this.processOnSet(this.platform.Characteristic.Brightness.name, () => {
|
|
27
|
+
this.brightnessPercents = percents;
|
|
28
|
+
const prevBrightness = this.brightness;
|
|
29
|
+
this.brightness = this.covertPercentsToValue(this.brightnessPercents, this.maxBrightness);
|
|
30
|
+
this.processOnSetBrightness(this.brightness, () => this.updateBrightness(prevBrightness));
|
|
31
|
+
}));
|
|
27
32
|
return [onCharacteristic, this.brightnessCharacteristic];
|
|
28
33
|
}
|
|
29
34
|
updateState(state) {
|
|
35
|
+
this.state = state;
|
|
30
36
|
this.updateCharacteristic(this.platform.Characteristic.On, 'State', state);
|
|
31
37
|
}
|
|
32
38
|
updateBrightness(value) {
|
|
33
|
-
|
|
34
|
-
this.updateCharacteristic(this.platform.Characteristic.Brightness, 'Brightness',
|
|
35
|
-
this.
|
|
39
|
+
this.brightnessPercents = this.covertValueToPercents(value, this.maxBrightness);
|
|
40
|
+
this.updateCharacteristic(this.platform.Characteristic.Brightness, 'Brightness', this.brightnessPercents);
|
|
41
|
+
this.brightness = value;
|
|
36
42
|
}
|
|
37
43
|
setBrightness(value) {
|
|
38
44
|
this.brightnessCharacteristic?.setValue(value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lightBulbServiceBase.js","sourceRoot":"","sources":["../../src/services/lightBulbServiceBase.ts"],"names":[],"mappings":";;;AACA,+DAA4D;AAG5D,MAAsB,oBAAqB,SAAQ,yBAAW;
|
|
1
|
+
{"version":3,"file":"lightBulbServiceBase.js","sourceRoot":"","sources":["../../src/services/lightBulbServiceBase.ts"],"names":[],"mappings":";;;AACA,+DAA4D;AAG5D,MAAsB,oBAAqB,SAAQ,yBAAW;IAOvC;IACF;IAPX,KAAK,GAAY,KAAK,CAAC;IACvB,kBAAkB,GAAW,CAAC,CAAC;IAC/B,UAAU,GAAW,CAAC,CAAC;IACvB,wBAAwB,GAA0B,IAAI,CAAC;IAE/D,YACqB,gBAAsC,EACxC,aAAqB,EACtC,cAAsB;QAEtB,KAAK,CAAC,gBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,EAAE,gBAAgB,EAAE,cAAc,CAAC,CAAC;QAJlE,qBAAgB,GAAhB,gBAAgB,CAAsB;QACxC,kBAAa,GAAb,aAAa,CAAQ;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Ac,CAAC,CAAC,CAAC;QAC5F,CAAC,CAAC,CACH,CAAC;QAEJ,OAAO,CAAC,gBAAgB,EAAE,IAAI,CAAC,wBAAwB,CAAC,CAAC;IAC3D,CAAC;IAEM,WAAW,CAAC,KAAc;QAC/B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IAC7E,CAAC;IAEM,gBAAgB,CAAC,KAAa;QACnC,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,qBAAqB,CAAC,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAChF,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,UAAU,EAAE,YAAY,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAC1G,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;IAC1B,CAAC;IAES,aAAa,CAAC,KAAa;QACnC,IAAI,CAAC,wBAAwB,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;IACjD,CAAC;CAKF;AAxDD,oDAwDC"}
|
|
@@ -2,7 +2,7 @@ import { EcoFlowAccessoryBase } from '@ecoflow/accessories/ecoFlowAccessoryBase'
|
|
|
2
2
|
import { AdditionalBatteryCharacteristicType as CharacteristicType } from '@ecoflow/config';
|
|
3
3
|
import { BatteryStatusProvider } from '@ecoflow/helpers/batteryStatusProvider';
|
|
4
4
|
import { OutletBatteryServiceBase } from '@ecoflow/services/outletBatteryServiceBase';
|
|
5
|
-
export declare class
|
|
6
|
-
constructor(ecoFlowAccessory: EcoFlowAccessoryBase, batteryStatusProvider: BatteryStatusProvider, additionalCharacteristics?: CharacteristicType[]);
|
|
5
|
+
export declare class OutletReadOnlyService extends OutletBatteryServiceBase {
|
|
6
|
+
constructor(ecoFlowAccessory: EcoFlowAccessoryBase, batteryStatusProvider: BatteryStatusProvider, serviceSubType: string, additionalCharacteristics?: CharacteristicType[]);
|
|
7
7
|
protected processOnSetOn(): Promise<void>;
|
|
8
8
|
}
|
package/dist/{accessories/powerstream/services/outletService.js → services/outletReadOnlyService.js}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.OutletReadOnlyService = void 0;
|
|
4
4
|
const outletBatteryServiceBase_1 = require("@ecoflow/services/outletBatteryServiceBase");
|
|
5
|
-
class
|
|
5
|
+
class OutletReadOnlyService extends outletBatteryServiceBase_1.OutletBatteryServiceBase {
|
|
6
6
|
constructor(ecoFlowAccessory, batteryStatusProvider, serviceSubType, additionalCharacteristics) {
|
|
7
7
|
super(ecoFlowAccessory, batteryStatusProvider, serviceSubType, additionalCharacteristics);
|
|
8
8
|
}
|
|
@@ -10,5 +10,5 @@ class OutletService extends outletBatteryServiceBase_1.OutletBatteryServiceBase
|
|
|
10
10
|
throw new this.platform.api.hap.HapStatusError(-70404 /* this.platform.api.hap.HAPStatus.READ_ONLY_CHARACTERISTIC */);
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
exports.
|
|
14
|
-
//# sourceMappingURL=
|
|
13
|
+
exports.OutletReadOnlyService = OutletReadOnlyService;
|
|
14
|
+
//# sourceMappingURL=outletReadOnlyService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outletReadOnlyService.js","sourceRoot":"","sources":["../../src/services/outletReadOnlyService.ts"],"names":[],"mappings":";;;AAGA,yFAAsF;AAEtF,MAAa,qBAAsB,SAAQ,mDAAwB;IACjE,YACE,gBAAsC,EACtC,qBAA4C,EAC5C,cAAsB,EACtB,yBAAgD;QAEhD,KAAK,CAAC,gBAAgB,EAAE,qBAAqB,EAAE,cAAc,EAAE,yBAAyB,CAAC,CAAC;IAC5F,CAAC;IAEkB,cAAc;QAC/B,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,cAAc,uEAA0D,CAAC;IAC3G,CAAC;CACF;AAbD,sDAaC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -3,6 +3,7 @@ import { ServiceBase } from '@ecoflow/services/serviceBase';
|
|
|
3
3
|
import { Characteristic, CharacteristicValue, WithUUID } from 'homebridge';
|
|
4
4
|
export declare abstract class OutletServiceBase extends ServiceBase {
|
|
5
5
|
private readonly additionalCharacteristics?;
|
|
6
|
+
private state;
|
|
6
7
|
constructor(ecoFlowAccessory: EcoFlowAccessoryBase, additionalCharacteristics?: string[] | undefined, serviceSubType?: string);
|
|
7
8
|
updateState(state: boolean): void;
|
|
8
9
|
updateOutputConsumption(watt: number): void;
|
|
@@ -5,11 +5,13 @@ const config_1 = require("@ecoflow/config");
|
|
|
5
5
|
const serviceBase_1 = require("@ecoflow/services/serviceBase");
|
|
6
6
|
class OutletServiceBase extends serviceBase_1.ServiceBase {
|
|
7
7
|
additionalCharacteristics;
|
|
8
|
+
state = false;
|
|
8
9
|
constructor(ecoFlowAccessory, additionalCharacteristics, serviceSubType) {
|
|
9
10
|
super(ecoFlowAccessory.platform.Service.Outlet, ecoFlowAccessory, serviceSubType);
|
|
10
11
|
this.additionalCharacteristics = additionalCharacteristics;
|
|
11
12
|
}
|
|
12
13
|
updateState(state) {
|
|
14
|
+
this.state = state;
|
|
13
15
|
this.updateCharacteristic(this.platform.Characteristic.On, 'State', state);
|
|
14
16
|
}
|
|
15
17
|
updateOutputConsumption(watt) {
|
|
@@ -23,11 +25,12 @@ class OutletServiceBase extends serviceBase_1.ServiceBase {
|
|
|
23
25
|
this.updateCustomCharacteristic(this.platform.Characteristic.PowerConsumption.OutputCurrent, 'Output Current, A', () => ampere, config_1.AdditionalOutletCharacteristicType.OutputCurrent);
|
|
24
26
|
}
|
|
25
27
|
addCharacteristics() {
|
|
26
|
-
const onCharacteristic = this.addCharacteristic(this.platform.Characteristic.On)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
this.
|
|
30
|
-
|
|
28
|
+
const onCharacteristic = this.addCharacteristic(this.platform.Characteristic.On)
|
|
29
|
+
.onGet(() => this.processOnGet(this.state))
|
|
30
|
+
.onSet((value) => this.processOnSet(this.platform.Characteristic.On.name, () => {
|
|
31
|
+
this.state = value;
|
|
32
|
+
this.processOnSetOn(this.state, () => this.updateState(!this.state));
|
|
33
|
+
}));
|
|
31
34
|
const characteristics = [
|
|
32
35
|
this.addCharacteristic(this.platform.Characteristic.OutletInUse),
|
|
33
36
|
onCharacteristic,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outletServiceBase.js","sourceRoot":"","sources":["../../src/services/outletServiceBase.ts"],"names":[],"mappings":";;;AACA,4CAAiG;AACjG,+DAA4D;AAG5D,MAAsB,iBAAkB,SAAQ,yBAAW;
|
|
1
|
+
{"version":3,"file":"outletServiceBase.js","sourceRoot":"","sources":["../../src/services/outletServiceBase.ts"],"names":[],"mappings":";;;AACA,4CAAiG;AACjG,+DAA4D;AAG5D,MAAsB,iBAAkB,SAAQ,yBAAW;IAKtC;IAJX,KAAK,GAAY,KAAK,CAAC;IAE/B,YACE,gBAAsC,EACrB,yBAAoC,EACrD,cAAuB;QAEvB,KAAK,CAAC,gBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,gBAAgB,EAAE,cAAc,CAAC,CAAC;QAHjE,8BAAyB,GAAzB,yBAAyB,CAAW;IAIvD,CAAC;IAEM,WAAW,CAAC,KAAc;QAC/B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IAC7E,CAAC;IAEM,uBAAuB,CAAC,IAAY;QACzC,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,QAAQ,CAAC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;CACF;AAjGD,8CAiGC"}
|
|
@@ -9,12 +9,14 @@ export declare abstract class ServiceBase {
|
|
|
9
9
|
protected readonly platform: EcoFlowHomebridgePlatform;
|
|
10
10
|
protected characteristics: Characteristic[];
|
|
11
11
|
private _service;
|
|
12
|
+
private isReachable;
|
|
12
13
|
private enabled;
|
|
13
14
|
constructor(serviceType: WithUUID<typeof Service>, ecoFlowAccessory: EcoFlowAccessoryBase, serviceSubType?: string | undefined);
|
|
14
15
|
initialize(): void;
|
|
15
16
|
cleanupCharacteristics(): void;
|
|
16
17
|
get service(): Service;
|
|
17
18
|
updateEnabled(enabled: boolean): void;
|
|
19
|
+
updateReachability(value: boolean): void;
|
|
18
20
|
protected get serviceName(): string;
|
|
19
21
|
protected createService(): Service;
|
|
20
22
|
protected abstract addCharacteristics(): Characteristic[];
|
|
@@ -29,5 +31,8 @@ export declare abstract class ServiceBase {
|
|
|
29
31
|
protected covertPercentsToValue(percents: number, maxValue: number): number;
|
|
30
32
|
protected covertValueToPercents(value: number, maxValue: number): number;
|
|
31
33
|
protected onDisabled(): void;
|
|
32
|
-
protected
|
|
34
|
+
protected processOnGet<TValue>(value: TValue): TValue;
|
|
35
|
+
protected processOnSet(name: string, func: () => void): void;
|
|
36
|
+
private checkIsReachable;
|
|
37
|
+
private checkIsEnabled;
|
|
33
38
|
}
|
|
@@ -9,6 +9,7 @@ class ServiceBase {
|
|
|
9
9
|
platform;
|
|
10
10
|
characteristics = [];
|
|
11
11
|
_service = null;
|
|
12
|
+
isReachable = true;
|
|
12
13
|
enabled = true;
|
|
13
14
|
constructor(serviceType, ecoFlowAccessory, serviceSubType) {
|
|
14
15
|
this.serviceType = serviceType;
|
|
@@ -44,6 +45,9 @@ class ServiceBase {
|
|
|
44
45
|
this.onDisabled();
|
|
45
46
|
}
|
|
46
47
|
}
|
|
48
|
+
updateReachability(value) {
|
|
49
|
+
this.isReachable = value;
|
|
50
|
+
}
|
|
47
51
|
get serviceName() {
|
|
48
52
|
return this.ecoFlowAccessory.config.name + (this.serviceSubType ? ` ${this.serviceSubType}` : '');
|
|
49
53
|
}
|
|
@@ -78,16 +82,25 @@ class ServiceBase {
|
|
|
78
82
|
return (value * 100) / maxValue;
|
|
79
83
|
}
|
|
80
84
|
onDisabled() { }
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
85
|
+
processOnGet(value) {
|
|
86
|
+
this.checkIsReachable();
|
|
87
|
+
return value;
|
|
88
|
+
}
|
|
89
|
+
processOnSet(name, func) {
|
|
90
|
+
this.checkIsReachable();
|
|
91
|
+
this.checkIsEnabled(name);
|
|
92
|
+
func();
|
|
93
|
+
}
|
|
94
|
+
checkIsReachable() {
|
|
95
|
+
if (!this.isReachable) {
|
|
96
|
+
throw new this.platform.api.hap.HapStatusError(-70402 /* this.platform.api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE */);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
checkIsEnabled(name) {
|
|
100
|
+
if (!this.enabled) {
|
|
101
|
+
this.log.warn(`[${this.serviceName}] Service is disabled. Setting of "${name}" is disallowed`);
|
|
102
|
+
throw new this.platform.api.hap.HapStatusError(-70404 /* this.platform.api.hap.HAPStatus.READ_ONLY_CHARACTERISTIC */);
|
|
103
|
+
}
|
|
91
104
|
}
|
|
92
105
|
}
|
|
93
106
|
exports.ServiceBase = ServiceBase;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serviceBase.js","sourceRoot":"","sources":["../../src/services/serviceBase.ts"],"names":[],"mappings":";;;AAIA,MAAsB,WAAW;
|
|
1
|
+
{"version":3,"file":"serviceBase.js","sourceRoot":"","sources":["../../src/services/serviceBase.ts"],"names":[],"mappings":";;;AAIA,MAAsB,WAAW;IASZ;IACE;IACA;IAVF,GAAG,CAAU;IACb,QAAQ,CAA4B;IAC7C,eAAe,GAAqB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AI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QAC1B,IAAI,EAAE,CAAC;IACT,CAAC;IAEO,gBAAgB;QACtB,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACtB,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,cAAc,4EAA+D,CAAC;QAChH,CAAC;IACH,CAAC;IAEO,cAAc,CAAC,IAAY;QACjC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,WAAW,sCAAsC,IAAI,iBAAiB,CAAC,CAAC;YAC/F,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,cAAc,uEAA0D,CAAC;QAC3G,CAAC;IACH,CAAC;CACF;AApID,kCAoIC"}
|
|
@@ -2,6 +2,7 @@ import { EcoFlowAccessoryBase } from '@ecoflow/accessories/ecoFlowAccessoryBase'
|
|
|
2
2
|
import { ServiceBase } from '@ecoflow/services/serviceBase';
|
|
3
3
|
import { Characteristic } from 'homebridge';
|
|
4
4
|
export declare abstract class SwitchServiceBase extends ServiceBase {
|
|
5
|
+
private state;
|
|
5
6
|
constructor(ecoFlowAccessory: EcoFlowAccessoryBase, serviceSubType: string);
|
|
6
7
|
updateState(state: boolean): void;
|
|
7
8
|
protected onDisabled(): void;
|
|
@@ -3,21 +3,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SwitchServiceBase = void 0;
|
|
4
4
|
const serviceBase_1 = require("@ecoflow/services/serviceBase");
|
|
5
5
|
class SwitchServiceBase extends serviceBase_1.ServiceBase {
|
|
6
|
+
state = false;
|
|
6
7
|
constructor(ecoFlowAccessory, serviceSubType) {
|
|
7
8
|
super(ecoFlowAccessory.platform.Service.Switch, ecoFlowAccessory, serviceSubType);
|
|
8
9
|
}
|
|
9
10
|
updateState(state) {
|
|
11
|
+
this.state = state;
|
|
10
12
|
this.updateCharacteristic(this.platform.Characteristic.On, 'State', state);
|
|
11
13
|
}
|
|
12
14
|
onDisabled() {
|
|
13
15
|
this.updateState(false);
|
|
14
16
|
}
|
|
15
17
|
addCharacteristics() {
|
|
16
|
-
const onCharacteristic = this.addCharacteristic(this.platform.Characteristic.On)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
this.
|
|
20
|
-
|
|
18
|
+
const onCharacteristic = this.addCharacteristic(this.platform.Characteristic.On)
|
|
19
|
+
.onGet(() => this.processOnGet(this.state))
|
|
20
|
+
.onSet((value) => this.processOnSet(this.platform.Characteristic.On.name, () => {
|
|
21
|
+
this.state = value;
|
|
22
|
+
this.processOnSetOn(this.state, () => this.updateState(!this.state));
|
|
23
|
+
}));
|
|
21
24
|
this.service.setCharacteristic(this.platform.Characteristic.Name, this.serviceName);
|
|
22
25
|
return [onCharacteristic];
|
|
23
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switchServiceBase.js","sourceRoot":"","sources":["../../src/services/switchServiceBase.ts"],"names":[],"mappings":";;;AACA,+DAA4D;AAG5D,MAAsB,iBAAkB,SAAQ,yBAAW;
|
|
1
|
+
{"version":3,"file":"switchServiceBase.js","sourceRoot":"","sources":["../../src/services/switchServiceBase.ts"],"names":[],"mappings":";;;AACA,+DAA4D;AAG5D,MAAsB,iBAAkB,SAAQ,yBAAW;IACjD,KAAK,GAAY,KAAK,CAAC;IAE/B,YAAY,gBAAsC,EAAE,cAAsB;QACxE,KAAK,CAAC,gBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,gBAAgB,EAAE,cAAc,CAAC,CAAC;IACpF,CAAC;IAEM,WAAW,CAAC,KAAc;QAC/B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IAC7E,CAAC;IAEkB,UAAU;QAC3B,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;IAEkB,kBAAkB;QACnC,MAAM,gBAAgB,GAAG,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;aAC7E,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aAC1C,KAAK,CAAC,CAAC,KAA0B,EAAE,EAAE,CACpC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE;YAC3D,IAAI,CAAC,KAAK,GAAG,KAAgB,CAAC;YAC9B,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QACvE,CAAC,CAAC,CACH,CAAC;QAEJ,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAEpF,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC5B,CAAC;CAGF;AAhCD,8CAgCC"}
|
|
@@ -3,7 +3,7 @@ import { ServiceBase } from '@ecoflow/services/serviceBase';
|
|
|
3
3
|
import { Characteristic } from 'homebridge';
|
|
4
4
|
export declare class TemperatureSensorService extends ServiceBase {
|
|
5
5
|
protected readonly ecoFlowAccessory: EcoFlowAccessoryBase;
|
|
6
|
-
private
|
|
6
|
+
private currentTemperature;
|
|
7
7
|
constructor(ecoFlowAccessory: EcoFlowAccessoryBase, serviceSubType?: string);
|
|
8
8
|
protected addCharacteristics(): Characteristic[];
|
|
9
9
|
updateCurrentTemperature(value: number): void;
|
|
@@ -4,16 +4,17 @@ exports.TemperatureSensorService = void 0;
|
|
|
4
4
|
const serviceBase_1 = require("@ecoflow/services/serviceBase");
|
|
5
5
|
class TemperatureSensorService extends serviceBase_1.ServiceBase {
|
|
6
6
|
ecoFlowAccessory;
|
|
7
|
-
|
|
7
|
+
currentTemperature = 0;
|
|
8
8
|
constructor(ecoFlowAccessory, serviceSubType) {
|
|
9
9
|
super(ecoFlowAccessory.platform.Service.TemperatureSensor, ecoFlowAccessory, serviceSubType);
|
|
10
10
|
this.ecoFlowAccessory = ecoFlowAccessory;
|
|
11
11
|
}
|
|
12
12
|
addCharacteristics() {
|
|
13
|
-
|
|
14
|
-
return [
|
|
13
|
+
const temperatureCharacteristic = this.addCharacteristic(this.platform.Characteristic.CurrentTemperature).onGet(() => this.processOnGet(this.currentTemperature));
|
|
14
|
+
return [temperatureCharacteristic];
|
|
15
15
|
}
|
|
16
16
|
updateCurrentTemperature(value) {
|
|
17
|
+
this.currentTemperature = value;
|
|
17
18
|
this.updateCharacteristic(this.platform.Characteristic.CurrentTemperature, 'Current Temperature', value);
|
|
18
19
|
}
|
|
19
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"temperatureSensorService.js","sourceRoot":"","sources":["../../src/services/temperatureSensorService.ts"],"names":[],"mappings":";;;AACA,+DAA4D;AAG5D,MAAa,wBAAyB,SAAQ,yBAAW;IAIlC;IAHb,
|
|
1
|
+
{"version":3,"file":"temperatureSensorService.js","sourceRoot":"","sources":["../../src/services/temperatureSensorService.ts"],"names":[],"mappings":";;;AACA,+DAA4D;AAG5D,MAAa,wBAAyB,SAAQ,yBAAW;IAIlC;IAHb,kBAAkB,GAAW,CAAC,CAAC;IAEvC,YACqB,gBAAsC,EACzD,cAAuB;QAEvB,KAAK,CAAC,gBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC,iBAAiB,EAAE,gBAAgB,EAAE,cAAc,CAAC,CAAC;QAH1E,qBAAgB,GAAhB,gBAAgB,CAAsB;IAI3D,CAAC;IAEkB,kBAAkB;QACnC,MAAM,yBAAyB,GAAG,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,kBAAkB,CAAC,CAAC,KAAK,CAC7G,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,kBAAkB,CAAC,CACjD,CAAC;QACF,OAAO,CAAC,yBAAyB,CAAC,CAAC;IACrC,CAAC;IAEM,wBAAwB,CAAC,KAAa;QAC3C,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;QAChC,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,kBAAkB,EAAE,qBAAqB,EAAE,KAAK,CAAC,CAAC;IAC3G,CAAC;CACF;AArBD,4DAqBC"}
|
|
@@ -5,9 +5,12 @@ import { Characteristic } from 'homebridge';
|
|
|
5
5
|
export declare abstract class ThermostatFridgeServiceBase extends ServiceBase {
|
|
6
6
|
private readonly minTemperature;
|
|
7
7
|
private readonly maxTemperature;
|
|
8
|
-
private
|
|
9
|
-
private
|
|
10
|
-
private
|
|
8
|
+
private currentTemperature;
|
|
9
|
+
private targetTemperature;
|
|
10
|
+
private currentHeatingCoolingStateType;
|
|
11
|
+
private targetHeatingCoolingStateType;
|
|
12
|
+
private targetFridgeState;
|
|
13
|
+
private temperatureDisplayUnits;
|
|
11
14
|
constructor(ecoFlowAccessory: EcoFlowAccessoryBase, minTemperature: number, maxTemperature: number, serviceSubType: string);
|
|
12
15
|
updateCurrentTemperature(value: number): void;
|
|
13
16
|
updateTargetTemperature(value: number): void;
|