homebridge-solaxcloud-api 2.1.2 → 2.1.5

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 ADDED
@@ -0,0 +1,77 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## [v2.1.5] - 2022-04-07
6
+ ### Changed
7
+ * New inverter accessory **Battery** for State of Charge (SoC) information.
8
+ * Support for battery charge level, charge state and low battery handler (<10%).
9
+
10
+
11
+ ## [v2.1.4] - 2022-04-06
12
+ ### Changed
13
+ * Added "All inverters" virtual inverter for totalizing inverter figures for all sensors.
14
+ * Preliminary battery support with **From Battery** and **To Battery** charge power ([#02]).
15
+
16
+ ## [v2.1.2] - 2022-03-31
17
+ ### Fixed
18
+ * Bumped dependencies to latest versions.
19
+ ### Changed
20
+ * Initial support for multiple inverters.
21
+
22
+ ## [v2.0.3] - 2022-01-25
23
+ ### Fixed
24
+ * Fixed dependabot detected vulnerabilities.
25
+
26
+ ## [v2.0.2] - 2022-01-24
27
+ ### Changed
28
+ * Added support for "pure" Home app accessories (power consumption displayed as Ambient Light Sensors) ([#01]).
29
+ * Created option accessories to display smooth value from raw API data (minimizing sporadic events like a cloud passing).
30
+
31
+ ## [v1.5.1] - 2022-01-08
32
+ ### Fixed
33
+ * Disabled repeat last data for history (connection problems may lead to strange values).
34
+
35
+ ## [v1.5.0] - 2021-12-31
36
+ ### Changed
37
+ * Homebridge certified!
38
+
39
+ ## [v1.4.6] - 2021-12-28
40
+ ### Fixed
41
+ * Added extended parameter check (including Solax Cloud limits).
42
+
43
+ ## [v1.4.5] - 2021-12-27
44
+ ### Fixed
45
+ * Sanity checks for mandatory config parameters.
46
+
47
+ ## [v1.4.4] - 2021-12-22
48
+ ### Fixed
49
+ * Automation example added to documentation.
50
+
51
+ ## [v1.4.3] - 2021-12-21
52
+ ### Fixed
53
+ * Code cleanup and optimizations.
54
+
55
+ ## [v1.4.1] - 2021-12-21
56
+ ### Fixed
57
+ * First working version with fakegato-history for Eve.
58
+
59
+ ## [v1.4.0] - 2021-12-20
60
+ ### Changed
61
+ * Initial fakegato-history release for Eve.
62
+
63
+ ## [v1.3.1] - 2021-12-14
64
+ ### Fixed
65
+ * Documentation updated to reflect new **Total Energy** characteristic on Inverter AC.
66
+
67
+ ## [v1.3.0] - 2021-12-14
68
+ ### Changed
69
+ * Added support for total energy consumption.
70
+
71
+ ## [v1.2.1] - 2021-12-14
72
+ ### Fixed
73
+ * Updates to the official documentation.
74
+
75
+ ## [v1.2.0] - 2021-12-13
76
+ ### Changed
77
+ * First official release.
package/README.md CHANGED
@@ -1,187 +1,193 @@
1
-
2
- <table cellspacing="0" cellpadding="0">
3
- <tr>
4
- <td align="center"><img src="https://github.com/homebridge/branding/raw/master/logos/homebridge-wordmark-logo-vertical.png" width="150"></td>
5
- <td align="center"><img src="https://www.solaxpower.com/wp-content/uploads/2020/03/weblogo5.png" width="300"></td>
6
- <tr>
7
- </table>
8
-
9
- # Solax Cloud Plugin for Homebridge
10
-
11
- ![npm](https://badgen.net/npm/v/homebridge-solaxcloud-api) ![npm](https://badgen.net/npm/dt/homebridge-solaxcloud-api) [![verified-by-homebridge](https://badgen.net/badge/homebridge/verified/purple)](https://github.com/homebridge/homebridge/wiki/Verified-Plugins)
12
-
13
-
14
- The Solax Cloud Plugin for [Homebridge](https://homebridge.io/) was created as a platform plugin to gather data exposed by Solax inverters to the cloud through the [Solax Cloud API](https://www.eu.solaxcloud.com/phoebus/resource/files/userGuide/Solax_API_for_End-user_V1.0.pdf).
15
-
16
- Now with **support for multiple inverters**!
17
-
18
- As HomeKit is still clueless about what a solar panel is, this plugin exposes a set of standard HomeKit accessories though Homebridge for each configured inverter that will allow interacting and automating your smart home based on the data made available from the Solax platform:
19
-
20
- - **PV** (PV outlet with power consumption)
21
- - **AC** (Inverter AC outlet with power and total energy consumptions)
22
- - **To Grid** (Inverter to Grid outlet with power consumption)
23
- - **To House** (Inverter to House outlet with power consumption)
24
- - **From Grid** (Grid to House outlet with power consumption)
25
- - **Update** (Motion sensor)
26
-
27
- <img src="images/plugin-accessories-home.png" width="50%" height="50%">
28
-
29
- Please note that additional accessories are created by default with smooth power consumption curves (by applying either a simple or exponential moving average to the power series). This prevents sporadic events like a cloud passing by to have an immediate affect on provided meters.
30
-
31
- ## Required information
32
-
33
- For this plugin to work, two critical pieces of information are required from Solax Cloud:
34
-
35
- - **Token ID**: Solax users can get inverter information through the granted tokenID. You need to obtain your tokenID on the API page of Solaxcloud.
36
- - **SN**: Registration No (communication module SN) for each desired inverter.
37
-
38
- ## Installation
39
-
40
- This plugin is supported under Homebridge. It is highly recommended that you use Homebridge Config UI X to install and configure this plugin.
41
-
42
- ### Manual Installation
43
-
44
- Install this plugin using: `sudo npm install -g homebridge-solaxcloud-api`.
45
- Edit `config.json` manually to add your Solax inverters. See below for instructions on that.
46
-
47
- ## Platform configuration
48
-
49
- Minimal platform configuration is depicted by the example configuration file below:
50
-
51
- ```json
52
- {
53
- "platforms": [
54
- {
55
- "platform": "SolaxCloudAPI",
56
- "tokenId": "20200722185111234567890",
57
- "inverters": [
58
- {
59
- "name": "Solax",
60
- "sn": "ABCDEFGHIJ"
61
- }
62
- ],
63
- }
64
- ]
65
- }
66
- ```
67
- Configuration parameters are described on the table below:
68
-
69
- | **Parameter** | **Type** | **Description** | **Default** | **Mandatory?** |
70
- | ------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------- | -------------:| :------------: |
71
- | `platform` | string | Platform name (must be SolaxCloudAPI) | - | Y |
72
- | `tokenId` | string | Users get information from Solax Cloud through the granted tokenID. Please obtain your tokenID on the API page of Solax Cloud | - | Y |
73
- | `inverters` | array | Array of configured inverters as objects with `{ name: string, sn: string }`, where `name` is the inverter name, used as prefix for accessory naming and `sn` is the inverter registration no. (inverter module SN). | - | Y |
74
- | `pollingFrequency` | number | Plugin data polling frequency from Solax Cloud (in seconds) | 300 | N |
75
- | `smoothingMeters` | boolean | Whether to create additional meters by smoothing raw values from Solax Cloud | true | N |
76
- | `smoothingMethod` | string | Statistical method to use for smoothing raw values from Solax Cloud (simple or exponential moving average - "sma" or "ema") | "sma" | N |
77
- | `pureHomeApp` | boolean | Whether to create meters as standard accessories that can be used on the Home App (power will show as ambient light sensors) | false | N |
78
-
79
- **NOTE:** The `pollingFrequency` parameter defaults to 300 seconds, since Solax inverters update cloud data every 5 minutes.
80
-
81
- Configuration through the the use of [Homebridge UI](https://github.com/oznu/homebridge-config-ui-x) plugin is also available and recommended:
82
-
83
- <img src="images/homebridge-ui.png" width="100%" height="100%">
84
-
85
- ## Non-standard characteristics
86
-
87
- Non-standard accessory characteristics are available through the use of [Eve for HomeKit app](https://apps.apple.com/us/app/eve-for-homekit/id917695792) you may download from the App Store.
88
-
89
- This will allow some non-standard characteristics to be visible along with its historical data (like power or total energy consumption), as depicted in the image below:
90
-
91
- <img src="images/plugin-outlet-consumption.png" width="50%" height="50%">
92
-
93
- If you want to rely solely on the native Home App, please enable the `pureHomeApp` config setting. In this case, power consumption on each meter will be exposed as an Ambient Light Sensor, as shown below (minimum value for an Ambient Light Sensor is 0.1 lux):
94
-
95
- <img src="images/plugin-accessories-home-pure.png" width="50%" height="50%">
96
-
97
- # Automation
98
-
99
- Automation can be achieved with the help of the virtual **Update** motion sensor that was specifically tailored for this effect and which is available for each inverter. This motion sensor will be triggered whenever inverter data gets updated from the Solax Cloud API (according to what is defined on the `pollingFrequency` configuration setting).
100
-
101
- <img src="images/plugin-accessories-eve.png" width="50%" height="50%">
102
-
103
- Motion is detected by the **Update** motion sensor whenever there is newly fetched inverter data from Solax Cloud. Using this sensor as a trigger combined with power and energy data from the virtual outlets enumerated above forms the basic building blocks for defining an automation.
104
-
105
- ## Automation example
106
-
107
- Since automations are probably going to be dependent on the non-standard **Consumption** characteristics from the virtual outlets, these must created by using the Eve App.
108
-
109
- As an automation example, let's imagine we want to turn a pool heater pump on whenever the inverter AC power is greater than a specific figure (in Watt):
110
-
111
- <table cellspacing="0" cellpadding="0">
112
- <tr>
113
- <td width="50%">1. Under Automation, select <b>Rules</b></td>
114
- <td width="50%">2. Click <b>Next</b></td>
115
- </tr>
116
- <tr>
117
- <td><img src="images/automation/automation_1.png"></td>
118
- <td><img src="images/automation/automation_2.png"></td>
119
- </tr>
120
- <tr>
121
- <td>3. Click <b>Add Trigger</b></td>
122
- <td>4. Select <b>Motion</b> as trigger type</td>
123
- </tr>
124
- <tr>
125
- <td><img src="images/automation/automation_3.png"></td>
126
- <td><img src="images/automation/automation_4.png"></td>
127
- </tr>
128
- <tr>
129
- <td>5. Select the Solax <b>Update</b> motion detector and set <b>Motion</b> as trigger</td>
130
- <td>6. Click <b>Next</b></td>
131
- </tr>
132
- <tr>
133
- <td><img src="images/automation/automation_5.png"></td>
134
- <td><img src="images/automation/automation_6.png"></td>
135
- </tr>
136
- <tr>
137
- <td>7. Select <b>Add Value Condition</b></td>
138
- <td>8. Choose <b>Inverter AC Consumption</b> as characteristic and elect <b>&gt=</b> a desired value</b></td>
139
- </tr>
140
- <tr>
141
- <td><img src="images/automation/automation_7.png"></td>
142
- <td><img src="images/automation/automation_8.png"></td>
143
- </tr>
144
- <tr>
145
- <td>9. Click <b>Next</b></td>
146
- <td>10. If no scene exists, click <b>Add Scene</b></td>
147
- </tr>
148
- <tr>
149
- <td><img src="images/automation/automation_9.png"></td>
150
- <td><img src="images/automation/automation_10.png"></td>
151
- </tr>
152
- <tr>
153
- <td>11. Click <b>Add Actions</b></td>
154
- <td>12. Select the accessory to be controlled (in this case <b>Garden Pool Outlet</b> will be turned <b>ON</b>)</td>
155
- </tr>
156
- <tr>
157
- <td><img src="images/automation/automation_11.png"></td>
158
- <td><img src="images/automation/automation_12.png"></td>
159
- </tr>
160
- <tr>
161
- <td>13. Click <b>Next</b></td>
162
- <td>14. Name your scene and click <b>Done</b></td>
163
- </tr>
164
- <tr>
165
- <td><img src="images/automation/automation_13.png"></td>
166
- <td><img src="images/automation/automation_14.png"></td>
167
- </tr>
168
- <tr>
169
- <td>15. Click <b>Next</b></td>
170
- <td>16. Name your rule and click <b>Done</b></td>
171
- </tr>
172
- <tr>
173
- <td><img src="images/automation/automation_15.png"></td>
174
- <td><img src="images/automation/automation_16.png"></td>
175
- </tr>
176
- </table>
177
-
178
- # TO DO
179
-
180
- Next planned plugin releases should include:
181
-
182
- - [X] **Inverter AC** to include Yield Energy
183
- - [X] Consumption history through the [fakegato-history](https://github.com/simont77/fakegato-history) module
184
- - [x] Enable support for "pure" Home App accessories (power meters will be exposed as Ambient Light sensors)
185
- - [x] Add "smooth" accessories for power meters (compensating for sporadic scenarios like cloud a passing)
186
- - [x] Support for multiple inverters
187
- - [ ] Accessories for battery state and consumptions (work in progress)
1
+
2
+ <table cellspacing="0" cellpadding="0">
3
+ <tr>
4
+ <td align="center"><img src="https://github.com/homebridge/branding/raw/master/logos/homebridge-wordmark-logo-vertical.png" width="150"></td>
5
+ <td align="center"><img src="https://www.solaxpower.com/wp-content/uploads/2020/03/weblogo5.png" width="300"></td>
6
+ <tr>
7
+ </table>
8
+
9
+ # Solax Cloud Plugin for Homebridge
10
+
11
+ ![npm](https://badgen.net/npm/v/homebridge-solaxcloud-api) ![npm](https://badgen.net/npm/dt/homebridge-solaxcloud-api) [![verified-by-homebridge](https://badgen.net/badge/homebridge/verified/purple)](https://github.com/homebridge/homebridge/wiki/Verified-Plugins)
12
+
13
+
14
+ The Solax Cloud Plugin for [Homebridge](https://homebridge.io/) was created as a platform plugin to gather data exposed by Solax inverters to the cloud through the [Solax Cloud API](https://www.solaxcloud.com/phoebus/resource/files/userGuide/Solax_API.pdf).
15
+
16
+ Now with **support for multiple inverters**! Sensors will be created for each of the inverters present in the configuration. Additionally, a virtual inverter named "All inverters" will be created whenever a multiple inverters configuration is present. This inverter will present summarized power and consumption figures derived from data for all the physical inverters.
17
+
18
+ As HomeKit is still clueless about what a solar panel is, this plugin exposes a set of standard HomeKit accessories though Homebridge for each configured inverter that will allow interacting and automating your smart home based on the data made available from the Solax platform:
19
+
20
+ - **PV** (PV outlet with power consumption)
21
+ - **AC** (Inverter AC outlet with power and total energy consumptions)
22
+ - **To Grid** (Inverter to Grid outlet with power consumption)
23
+ - **To House** (Inverter to House outlet with power consumption)
24
+ - **From Grid** (Grid to House outlet with power consumption)
25
+ - **Update** (Motion sensor)
26
+
27
+ Battery information is also provided as Homekit accessories in case there are any batteries installed for any of the configured inverters:
28
+
29
+ - **To Battery** (Outlet with inverter power charging the battery)
30
+ - **From Battery** (Outlet with power drawn from the battery to the inverter)
31
+ - **Battery** (Battery with State of Charge information such as level or charge state)
32
+
33
+ <img src="images/plugin-accessories-home.png" width="50%" height="50%">
34
+
35
+ Please note that additional accessories are created by default with smooth power consumption curves (by applying either a simple or exponential moving average to the power series). This prevents sporadic events like a cloud passing by to have an immediate affect on provided meters.
36
+
37
+ ## Required information
38
+
39
+ For this plugin to work, two critical pieces of information are required from Solax Cloud:
40
+
41
+ - **Token ID**: Solax users can get inverter information through the granted tokenID. You need to obtain your tokenID on the API page of Solaxcloud.
42
+ - **SN**: Registration No (communication module SN) for each desired inverter.
43
+
44
+ ## Installation
45
+
46
+ This plugin is supported under Homebridge. It is highly recommended that you use Homebridge Config UI X to install and configure this plugin.
47
+
48
+ ### Manual Installation
49
+
50
+ Install this plugin using: `sudo npm install -g homebridge-solaxcloud-api`.
51
+ Edit `config.json` manually to add your Solax inverters. See below for instructions on that.
52
+
53
+ ## Platform configuration
54
+
55
+ Minimal platform configuration is depicted by the example configuration file below:
56
+
57
+ ```json
58
+ {
59
+ "platforms": [
60
+ {
61
+ "platform": "SolaxCloudAPI",
62
+ "tokenId": "20200722185111234567890",
63
+ "inverters": [
64
+ {
65
+ "name": "Solax",
66
+ "sn": "ABCDEFGHIJ"
67
+ }
68
+ ],
69
+ }
70
+ ]
71
+ }
72
+ ```
73
+ Configuration parameters are described on the table below:
74
+
75
+ | **Parameter** | **Type** | **Description** | **Default** | **Mandatory?** |
76
+ | ------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------- | -------------:| :------------: |
77
+ | `platform` | string | Platform name (must be SolaxCloudAPI) | - | Y |
78
+ | `tokenId` | string | Users get information from Solax Cloud through the granted tokenID. Please obtain your tokenID on the API page of Solax Cloud | - | Y |
79
+ | `inverters` | array | Array of configured inverters as objects with `{ name: string, sn: string }`, where `name` is the inverter name, used as prefix for accessory naming and `sn` is the inverter registration no. (inverter module SN). | - | Y |
80
+ | `pollingFrequency` | number | Plugin data polling frequency from Solax Cloud (in seconds) | 300 | N |
81
+ | `smoothingMeters` | boolean | Whether to create additional meters by smoothing raw values from Solax Cloud | true | N |
82
+ | `smoothingMethod` | string | Statistical method to use for smoothing raw values from Solax Cloud (simple or exponential moving average - "sma" or "ema") | "sma" | N |
83
+ | `pureHomeApp` | boolean | Whether to create meters as standard accessories that can be used on the Home App (power will show as ambient light sensors) | false | N |
84
+
85
+ **NOTE:** The `pollingFrequency` parameter defaults to 300 seconds, since Solax inverters update cloud data every 5 minutes.
86
+
87
+ Configuration through the the use of [Homebridge UI](https://github.com/oznu/homebridge-config-ui-x) plugin is also available and recommended:
88
+
89
+ <img src="images/homebridge-ui.png" width="100%" height="100%">
90
+
91
+ ## Non-standard characteristics
92
+
93
+ Non-standard accessory characteristics are available through the use of [Eve for HomeKit app](https://apps.apple.com/us/app/eve-for-homekit/id917695792) you may download from the App Store.
94
+
95
+ This will allow some non-standard characteristics to be visible along with its historical data (like power or total energy consumption), as depicted in the image below:
96
+
97
+ <img src="images/plugin-outlet-consumption.png" width="50%" height="50%">
98
+
99
+ If you want to rely solely on the native Home App, please enable the `pureHomeApp` config setting. In this case, power consumption on each meter will be exposed as an Ambient Light Sensor, as shown below (minimum value for an Ambient Light Sensor is 0.1 lux):
100
+
101
+ <img src="images/plugin-accessories-home-pure.png" width="50%" height="50%">
102
+
103
+ # Automation
104
+
105
+ Automation can be achieved with the help of the virtual **Update** motion sensor that was specifically tailored for this effect and which is available for each inverter. This motion sensor will be triggered whenever inverter data gets updated from the Solax Cloud API (according to what is defined on the `pollingFrequency` configuration setting).
106
+
107
+ <img src="images/plugin-accessories-eve.png" width="50%" height="50%">
108
+
109
+ Motion is detected by the **Update** motion sensor whenever there is newly fetched inverter data from Solax Cloud. Using this sensor as a trigger combined with power and energy data from the virtual outlets enumerated above forms the basic building blocks for defining an automation.
110
+
111
+ ## Automation example
112
+
113
+ Since automations are probably going to be dependent on the non-standard **Consumption** characteristics from the virtual outlets, these must created by using the Eve App.
114
+
115
+ As an automation example, let's imagine we want to turn a pool heater pump on whenever the inverter AC power is greater than a specific figure (in Watt):
116
+
117
+ <table cellspacing="0" cellpadding="0">
118
+ <tr>
119
+ <td width="50%">1. Under Automation, select <b>Rules</b></td>
120
+ <td width="50%">2. Click <b>Next</b></td>
121
+ </tr>
122
+ <tr>
123
+ <td><img src="images/automation/automation_1.png"></td>
124
+ <td><img src="images/automation/automation_2.png"></td>
125
+ </tr>
126
+ <tr>
127
+ <td>3. Click <b>Add Trigger</b></td>
128
+ <td>4. Select <b>Motion</b> as trigger type</td>
129
+ </tr>
130
+ <tr>
131
+ <td><img src="images/automation/automation_3.png"></td>
132
+ <td><img src="images/automation/automation_4.png"></td>
133
+ </tr>
134
+ <tr>
135
+ <td>5. Select the Solax <b>Update</b> motion detector and set <b>Motion</b> as trigger</td>
136
+ <td>6. Click <b>Next</b></td>
137
+ </tr>
138
+ <tr>
139
+ <td><img src="images/automation/automation_5.png"></td>
140
+ <td><img src="images/automation/automation_6.png"></td>
141
+ </tr>
142
+ <tr>
143
+ <td>7. Select <b>Add Value Condition</b></td>
144
+ <td>8. Choose <b>Inverter AC Consumption</b> as characteristic and elect <b>&gt=</b> a desired value</b></td>
145
+ </tr>
146
+ <tr>
147
+ <td><img src="images/automation/automation_7.png"></td>
148
+ <td><img src="images/automation/automation_8.png"></td>
149
+ </tr>
150
+ <tr>
151
+ <td>9. Click <b>Next</b></td>
152
+ <td>10. If no scene exists, click <b>Add Scene</b></td>
153
+ </tr>
154
+ <tr>
155
+ <td><img src="images/automation/automation_9.png"></td>
156
+ <td><img src="images/automation/automation_10.png"></td>
157
+ </tr>
158
+ <tr>
159
+ <td>11. Click <b>Add Actions</b></td>
160
+ <td>12. Select the accessory to be controlled (in this case <b>Garden Pool Outlet</b> will be turned <b>ON</b>)</td>
161
+ </tr>
162
+ <tr>
163
+ <td><img src="images/automation/automation_11.png"></td>
164
+ <td><img src="images/automation/automation_12.png"></td>
165
+ </tr>
166
+ <tr>
167
+ <td>13. Click <b>Next</b></td>
168
+ <td>14. Name your scene and click <b>Done</b></td>
169
+ </tr>
170
+ <tr>
171
+ <td><img src="images/automation/automation_13.png"></td>
172
+ <td><img src="images/automation/automation_14.png"></td>
173
+ </tr>
174
+ <tr>
175
+ <td>15. Click <b>Next</b></td>
176
+ <td>16. Name your rule and click <b>Done</b></td>
177
+ </tr>
178
+ <tr>
179
+ <td><img src="images/automation/automation_15.png"></td>
180
+ <td><img src="images/automation/automation_16.png"></td>
181
+ </tr>
182
+ </table>
183
+
184
+ # TO DO
185
+
186
+ Next planned plugin releases should include:
187
+
188
+ - [X] **Inverter AC** to include Total Yield Energy
189
+ - [X] Consumption history through the [fakegato-history](https://github.com/simont77/fakegato-history) module
190
+ - [x] Enable support for "pure" Home App accessories (power meters will be exposed as Ambient Light sensors)
191
+ - [x] Add "smooth" accessories for power meters (compensating for sporadic scenarios like cloud a passing)
192
+ - [x] Support for multiple inverters
193
+ - [ ] Accessories for battery state and consumptions (work in progress)
@@ -39,6 +39,13 @@
39
39
  "default": "ABCDEFGHIJ",
40
40
  "minLength": 10,
41
41
  "maxLength": 10
42
+ },
43
+ "hasBattery": {
44
+ "title": "Battery installed?",
45
+ "type": "boolean",
46
+ "required": false,
47
+ "description": "Whether this inverter has a battery installed.",
48
+ "default": false
42
49
  }
43
50
  }
44
51
  }
@@ -0,0 +1,66 @@
1
+ import { AccessoryPlugin, API, CharacteristicGetCallback, Logging, Service } from 'homebridge';
2
+ import { SolaxPlatformAccessory } from './platformAccessory';
3
+ /**
4
+ * Enum with possible battery charging states.
5
+ */
6
+ export declare const BATTERY_CHARGING_STATE: {
7
+ NOT_CHARGING: number;
8
+ CHARGING: number;
9
+ NOT_CHARGEABLE: number;
10
+ };
11
+ /**
12
+ * Solax Battery Accessory.
13
+ * Battery sensor used to monitor inverter battery state of charge (SoC).
14
+ */
15
+ export declare class SolaxBatteryAccessory extends SolaxPlatformAccessory implements AccessoryPlugin {
16
+ /**
17
+ * The battery service for Homekit.
18
+ **/
19
+ private readonly batteryService;
20
+ /**
21
+ * The battery charge level (in percentage).
22
+ */
23
+ private batteryLevel;
24
+ /**
25
+ * Ambient light level.
26
+ */
27
+ private batteryChargeState;
28
+ /**
29
+ * Solax virtual light sensor class constructor.
30
+ * @param {Logging} log The platform logging for homebridge.
31
+ * @param {API} api The platform API.
32
+ * @param {string} name The accessory name.
33
+ * @param {string} serial "Real world" serial number for this accessory.
34
+ * @param {string} model Accessory model.
35
+ */
36
+ constructor(log: Logging, api: API, name: string, serial: string, model: string);
37
+ /**
38
+ * Handle requests to get the current value of the "Status Low Battery" characteristic.
39
+ */
40
+ getStatusLowBattery(): number;
41
+ /**
42
+ * Gets the battery level value.
43
+ * @returns {number} Battery level value (as percentage).
44
+ */
45
+ getLevelValue(): number;
46
+ /**
47
+ * Handler for getting the current battery level (percentage).
48
+ */
49
+ getLevel(callback: CharacteristicGetCallback): void;
50
+ /**
51
+ * Sets the current battery level.
52
+ * @param {number} percentage The battery percentage level to set.
53
+ */
54
+ setLevel(percentage: number): void;
55
+ /**
56
+ * Handler for getting the current battery charging state.
57
+ */
58
+ getChargeState(callback: CharacteristicGetCallback): void;
59
+ /**
60
+ * Sets the battery charging state according to predefined characteristic constants:
61
+ * @param state {number} The desired charging state.
62
+ */
63
+ setChargeState(state: number): void;
64
+ getServices(): Service[];
65
+ }
66
+ //# sourceMappingURL=batteryAccessory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"batteryAccessory.d.ts","sourceRoot":"","sources":["../src/batteryAccessory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,GAAG,EAA4B,yBAAyB,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAEzH,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE7D;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;CAIlC,CAAC;AAOF;;;GAGG;AACH,qBAAa,qBAAsB,SAAQ,sBAAuB,YAAW,eAAe;IAC1F;;QAEI;IACJ,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAU;IAEzC;;OAEG;IACH,OAAO,CAAC,YAAY,CAAK;IAEzB;;OAEG;IACH,OAAO,CAAC,kBAAkB,CAAuC;IAEjE;;;;;;;OAOG;gBACS,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAwB/E;;OAEG;IACI,mBAAmB,IAAI,MAAM;IAepC;;;OAGG;IACI,aAAa,IAAI,MAAM;IAI9B;;OAEG;IACI,QAAQ,CAAC,QAAQ,EAAE,yBAAyB,GAAG,IAAI;IAM1D;;;OAGG;IACI,QAAQ,CAAC,UAAU,EAAE,MAAM;IAQlC;;OAEG;IACI,cAAc,CAAC,QAAQ,EAAE,yBAAyB,GAAG,IAAI;IAMhE;;;OAGG;IACI,cAAc,CAAC,KAAK,EAAE,MAAM;IAUnC,WAAW,IAAI,OAAO,EAAE;CAIzB"}