@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.
Files changed (87) hide show
  1. package/.gitattributes +1 -0
  2. package/README.md +174 -63
  3. package/config.schema.json +46 -1
  4. package/dist/accessories/discovery/discoveryAccessory.d.ts +10 -0
  5. package/dist/accessories/discovery/discoveryAccessory.js +21 -0
  6. package/dist/accessories/discovery/discoveryAccessory.js.map +1 -0
  7. package/dist/accessories/discovery/interfaces/discoveryHttpApiContracts.d.ts +2 -0
  8. package/dist/accessories/discovery/interfaces/discoveryHttpApiContracts.js +3 -0
  9. package/dist/accessories/discovery/interfaces/discoveryHttpApiContracts.js.map +1 -0
  10. package/dist/accessories/discovery/simulations/discoverySimulator.d.ts +5 -0
  11. package/dist/accessories/discovery/simulations/discoverySimulator.js +17 -0
  12. package/dist/accessories/discovery/simulations/discoverySimulator.js.map +1 -0
  13. package/dist/accessories/ecoFlowAccessoryBase.d.ts +4 -1
  14. package/dist/accessories/ecoFlowAccessoryBase.js +27 -2
  15. package/dist/accessories/ecoFlowAccessoryBase.js.map +1 -1
  16. package/dist/accessories/powerocean/interfaces/powerOceanHttpApiContracts.d.ts +7 -0
  17. package/dist/accessories/powerocean/interfaces/powerOceanHttpApiContracts.js +3 -0
  18. package/dist/accessories/powerocean/interfaces/powerOceanHttpApiContracts.js.map +1 -0
  19. package/dist/accessories/powerocean/interfaces/powerOceanMqttApiContracts.d.ts +5 -0
  20. package/dist/accessories/powerocean/interfaces/powerOceanMqttApiContracts.js +3 -0
  21. package/dist/accessories/powerocean/interfaces/powerOceanMqttApiContracts.js.map +1 -0
  22. package/dist/accessories/powerocean/powerOceanAccessory.d.ts +24 -0
  23. package/dist/accessories/powerocean/powerOceanAccessory.js +87 -0
  24. package/dist/accessories/powerocean/powerOceanAccessory.js.map +1 -0
  25. package/dist/accessories/powerocean/simulations/powerOceanSimulator.d.ts +5 -0
  26. package/dist/accessories/powerocean/simulations/powerOceanSimulator.js +23 -0
  27. package/dist/accessories/powerocean/simulations/powerOceanSimulator.js.map +1 -0
  28. package/dist/accessories/powerstream/powerStreamAccessory.js +4 -5
  29. package/dist/accessories/powerstream/powerStreamAccessory.js.map +1 -1
  30. package/dist/apis/containers/mqttDevice.d.ts +2 -0
  31. package/dist/apis/containers/mqttDevice.js +7 -0
  32. package/dist/apis/containers/mqttDevice.js.map +1 -1
  33. package/dist/apis/ecoFlowMqttApiManager.d.ts +2 -0
  34. package/dist/apis/ecoFlowMqttApiManager.js +6 -0
  35. package/dist/apis/ecoFlowMqttApiManager.js.map +1 -1
  36. package/dist/apis/interfaces/mqttApiContracts.d.ts +11 -1
  37. package/dist/apis/interfaces/mqttApiContracts.js +1 -0
  38. package/dist/apis/interfaces/mqttApiContracts.js.map +1 -1
  39. package/dist/apis/simulations/mockMqttClient.d.ts +3 -1
  40. package/dist/apis/simulations/mockMqttClient.js +24 -5
  41. package/dist/apis/simulations/mockMqttClient.js.map +1 -1
  42. package/dist/apis/simulations/simulator.d.ts +2 -1
  43. package/dist/apis/simulations/simulator.js +12 -0
  44. package/dist/apis/simulations/simulator.js.map +1 -1
  45. package/dist/config.d.ts +8 -3
  46. package/dist/config.js +3 -1
  47. package/dist/config.js.map +1 -1
  48. package/dist/homebridge-ui/public/index.html +1 -1
  49. package/dist/homebridge-ui/public/index.js +1 -1
  50. package/dist/platform.js +14 -6
  51. package/dist/platform.js.map +1 -1
  52. package/dist/services/contactSensorService.d.ts +1 -0
  53. package/dist/services/contactSensorService.js +6 -3
  54. package/dist/services/contactSensorService.js.map +1 -1
  55. package/dist/services/fanServiceBase.d.ts +3 -1
  56. package/dist/services/fanServiceBase.js +21 -15
  57. package/dist/services/fanServiceBase.js.map +1 -1
  58. package/dist/services/lightBulbServiceBase.d.ts +3 -1
  59. package/dist/services/lightBulbServiceBase.js +21 -15
  60. package/dist/services/lightBulbServiceBase.js.map +1 -1
  61. package/dist/{accessories/powerstream/services/outletInvService.d.ts → services/outletReadOnlyService.d.ts} +2 -2
  62. package/dist/{accessories/powerstream/services/outletService.js → services/outletReadOnlyService.js} +4 -4
  63. package/dist/services/outletReadOnlyService.js.map +1 -0
  64. package/dist/services/outletReadOnlyService.spec.d.ts +1 -0
  65. package/dist/services/outletServiceBase.d.ts +1 -0
  66. package/dist/services/outletServiceBase.js +8 -5
  67. package/dist/services/outletServiceBase.js.map +1 -1
  68. package/dist/services/serviceBase.d.ts +6 -1
  69. package/dist/services/serviceBase.js +23 -10
  70. package/dist/services/serviceBase.js.map +1 -1
  71. package/dist/services/switchServiceBase.d.ts +1 -0
  72. package/dist/services/switchServiceBase.js +8 -5
  73. package/dist/services/switchServiceBase.js.map +1 -1
  74. package/dist/services/temperatureSensorService.d.ts +1 -1
  75. package/dist/services/temperatureSensorService.js +4 -3
  76. package/dist/services/temperatureSensorService.js.map +1 -1
  77. package/dist/services/thermostatFridgeServiceBase.d.ts +6 -3
  78. package/dist/services/thermostatFridgeServiceBase.js +50 -30
  79. package/dist/services/thermostatFridgeServiceBase.js.map +1 -1
  80. package/junit.xml +1038 -818
  81. package/package.json +1 -1
  82. package/dist/accessories/powerstream/services/outletInvService.js +0 -14
  83. package/dist/accessories/powerstream/services/outletInvService.js.map +0 -1
  84. package/dist/accessories/powerstream/services/outletService.d.ts +0 -9
  85. package/dist/accessories/powerstream/services/outletService.js.map +0 -1
  86. /package/dist/accessories/{powerstream/services/outletInvService.spec.d.ts → discovery/discoveryAccessory.spec.d.ts} +0 -0
  87. /package/dist/accessories/{powerstream/services/outletService.spec.d.ts → powerocean/powerOceanAccessory.spec.d.ts} +0 -0
package/.gitattributes CHANGED
@@ -5,3 +5,4 @@
5
5
  *.jpeg binary -crlf
6
6
  *.gif binary -crlf
7
7
  *.pdf binary -crlf
8
+ *.wasm binary -crlf
package/README.md CHANGED
@@ -25,6 +25,7 @@ The goal is to add HomeKit support to EcoFlow devices and make them fully contro
25
25
  - Integrates EcoFlow devices into HomeKit
26
26
  - Fully customizable HomeKit accessories
27
27
  - HomeKit automations for your EcoFlow devices
28
+ - Detection of whether EcoFlow accessory is online/offline
28
29
 
29
30
  ## Supported Device Types
30
31
 
@@ -33,9 +34,11 @@ The goal is to add HomeKit support to EcoFlow devices and make them fully contro
33
34
  - [Delta Pro](#delta-pro)
34
35
  - [Delta Pro 3](#delta-pro-3)
35
36
  - [Delta Pro Ultra](#delta-pro-ultra)
37
+ - [Discovery](#discovery)
38
+ - [Glacier](#glacier)
39
+ - [PowerOcean](#powerocean)
36
40
  - [PowerStream Micro-inverter](#powerstream-micro-inverter)
37
41
  - [Smart Plug](#smart-plug)
38
- - [Glacier](#glacier)
39
42
 
40
43
  For a full list of devices that could be potentially added check [here](https://developer-eu.ecoflow.com/us/document/introduction)
41
44
 
@@ -130,8 +133,8 @@ Quota is sent every 10 seconds with random values in this mode.
130
133
  | Output | Outlet AC | Output Consumption, W | 🔲 | Read |
131
134
  | Charging State | Outlet AC | ChargingState, Yes/No | 🔲 | Read |
132
135
  | Battery Level | Outlet AC | StatusLowBattery, Yes/No | 🔲 | Read |
133
- | 12V DC | Outlet CAR | On | ✅ | Read/Write |
134
- | 12V DC Output | Outlet CAR | OutletInUse | ✅ | Read |
136
+ | DC 12V | Outlet CAR | On | ✅ | Read/Write |
137
+ | DC 12V Output | Outlet CAR | OutletInUse | ✅ | Read |
135
138
  | Battery Level | Outlet CAR | Battery Level, % | 🔲 | Read |
136
139
  | Input | Outlet CAR | Input Consumption, W | 🔲 | Read |
137
140
  | Output | Outlet CAR | Output Consumption, W | 🔲 | Read |
@@ -203,8 +206,8 @@ Supported services and configuration are the same as for [Delta 2](#delta-2)
203
206
  | Output | Outlet AC | Output Consumption, W | 🔲 | Read |
204
207
  | Charging State | Outlet AC | ChargingState, Yes/No | 🔲 | Read |
205
208
  | Battery Level | Outlet AC | StatusLowBattery, Yes/No | 🔲 | Read |
206
- | 12V DC | Outlet CAR | On | ✅ | Read/Write |
207
- | 12V DC Output | Outlet CAR | OutletInUse | ✅ | Read |
209
+ | DC 12V | Outlet CAR | On | ✅ | Read/Write |
210
+ | DC 12V Output | Outlet CAR | OutletInUse | ✅ | Read |
208
211
  | Battery Level | Outlet CAR | Battery Level, % | 🔲 | Read |
209
212
  | Input | Outlet CAR | Input Consumption, W | 🔲 | Read |
210
213
  | Output | Outlet CAR | Output Consumption, W | 🔲 | Read |
@@ -358,6 +361,172 @@ The following additional characteristics is available:
358
361
  }
359
362
  ```
360
363
 
364
+ ### Discovery
365
+
366
+ Type of device that helps to discover whether support for device that is not listed in [Ecoflow IoT Developer Platform](https://developer-eu.ecoflow.com/us/document/introduction) documentation could be added or not.
367
+
368
+ #### Steps
369
+
370
+ - Configure new device in UI with parameters:
371
+ ```json
372
+ {
373
+ "name": "Test",
374
+ "model": "Discovery",
375
+ "serialNumber": "serial number of your device to be discovered",
376
+ "accessKey": "your access key",
377
+ "secretKey": "your secret key"
378
+ }
379
+ ```
380
+ - Save configuration and restart homebridge / child bridge
381
+ - Note current time and change parameter inside EcoFlow App
382
+ - Repeat previous step for all parameters which support is expected to be added to the plugin
383
+ - Attach homebridge log and description of "time - performed action in EcoFlow App" to an issue in GitHub
384
+
385
+ #### Services
386
+
387
+ No services
388
+
389
+ #### Configuration
390
+
391
+ ```json
392
+ {
393
+ ...
394
+ "devices": [
395
+ {
396
+ ...
397
+ "model": "Discovery"
398
+ }
399
+ ],
400
+ }
401
+ ```
402
+
403
+ ### Glacier
404
+
405
+ > Not Activated (no testing is performed)
406
+
407
+ #### Services
408
+
409
+ | EcoFlow Parameter | Service | Characteristic | Standard | Permission |
410
+ | ----------------------------------- | --------------------- | -------------------------- | -------- | -------------------------------------------------------------------------------------------------------- |
411
+ | Battery | Outlet | On | ✅ | Read (Battery Discharging > 0: ON) |
412
+ | Battery Discharging | Outlet | OutletInUse | ✅ | Read |
413
+ | Battery Level | Outlet | Battery Level, % | 🔲 | Read |
414
+ | Battery Charging | Outlet | Input Consumption, W | 🔲 | Read |
415
+ | Battery Discharging | Outlet | Output Consumption, W | 🔲 | Read |
416
+ | Battery Charging State | Outlet | ChargingState, Yes/No | 🔲 | Read |
417
+ | Battery Level | Outlet | StatusLowBattery, Yes/No | 🔲 | Read |
418
+ | ECO mode | Switch | On | ✅ | Read/Write |
419
+ | Door Opened | ContactSensor | ContactSensorState | ✅ | Read |
420
+ | Make ice (small cubes) | Switch | On | ✅ | Read/Write (allowed when `Detach Ice` or `Make ice (large cubes)` options are not activated) |
421
+ | Make ice (large cubes) | Switch | On | ✅ | Read/Write (allowed when `Detach Ice` or `Make ice (small cubes)` options are not activated) |
422
+ | Detach ice | Switch | On | ✅ | Read/Write (allowed when `Make ice (small cubes)` or `Make ice (large cubes)` options are not activated) |
423
+ | Dual Left Zone Current Temperature | Thermostat Dual Left | CurrentTemperature | ✅ | Read |
424
+ | Dual Left Zone Target Temperature | Thermostat Dual Left | TargetTemperature | ✅ | Read/write (allowed when zone partition is installed) |
425
+ | Device is ON/OFF | Thermostat Dual Left | CurrentHeatingCoolingState | ✅ | Read |
426
+ | Device is ON/OFF | Thermostat Dual Left | TargetHeatingCoolingState | ✅ | Read |
427
+ | Dual Right Zone Current Temperature | Thermostat Dual Right | CurrentTemperature | ✅ | Read |
428
+ | Dual Right Zone Target Temperature | Thermostat Dual Right | TargetTemperature | ✅ | Read/write (allowed when zone partition is installed) |
429
+ | Device is ON/OFF | Thermostat Dual Right | CurrentHeatingCoolingState | ✅ | Read |
430
+ | Device is ON/OFF | Thermostat Dual Right | TargetHeatingCoolingState | ✅ | Read |
431
+ | Single Zone Current Temperature | Thermostat Single | CurrentTemperature | ✅ | Read |
432
+ | Single Zone Target Temperature | Thermostat Single | TargetTemperature | ✅ | Read/write (allowed when zone partition is removed) |
433
+ | Device is ON/OFF | Thermostat Single | CurrentHeatingCoolingState | ✅ | Read |
434
+ | Device is ON/OFF | Thermostat Single | TargetHeatingCoolingState | ✅ | Read |
435
+
436
+ #### Configuration
437
+
438
+ The following additional characteristics is available:
439
+
440
+ - Battery Level, %
441
+ - Input Consumption, W
442
+ - Output Consumption, W
443
+
444
+ ```json
445
+ {
446
+ ...
447
+ "devices": [
448
+ {
449
+ ...
450
+ "model": "Glacier",
451
+ "battery": {
452
+ "additionalCharacteristics": [
453
+ "Battery Level, %",
454
+ "Input Consumption, W",
455
+ "Output Consumption, W"
456
+ ]
457
+ }
458
+ }
459
+ ],
460
+ }
461
+ ```
462
+
463
+ ### PowerOcean
464
+
465
+ > Not Activated (no testing is performed)
466
+
467
+ #### Services
468
+
469
+ | EcoFlow Parameter | Service | Characteristic | Standard | Permission |
470
+ | ---------------------- | ---------- | ------------------------ | -------- | ---------------------------------- |
471
+ | Inverter | Outlet INV | On | ✅ | Read (Inverter AC Output > 0: ON) |
472
+ | Inverter AC Output | Outlet INV | OutletInUse | ✅ | Read |
473
+ | Inverter AC Input | Outlet INV | Input Consumption, W | 🔲 | Read |
474
+ | Inverter AC Output | Outlet INV | Output Consumption, W | 🔲 | Read |
475
+ | Solar | Outlet PV | On | ✅ | Read (Solar Generation > 0: ON) |
476
+ | Solar Generation | Outlet PV | OutletInUse | ✅ | Read |
477
+ | Solar Generation | Outlet PV | Output Consumption, W | 🔲 | Read |
478
+ | Battery | Outlet BAT | On | ✅ | Read (Battery Discharging > 0: ON) |
479
+ | Battery Discharging | Outlet BAT | OutletInUse | ✅ | Read |
480
+ | Battery Level | Outlet BAT | Battery Level, % | 🔲 | Read |
481
+ | Battery Charging | Outlet BAT | Input Consumption, W | 🔲 | Read |
482
+ | Battery Discharging | Outlet BAT | Output Consumption, W | 🔲 | Read |
483
+ | Battery Charging State | Outlet BAT | ChargingState, Yes/No | 🔲 | Read |
484
+ | Battery Level | Outlet BAT | StatusLowBattery, Yes/No | 🔲 | Read |
485
+
486
+ #### Configuration
487
+
488
+ The following additional characteristics is available:
489
+
490
+ - battery:
491
+ - Battery Level, %
492
+ - Input Consumption, W
493
+ - Output Consumption, W
494
+ - Charging State
495
+ - Status Low Battery
496
+ - pv:
497
+ - Output Consumption, W
498
+ - inverter:
499
+ - Input Consumption, W
500
+ - Output Consumption, W
501
+
502
+ ```json
503
+ {
504
+ ...
505
+ "devices": [
506
+ {
507
+ ...
508
+ "model": "PowerOcean",
509
+ "powerStream": {
510
+ "batteryAdditionalCharacteristics": [
511
+ "Battery Level, %",
512
+ "Input Consumption, W",
513
+ "Output Consumption, W",
514
+ "Charging State",
515
+ "Status Low Battery"
516
+ ],
517
+ "pvAdditionalCharacteristics": [
518
+ "Output Consumption, W"
519
+ ],
520
+ "inverterAdditionalCharacteristics": [
521
+ "Input Consumption, W",
522
+ "Output Consumption, W"
523
+ ]
524
+ }
525
+ }
526
+ ],
527
+ }
528
+ ```
529
+
361
530
  ### PowerStream Micro-inverter
362
531
 
363
532
  #### Services
@@ -471,64 +640,6 @@ The following additional characteristics is available:
471
640
  }
472
641
  ```
473
642
 
474
- ### Glacier
475
-
476
- #### Services
477
-
478
- | EcoFlow Parameter | Service | Characteristic | Standard | Permission |
479
- | ----------------------------------- | --------------------- | -------------------------- | -------- | -------------------------------------------------------------------------------------------------------- |
480
- | Battery | Outlet | On | ✅ | Read (Battery Discharging > 0: ON) |
481
- | Battery Discharging | Outlet | OutletInUse | ✅ | Read |
482
- | Battery Level | Outlet | Battery Level, % | 🔲 | Read |
483
- | Battery Charging | Outlet | Input Consumption, W | 🔲 | Read |
484
- | Battery Discharging | Outlet | Output Consumption, W | 🔲 | Read |
485
- | Battery Charging State | Outlet | ChargingState, Yes/No | 🔲 | Read |
486
- | Battery Level | Outlet | StatusLowBattery, Yes/No | 🔲 | Read |
487
- | ECO mode | Switch | On | ✅ | Read/Write |
488
- | Door Opened | ContactSensor | ContactSensorState | ✅ | Read |
489
- | Make ice (small cubes) | Switch | On | ✅ | Read/Write (allowed when `Detach Ice` or `Make ice (large cubes)` options are not activated) |
490
- | Make ice (large cubes) | Switch | On | ✅ | Read/Write (allowed when `Detach Ice` or `Make ice (small cubes)` options are not activated) |
491
- | Detach ice | Switch | On | ✅ | Read/Write (allowed when `Make ice (small cubes)` or `Make ice (large cubes)` options are not activated) |
492
- | Dual Left Zone Current Temperature | Thermostat Dual Left | CurrentTemperature | ✅ | Read |
493
- | Dual Left Zone Target Temperature | Thermostat Dual Left | TargetTemperature | ✅ | Read/write (allowed when zone partition is installed) |
494
- | Device is ON/OFF | Thermostat Dual Left | CurrentHeatingCoolingState | ✅ | Read |
495
- | Device is ON/OFF | Thermostat Dual Left | TargetHeatingCoolingState | ✅ | Read |
496
- | Dual Right Zone Current Temperature | Thermostat Dual Right | CurrentTemperature | ✅ | Read |
497
- | Dual Right Zone Target Temperature | Thermostat Dual Right | TargetTemperature | ✅ | Read/write (allowed when zone partition is installed) |
498
- | Device is ON/OFF | Thermostat Dual Right | CurrentHeatingCoolingState | ✅ | Read |
499
- | Device is ON/OFF | Thermostat Dual Right | TargetHeatingCoolingState | ✅ | Read |
500
- | Single Zone Current Temperature | Thermostat Single | CurrentTemperature | ✅ | Read |
501
- | Single Zone Target Temperature | Thermostat Single | TargetTemperature | ✅ | Read/write (allowed when zone partition is removed) |
502
- | Device is ON/OFF | Thermostat Single | CurrentHeatingCoolingState | ✅ | Read |
503
- | Device is ON/OFF | Thermostat Single | TargetHeatingCoolingState | ✅ | Read |
504
-
505
- #### Configuration
506
-
507
- The following additional characteristics is available:
508
-
509
- - Battery Level, %
510
- - Input Consumption, W
511
- - Output Consumption, W
512
-
513
- ```json
514
- {
515
- ...
516
- "devices": [
517
- {
518
- ...
519
- "model": "Glacier",
520
- "battery": {
521
- "additionalCharacteristics": [
522
- "Battery Level, %",
523
- "Input Consumption, W",
524
- "Output Consumption, W"
525
- ]
526
- }
527
- }
528
- ],
529
- }
530
- ```
531
-
532
643
  ## Troubleshooting
533
644
 
534
645
  ### Debug
@@ -32,7 +32,7 @@
32
32
  "type": "string",
33
33
  "default": "Delta 2",
34
34
  "required": true,
35
- "enum": ["Delta 2", "Delta 2 Max", "Delta Pro 3", "PowerStream", "Smart Plug", "Glacier"]
35
+ "enum": ["Delta 2", "Delta 2 Max", "Delta Pro 3", "Discovery", "PowerStream", "Smart Plug"]
36
36
  },
37
37
  "serialNumber": {
38
38
  "title": "Serial Number",
@@ -148,6 +148,51 @@
148
148
  }
149
149
  }
150
150
  },
151
+ "powerOcean": {
152
+ "title": "PowerOcean Settings",
153
+ "type": "object",
154
+ "properties": {
155
+ "batteryAdditionalCharacteristics": {
156
+ "title": "Battery Additional Characteristics",
157
+ "description": "List of additional characteristics for Battery connected to PowerStream",
158
+ "type": "array",
159
+ "uniqueItems": true,
160
+ "items": {
161
+ "title": "Characteristic",
162
+ "type": "string",
163
+ "enum": [
164
+ "Battery Level, %",
165
+ "Input Consumption, W",
166
+ "Output Consumption, W",
167
+ "Charging State",
168
+ "Status Low Battery"
169
+ ]
170
+ }
171
+ },
172
+ "pvAdditionalCharacteristics": {
173
+ "title": "PV Additional Characteristics",
174
+ "description": "List of additional characteristics for PVs connected for PowerStream",
175
+ "type": "array",
176
+ "uniqueItems": true,
177
+ "items": {
178
+ "title": "Characteristic",
179
+ "type": "string",
180
+ "enum": ["Output Consumption, W"]
181
+ }
182
+ },
183
+ "inverterAdditionalCharacteristics": {
184
+ "title": "Inverter Additional Characteristics",
185
+ "description": "List of additional characteristics for PowerStream",
186
+ "type": "array",
187
+ "uniqueItems": true,
188
+ "items": {
189
+ "title": "Characteristic",
190
+ "type": "string",
191
+ "enum": ["Input Consumption, W", "Output Consumption, W"]
192
+ }
193
+ }
194
+ }
195
+ },
151
196
  "outlet": {
152
197
  "title": "Outlet Settings",
153
198
  "type": "object",
@@ -0,0 +1,10 @@
1
+ import { DiscoveryAllQuotaData } from '@ecoflow/accessories/discovery/interfaces/discoveryHttpApiContracts';
2
+ import { EcoFlowAccessoryWithQuotaBase } from '@ecoflow/accessories/ecoFlowAccessoryWithQuotaBase';
3
+ import { MqttQuotaMessage } from '@ecoflow/apis/interfaces/mqttApiContracts';
4
+ import { ServiceBase } from '@ecoflow/services/serviceBase';
5
+ export declare class DiscoveryAccessory extends EcoFlowAccessoryWithQuotaBase<DiscoveryAllQuotaData> {
6
+ protected getServices(): ServiceBase[];
7
+ protected processQuotaMessage(message: MqttQuotaMessage): void;
8
+ protected initializeQuota(quota: DiscoveryAllQuotaData | null): DiscoveryAllQuotaData;
9
+ protected updateInitialValues(initialData: DiscoveryAllQuotaData): void;
10
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DiscoveryAccessory = void 0;
4
+ const ecoFlowAccessoryWithQuotaBase_1 = require("@ecoflow/accessories/ecoFlowAccessoryWithQuotaBase");
5
+ class DiscoveryAccessory extends ecoFlowAccessoryWithQuotaBase_1.EcoFlowAccessoryWithQuotaBase {
6
+ getServices() {
7
+ return [];
8
+ }
9
+ processQuotaMessage(message) {
10
+ this.log.info(`Received quota: ${JSON.stringify(message, null, 2)}`);
11
+ }
12
+ initializeQuota(quota) {
13
+ const result = quota ?? {};
14
+ return result;
15
+ }
16
+ updateInitialValues(initialData) {
17
+ this.log.info(`Received quota (initial): ${JSON.stringify(initialData, null, 2)}`);
18
+ }
19
+ }
20
+ exports.DiscoveryAccessory = DiscoveryAccessory;
21
+ //# sourceMappingURL=discoveryAccessory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discoveryAccessory.js","sourceRoot":"","sources":["../../../src/accessories/discovery/discoveryAccessory.ts"],"names":[],"mappings":";;;AACA,sGAAmG;AAInG,MAAa,kBAAmB,SAAQ,6DAAoD;IACvE,WAAW;QAC5B,OAAO,EAAE,CAAC;IACZ,CAAC;IAEkB,mBAAmB,CAAC,OAAyB;QAC9D,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,mBAAmB,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IACvE,CAAC;IAEkB,eAAe,CAAC,KAAmC;QACpE,MAAM,MAAM,GAAG,KAAK,IAAK,EAA4B,CAAC;QACtD,OAAO,MAAM,CAAC;IAChB,CAAC;IAEkB,mBAAmB,CAAC,WAAkC;QACvE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,6BAA6B,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IACrF,CAAC;CACF;AAjBD,gDAiBC"}
@@ -0,0 +1,2 @@
1
+ export interface DiscoveryAllQuotaData {
2
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=discoveryHttpApiContracts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discoveryHttpApiContracts.js","sourceRoot":"","sources":["../../../../src/accessories/discovery/interfaces/discoveryHttpApiContracts.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import { Simulator } from '@ecoflow/apis/simulations/simulator';
2
+ export declare class DiscoverySimulator extends Simulator {
3
+ generateQuota(): object;
4
+ generateSetReply(message: string): object;
5
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DiscoverySimulator = void 0;
4
+ const simulator_1 = require("@ecoflow/apis/simulations/simulator");
5
+ class DiscoverySimulator extends simulator_1.Simulator {
6
+ generateQuota() {
7
+ return {
8
+ discover: true,
9
+ simulated: true,
10
+ };
11
+ }
12
+ generateSetReply(message) {
13
+ throw new Error(`SetReply command "${message}" is not supported for Discovery`);
14
+ }
15
+ }
16
+ exports.DiscoverySimulator = DiscoverySimulator;
17
+ //# sourceMappingURL=discoverySimulator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discoverySimulator.js","sourceRoot":"","sources":["../../../../src/accessories/discovery/simulations/discoverySimulator.ts"],"names":[],"mappings":";;;AACA,mEAAgE;AAEhE,MAAa,kBAAmB,SAAQ,qBAAS;IAC/B,aAAa;QAC3B,OAAO;YACL,QAAQ,EAAE,IAAI;YACd,SAAS,EAAE,IAAI;SACS,CAAC;IAC7B,CAAC;IAEe,gBAAgB,CAAC,OAAe;QAC9C,MAAM,IAAI,KAAK,CAAC,qBAAqB,OAAO,kCAAkC,CAAC,CAAC;IAClF,CAAC;CACF;AAXD,gDAWC"}
@@ -1,7 +1,7 @@
1
1
  import { DeviceInfo } from '@ecoflow/apis/containers/deviceInfo';
2
2
  import { EcoFlowHttpApiManager } from '@ecoflow/apis/ecoFlowHttpApiManager';
3
3
  import { EcoFlowMqttApiManager } from '@ecoflow/apis/ecoFlowMqttApiManager';
4
- import { MqttQuotaMessage, MqttSetMessage, MqttSetReplyMessage } from '@ecoflow/apis/interfaces/mqttApiContracts';
4
+ import { MqttQuotaMessage, MqttSetMessage, MqttSetReplyMessage, MqttStatusMessage } from '@ecoflow/apis/interfaces/mqttApiContracts';
5
5
  import { DeviceConfig } from '@ecoflow/config';
6
6
  import { EcoFlowHomebridgePlatform } from '@ecoflow/platform';
7
7
  import { ServiceBase } from '@ecoflow/services/serviceBase';
@@ -22,6 +22,7 @@ export declare abstract class EcoFlowAccessoryBase {
22
22
  readonly setReplies: Record<string, {
23
23
  requestMessage: MqttSetMessage;
24
24
  revert: () => void;
25
+ timeoutId: NodeJS.Timeout;
25
26
  }>;
26
27
  constructor(platform: EcoFlowHomebridgePlatform, accessory: PlatformAccessory, config: DeviceConfig, log: Logging, httpApiManager: EcoFlowHttpApiManager, mqttApiManager: EcoFlowMqttApiManager);
27
28
  get services(): ServiceBase[];
@@ -33,9 +34,11 @@ export declare abstract class EcoFlowAccessoryBase {
33
34
  protected abstract getServices(): ServiceBase[];
34
35
  protected subscribeOnParameterUpdates(): Subscription[];
35
36
  protected abstract processQuotaMessage(message: MqttQuotaMessage): void;
37
+ protected processStatusMessage(message: MqttStatusMessage): void;
36
38
  protected processSetReplyMessage(message: MqttSetReplyMessage): void;
37
39
  private getMqttSetMessageKey;
38
40
  private initializeServices;
39
41
  private connectMqtt;
40
42
  private initMqtt;
43
+ private setStatus;
41
44
  }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.EcoFlowAccessoryBase = void 0;
4
4
  const deviceInfo_1 = require("@ecoflow/apis/containers/deviceInfo");
5
+ const characteristicContracts_1 = require("@ecoflow/characteristics/characteristicContracts");
5
6
  const accessoryInformationService_1 = require("@ecoflow/services/accessoryInformationService");
6
7
  class EcoFlowAccessoryBase {
7
8
  platform;
@@ -57,16 +58,34 @@ class EcoFlowAccessoryBase {
57
58
  async sendSetCommand(message, revert) {
58
59
  message.id = Math.floor(Math.random() * 1000000);
59
60
  message.version = '1.0';
60
- this.setReplies[this.getMqttSetMessageKey(message)] = { requestMessage: message, revert };
61
+ const messageKey = this.getMqttSetMessageKey(message);
62
+ const timeoutId = setTimeout(() => {
63
+ const command = this.setReplies[messageKey];
64
+ if (!command) {
65
+ this.log.debug('Timed out message is already processed. Ignore it:', message.id);
66
+ }
67
+ else {
68
+ this.log.warn('Sending of command is timed out. Reverts value back for:', message.id);
69
+ revert();
70
+ this.setStatus(false);
71
+ delete this.setReplies[messageKey];
72
+ }
73
+ }, this.config.setReplyWaitResponseTimeoutMs ?? 3000);
74
+ this.setReplies[messageKey] = { requestMessage: message, revert, timeoutId };
61
75
  await this.mqttApiManager.sendSetCommand(this.deviceInfo, message);
62
76
  }
63
77
  subscribeOnParameterUpdates() {
64
78
  const subscriptions = [
65
79
  this.mqttApiManager.subscribeOnQuotaMessage(this.deviceInfo, this.processQuotaMessage.bind(this)),
66
80
  this.mqttApiManager.subscribeOnSetReplyMessage(this.deviceInfo, this.processSetReplyMessage.bind(this)),
81
+ this.mqttApiManager.subscribeOnStatusMessage(this.deviceInfo, this.processStatusMessage.bind(this)),
67
82
  ];
68
83
  return subscriptions.filter(subscription => !!subscription);
69
84
  }
85
+ processStatusMessage(message) {
86
+ const online = message.params.status === characteristicContracts_1.EnableType.On;
87
+ this.setStatus(online);
88
+ }
70
89
  processSetReplyMessage(message) {
71
90
  const messageKey = this.getMqttSetMessageKey(message);
72
91
  const command = this.setReplies[messageKey];
@@ -74,6 +93,7 @@ class EcoFlowAccessoryBase {
74
93
  this.log.debug('Received "SetReply" response was not sent by accessory. Ignore it:', message);
75
94
  return;
76
95
  }
96
+ clearTimeout(command.timeoutId);
77
97
  this.log.debug('Received "SetReply" response:', message);
78
98
  delete this.setReplies[messageKey];
79
99
  // Detect whether response is successfull for different contracts (e.g. data.ack, data.result, data.configOk)
@@ -108,11 +128,16 @@ class EcoFlowAccessoryBase {
108
128
  async initMqtt() {
109
129
  this.isMqttConnected =
110
130
  (await this.mqttApiManager.subscribeOnQuotaTopic(this.deviceInfo)) &&
111
- (await this.mqttApiManager.subscribeOnSetReplyTopic(this.deviceInfo));
131
+ (await this.mqttApiManager.subscribeOnSetReplyTopic(this.deviceInfo)) &&
132
+ (await this.mqttApiManager.subscribeOnStatusTopic(this.deviceInfo));
112
133
  if (this.isMqttConnected) {
113
134
  this.subscriptions = this.subscribeOnParameterUpdates();
114
135
  }
115
136
  }
137
+ setStatus(online) {
138
+ this.log.warn(`Device is ${online ? 'online' : 'offline'}`);
139
+ this.services.forEach(service => service.updateReachability(online));
140
+ }
116
141
  }
117
142
  exports.EcoFlowAccessoryBase = EcoFlowAccessoryBase;
118
143
  //# sourceMappingURL=ecoFlowAccessoryBase.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ecoFlowAccessoryBase.js","sourceRoot":"","sources":["../../src/accessories/ecoFlowAccessoryBase.ts"],"names":[],"mappings":";;;AAAA,oEAAiE;AAMjE,+FAA4F;AAK5F,MAAsB,oBAAoB;IAStB;IACA;IACA;IACA;IACG;IACA;IAbb,SAAS,GAAkB,EAAE,CAAC;IAC9B,sBAAsB,GAA0B,IAAI,CAAC;IACrD,eAAe,GAAY,KAAK,CAAC;IACjC,aAAa,GAAmB,EAAE,CAAC;IACxB,UAAU,CAAa;IAC1B,UAAU,GAA2E,EAAE,CAAC;IAExG,YACkB,QAAmC,EACnC,SAA4B,EAC5B,MAA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SAAS,CAAC,MAAe;QAC/B,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC;QAC5D,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC;IACvE,CAAC;CACF;AA5JD,oDA4JC"}
@@ -0,0 +1,7 @@
1
+ export interface PowerOceanAllQuotaData {
2
+ evPwr?: number;
3
+ bpPwr?: number;
4
+ bpSoc?: number;
5
+ sysLoadPwr?: number;
6
+ sysGridPwr?: number;
7
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=powerOceanHttpApiContracts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"powerOceanHttpApiContracts.js","sourceRoot":"","sources":["../../../../src/accessories/powerocean/interfaces/powerOceanHttpApiContracts.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import { MqttQuotaMessage, MqttQuotaMessageWithParams } from '@ecoflow/apis/interfaces/mqttApiContracts';
2
+ export interface PowerOceanMqttQuotaMessage extends MqttQuotaMessage {
3
+ }
4
+ export interface PowerOceanMqttQuotaMessageWithParams<TParams> extends MqttQuotaMessageWithParams<TParams>, PowerOceanMqttQuotaMessage {
5
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=powerOceanMqttApiContracts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"powerOceanMqttApiContracts.js","sourceRoot":"","sources":["../../../../src/accessories/powerocean/interfaces/powerOceanMqttApiContracts.ts"],"names":[],"mappings":""}
@@ -0,0 +1,24 @@
1
+ import { EcoFlowAccessoryWithQuotaBase } from '@ecoflow/accessories/ecoFlowAccessoryWithQuotaBase';
2
+ import { PowerOceanAllQuotaData } from '@ecoflow/accessories/powerocean/interfaces/powerOceanHttpApiContracts';
3
+ import { EcoFlowHttpApiManager } from '@ecoflow/apis/ecoFlowHttpApiManager';
4
+ import { EcoFlowMqttApiManager } from '@ecoflow/apis/ecoFlowMqttApiManager';
5
+ import { MqttQuotaMessage } from '@ecoflow/apis/interfaces/mqttApiContracts';
6
+ import { DeviceConfig } from '@ecoflow/config';
7
+ import { BatteryStatusProvider } from '@ecoflow/helpers/batteryStatusProvider';
8
+ import { EcoFlowHomebridgePlatform } from '@ecoflow/platform';
9
+ import { ServiceBase } from '@ecoflow/services/serviceBase';
10
+ import { Logging, PlatformAccessory } from 'homebridge';
11
+ export declare class PowerOceanAccessory extends EcoFlowAccessoryWithQuotaBase<PowerOceanAllQuotaData> {
12
+ private readonly inverterOutletService;
13
+ private readonly solarOutletService;
14
+ private readonly batteryOutletService;
15
+ constructor(platform: EcoFlowHomebridgePlatform, accessory: PlatformAccessory, config: DeviceConfig, log: Logging, httpApiManager: EcoFlowHttpApiManager, mqttApiManager: EcoFlowMqttApiManager, batteryStatusProvider: BatteryStatusProvider);
16
+ protected getServices(): ServiceBase[];
17
+ protected processQuotaMessage(message: MqttQuotaMessage): void;
18
+ protected initializeQuota(quota: PowerOceanAllQuotaData | null): PowerOceanAllQuotaData;
19
+ protected updateInitialValues(initialData: PowerOceanAllQuotaData): void;
20
+ private updateValues;
21
+ private updateSolarValues;
22
+ private updateBatteryValues;
23
+ private updateInverterValues;
24
+ }