homebridge-tauron-elicznik 0.0.2-beta43 → 0.0.2-beta44
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/index.js +18 -0
- package/package.json +3 -2
package/index.js
CHANGED
@@ -2,12 +2,17 @@
|
|
2
2
|
|
3
3
|
const path = require('path');
|
4
4
|
const axios = require('axios');
|
5
|
+
const qs = require('qs');
|
5
6
|
const fs = require('fs');
|
6
7
|
const fsPromises = require('fs').promises;
|
7
8
|
|
8
9
|
const PLUGIN_NAME = 'homebridge-tauron-elicznik';
|
9
10
|
const PLATFORM_NAME = 'tauroneLicznik';
|
10
11
|
|
12
|
+
const SERVICE_URL = 'https://elicznik.tauron-dystrybucja.pl';
|
13
|
+
const LOGIN_URL = 'https://logowanie.tauron-dystrybucja.pl/login?service=https://elicznik.tauron-dystrybucja.pl';
|
14
|
+
const CHARTS_URL = 'https://elicznik.tauron-dystrybucja.pl/index/charts';
|
15
|
+
|
11
16
|
let Accessory, Characteristic, Service, Categories, UUID;
|
12
17
|
|
13
18
|
module.exports = (api) => {
|
@@ -170,7 +175,20 @@ class eLicznikDevice {
|
|
170
175
|
async updateDeviceState() {
|
171
176
|
this.log.debug('Device: %s %s, requesting Device state.', this.meterId, this.name);
|
172
177
|
try {
|
178
|
+
const data = qs.stringify({
|
179
|
+
pointId: this.meterId,
|
180
|
+
username: this.user,
|
181
|
+
password: this.passwd
|
182
|
+
});
|
183
|
+
const headers = {
|
184
|
+
'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
|
185
|
+
};
|
186
|
+
const response = await axios.post(LOGIN_URL,
|
187
|
+
data,
|
188
|
+
headers
|
189
|
+
);
|
173
190
|
|
191
|
+
this.log(response)
|
174
192
|
const energyImport = 0;
|
175
193
|
const energyExport = 0;
|
176
194
|
if (this.tauroneLicznikEnergyService) {
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"displayName": "Tauron eLicznik",
|
3
3
|
"name": "homebridge-tauron-elicznik",
|
4
|
-
"version": "0.0.2-
|
4
|
+
"version": "0.0.2-beta44",
|
5
5
|
"description": "Homebridge plugin (https://github.com/homebridge/homebridge) to read data from Tauron eLicznik.",
|
6
6
|
"license": "MIT",
|
7
7
|
"author": "grzegorz914",
|
@@ -31,7 +31,8 @@
|
|
31
31
|
"homebridge": ">=1.3.0"
|
32
32
|
},
|
33
33
|
"dependencies": {
|
34
|
-
"axios": "^0.21.4"
|
34
|
+
"axios": "^0.21.4",
|
35
|
+
"qs": "^6.10.1"
|
35
36
|
},
|
36
37
|
"keywords": [
|
37
38
|
"homebridge",
|