homebridge-solaxcloud-api 2.3.3 → 2.4.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 (44) hide show
  1. package/CHANGELOG.md +140 -131
  2. package/LICENSE +175 -175
  3. package/config.sample +15 -15
  4. package/config.schema.json +105 -105
  5. package/dist/batteryAccessory.d.ts +70 -70
  6. package/dist/batteryAccessory.d.ts.map +1 -1
  7. package/dist/batteryAccessory.js +124 -123
  8. package/dist/batteryAccessory.js.map +1 -1
  9. package/dist/index.d.ts +6 -6
  10. package/dist/index.js +6 -6
  11. package/dist/lightSensorAccessory.d.ts +34 -34
  12. package/dist/lightSensorAccessory.js +58 -58
  13. package/dist/motionAccessory.d.ts +53 -53
  14. package/dist/motionAccessory.js +93 -93
  15. package/dist/outletAccessory.d.ts +100 -100
  16. package/dist/outletAccessory.js +187 -187
  17. package/dist/platform.d.ts +62 -56
  18. package/dist/platform.d.ts.map +1 -1
  19. package/dist/platform.js +294 -265
  20. package/dist/platform.js.map +1 -1
  21. package/dist/platformAccessory.d.ts +70 -70
  22. package/dist/platformAccessory.js +102 -102
  23. package/dist/platformInverter.d.ts +180 -176
  24. package/dist/platformInverter.d.ts.map +1 -1
  25. package/dist/platformInverter.js +348 -343
  26. package/dist/platformInverter.js.map +1 -1
  27. package/dist/platformMeters.d.ts +68 -68
  28. package/dist/platformMeters.js +2 -2
  29. package/dist/settings.d.ts +8 -8
  30. package/dist/settings.js +11 -11
  31. package/dist/solaxcloudfetch.d.ts +1 -1
  32. package/dist/solaxcloudfetch.js +21 -21
  33. package/dist/solaxcloudfetch.js.map +1 -1
  34. package/dist/statistics.d.ts +36 -36
  35. package/dist/statistics.js +88 -88
  36. package/dist/util.d.ts +23 -23
  37. package/dist/util.js +42 -42
  38. package/package.json +55 -54
  39. package/config.json +0 -16
  40. package/dist/solaxcloudapi.d.ts +0 -163
  41. package/dist/solaxcloudapi.d.ts.map +0 -1
  42. package/dist/solaxcloudapi.js +0 -226
  43. package/dist/solaxcloudapi.js.map +0 -1
  44. package/test/solaxcloudapi.test.ts +0 -164
@@ -1,177 +1,181 @@
1
- import { AccessoryPlugin, API, Logging, PlatformConfig } from 'homebridge';
2
- /**
3
- * Inverter brand.
4
- */
5
- export declare const INVERTER_BRAND: {
6
- SOLAX: number;
7
- QCELLS: number;
8
- };
9
- /**
10
- * Standard names for accessories.
11
- */
12
- export declare const ACCESSORY_KEYS: {
13
- pv: string;
14
- inverterToBattery: string;
15
- inverterFromBattery: string;
16
- inverterAC: string;
17
- inverterToGrid: string;
18
- inverterToHouse: string;
19
- gridToHouse: string;
20
- };
21
- /**
22
- * SolaxCloudAPIPlatformInverter.
23
- * This class is the main constructor for your inverter accessories
24
- * to be used by Homebridge.
25
- */
26
- export declare class SolaxCloudAPIPlatformInverter {
27
- private readonly log;
28
- private readonly config;
29
- private readonly api;
30
- /**
31
- * Inverter brand.
32
- */
33
- private brand;
34
- /**
35
- * Inverter name.
36
- */
37
- private name;
38
- /**
39
- * Inverter serial number.
40
- **/
41
- private sn;
42
- /**
43
- * Whether this inverter has a battery.
44
- **/
45
- private batteryInstalled;
46
- /**
47
- * Size of window for statistical smoothing operations.
48
- */
49
- private smoothingWindow;
50
- /**
51
- * API for retrieving data from Solax cloud.
52
- */
53
- private solaxCloudAPI;
54
- /**
55
- * Virtual motion sensor triggered by data updates from Solax Cloud.
56
- */
57
- private motionUpdate;
58
- /**
59
- * Battery information for this inverter gathered from Solax Cloud.
60
- */
61
- private battery;
62
- /**
63
- * Outlets with raw data gathered from Solax Cloud.
64
- */
65
- private rawOutlets;
66
- /**
67
- * Smooth data outlets.
68
- * These outlets present smoothed values based on the raw data figures to
69
- * prevent events like the temporary passage of a cloud to directly affect values.
70
- */
71
- private smoothOutlets;
72
- /**
73
- * Ambient light sensors for Power Consumption (pure Home App config).
74
- */
75
- private rawLightSensors;
76
- /**
77
- * Ambient light sensors for smooth power consumption lights.
78
- * These lights present smoothed values based on the raw data figures to
79
- * prevent events like the temporary passage of a cloud to directly affect values.
80
- */
81
- private smoothLightSensors;
82
- /** Array with all accessories */
83
- private solaxAccessories;
84
- /**
85
- * Platform inverter constructor.
86
- * @param log
87
- * @param config
88
- * @param api
89
- * @param brand
90
- * @param tokenId
91
- * @param sn
92
- * @param name
93
- * @param hasBattery
94
- * @param smoothingWindow
95
- * @returns
96
- */
97
- constructor(log: Logging, config: PlatformConfig, api: API, brand: number, tokenId: string, sn: string, name: string, hasBattery: boolean, smoothingWindow: number);
98
- /**
99
- * Gets the inverter brand name.
100
- * @param {number} brand Inverter brand type.
101
- * @returns Inverter brand name.
102
- */
103
- static getInverterBrandName(brand: number): string;
104
- /**
105
- * Update all platform accessory status based on the values read from the API.
106
- * @param {SolaxCloudAPIResponse} apiData API data from Solax Cloud.
107
- */
108
- private updateAccessories;
109
- /**
110
- * Sets the battery charge state for this inverter.
111
- * @param {number} state The desired battery charge state.
112
- */
113
- setBatteryChargeState(state: number): void;
114
- /**
115
- * Gets the battery charge state for this inverter.
116
- * @returns {number} Battery charge state.
117
- */
118
- getBatteryChargeState(): number;
119
- /**
120
- * Sets the current battery level for this inverter.
121
- * @param {number} percentage Battery level to set (percentage).
122
- */
123
- setBatteryLevel(percentage: number): void;
124
- /**
125
- * Gets the current battery level for this inverter.
126
- * @returns {number} The current battery level (percentage).
127
- */
128
- getBatteryLevel(): number;
129
- /**
130
- * Sets virtual update motion detector to true to notify of new data update.
131
- */
132
- setMotionUpdate(): void;
133
- /**
134
- * Gets raw accessory power for this inverter.
135
- * @param {string} key Accessory key.
136
- * @returns {number} Power consumptions for this accessory.
137
- */
138
- getRawPower(key: string): number;
139
- /**
140
- * Sets raw accessory power for this inverter.
141
- * @param {string} key Accessory key.
142
- * @param {number} power Power to set (in Watt).
143
- */
144
- setRawPower(key: string, power: number): void;
145
- /**
146
- * Gets raw accessory energy for this inverter.
147
- * @param {string} key Accessory key.
148
- * @returns {number} The energy consumption for the desired acessory (in Wh).
149
- */
150
- getRawEnergy(key: string): number;
151
- /**
152
- * Sets raw accessory energy for this inverter.
153
- * @param {string} key Accessory key.
154
- * @param {number} energy Energy consumption to set (in Wh).
155
- */
156
- setRawEnergy(key: string, energy: number): void;
157
- /**
158
- * Sets smooth accessory power from raw accessory power for this inverter.
159
- * @param {string} key Accessory key.
160
- */
161
- setSmoothPower(key: string): void;
162
- /**
163
- * Update data from this inverter by using the Solax Cloud API
164
- */
165
- updateInverterDataFromCloud(): void;
166
- /**
167
- * Returns whether this inverter has a battery installed.
168
- * @returns {boolean} Whether this inverter battery has a battery installed.
169
- */
170
- hasBattery(): boolean;
171
- /**
172
- * Get array with full list of accessories for this inverter.
173
- * @returns {AccessoryPlugin[]} Array of accessories for this inverter.
174
- */
175
- getAccessories(): AccessoryPlugin[];
176
- }
1
+ import { AccessoryPlugin, API, Logging, PlatformConfig } from 'homebridge';
2
+ /**
3
+ * Inverter brand.
4
+ */
5
+ export declare const INVERTER_BRAND: {
6
+ SOLAX: number;
7
+ QCELLS: number;
8
+ };
9
+ /**
10
+ * Standard names for accessories.
11
+ */
12
+ export declare const ACCESSORY_KEYS: {
13
+ pv: string;
14
+ inverterToBattery: string;
15
+ inverterFromBattery: string;
16
+ inverterAC: string;
17
+ inverterToGrid: string;
18
+ inverterToHouse: string;
19
+ gridToHouse: string;
20
+ };
21
+ /**
22
+ * SolaxCloudAPIPlatformInverter.
23
+ * This class is the main constructor for your inverter accessories
24
+ * to be used by Homebridge.
25
+ */
26
+ export declare class SolaxCloudAPIPlatformInverter {
27
+ private readonly log;
28
+ private readonly config;
29
+ private readonly api;
30
+ /**
31
+ * Inverter name.
32
+ */
33
+ private name;
34
+ /**
35
+ * Inverter serial number.
36
+ **/
37
+ private sn;
38
+ /**
39
+ * Whether this inverter has a battery.
40
+ **/
41
+ private batteryInstalled;
42
+ /**
43
+ * Size of window for statistical smoothing operations.
44
+ */
45
+ private smoothingWindow;
46
+ /**
47
+ * API for retrieving data from Solax cloud.
48
+ */
49
+ private solaxCloudAPI?;
50
+ /**
51
+ * Inverter brand name.
52
+ */
53
+ private brandName;
54
+ /**
55
+ * Whether this inverter is a virtual accessory.
56
+ */
57
+ private virtual;
58
+ /**
59
+ * Virtual motion sensor triggered by data updates from Solax Cloud.
60
+ */
61
+ private motionUpdate;
62
+ /**
63
+ * Battery information for this inverter gathered from Solax Cloud.
64
+ */
65
+ private battery;
66
+ /**
67
+ * Outlets with raw data gathered from Solax Cloud.
68
+ */
69
+ private rawOutlets;
70
+ /**
71
+ * Smooth data outlets.
72
+ * These outlets present smoothed values based on the raw data figures to
73
+ * prevent events like the temporary passage of a cloud to directly affect values.
74
+ */
75
+ private smoothOutlets;
76
+ /**
77
+ * Ambient light sensors for Power Consumption (pure Home App config).
78
+ */
79
+ private rawLightSensors;
80
+ /**
81
+ * Ambient light sensors for smooth power consumption lights.
82
+ * These lights present smoothed values based on the raw data figures to
83
+ * prevent events like the temporary passage of a cloud to directly affect values.
84
+ */
85
+ private smoothLightSensors;
86
+ /** Array with all accessories */
87
+ private solaxAccessories;
88
+ /**
89
+ * Platform inverter constructor.
90
+ * @param log
91
+ * @param config
92
+ * @param api
93
+ * @param brand
94
+ * @param tokenId
95
+ * @param sn
96
+ * @param name
97
+ * @param hasBattery
98
+ * @param smoothingWindow
99
+ * @returns
100
+ */
101
+ constructor(log: Logging, config: PlatformConfig, api: API, brand: number, tokenId: string, sn: string, name: string, hasBattery: boolean, smoothingWindow: number, virtual?: boolean, brandName?: string);
102
+ /**
103
+ * Gets the inverter brand name.
104
+ * @param {number} brand Inverter brand type.
105
+ * @returns Inverter brand name.
106
+ */
107
+ static getInverterBrandName(brand: number): string;
108
+ /**
109
+ * Update all platform accessory status based on the values read from the API.
110
+ * @param {SolaxCloudAPIResponse} apiData API data from Solax Cloud.
111
+ */
112
+ private updateAccessories;
113
+ /**
114
+ * Sets the battery charge state for this inverter.
115
+ * @param {number} state The desired battery charge state.
116
+ */
117
+ setBatteryChargeState(state: number): void;
118
+ /**
119
+ * Gets the battery charge state for this inverter.
120
+ * @returns {number} Battery charge state.
121
+ */
122
+ getBatteryChargeState(): number;
123
+ /**
124
+ * Sets the current battery level for this inverter.
125
+ * @param {number} percentage Battery level to set (percentage).
126
+ */
127
+ setBatteryLevel(percentage: number): void;
128
+ /**
129
+ * Gets the current battery level for this inverter.
130
+ * @returns {number} The current battery level (percentage).
131
+ */
132
+ getBatteryLevel(): number;
133
+ /**
134
+ * Sets virtual update motion detector to true to notify of new data update.
135
+ */
136
+ setMotionUpdate(): void;
137
+ /**
138
+ * Gets raw accessory power for this inverter.
139
+ * @param {string} key Accessory key.
140
+ * @returns {number} Power consumptions for this accessory.
141
+ */
142
+ getRawPower(key: string): number;
143
+ /**
144
+ * Sets raw accessory power for this inverter.
145
+ * @param {string} key Accessory key.
146
+ * @param {number} power Power to set (in Watt).
147
+ */
148
+ setRawPower(key: string, power: number): void;
149
+ /**
150
+ * Gets raw accessory energy for this inverter.
151
+ * @param {string} key Accessory key.
152
+ * @returns {number} The energy consumption for the desired acessory (in Wh).
153
+ */
154
+ getRawEnergy(key: string): number;
155
+ /**
156
+ * Sets raw accessory energy for this inverter.
157
+ * @param {string} key Accessory key.
158
+ * @param {number} energy Energy consumption to set (in Wh).
159
+ */
160
+ setRawEnergy(key: string, energy: number): void;
161
+ /**
162
+ * Sets smooth accessory power from raw accessory power for this inverter.
163
+ * @param {string} key Accessory key.
164
+ */
165
+ setSmoothPower(key: string): void;
166
+ /**
167
+ * Update data from this inverter by using the Solax Cloud API
168
+ */
169
+ updateInverterDataFromCloud(): void;
170
+ /**
171
+ * Returns whether this inverter has a battery installed.
172
+ * @returns {boolean} Whether this inverter battery has a battery installed.
173
+ */
174
+ hasBattery(): boolean;
175
+ /**
176
+ * Get array with full list of accessories for this inverter.
177
+ * @returns {AccessoryPlugin[]} Array of accessories for this inverter.
178
+ */
179
+ getAccessories(): AccessoryPlugin[];
180
+ }
177
181
  //# sourceMappingURL=platformInverter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"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