homebridge-tauron-elicznik 0.0.2-beta60 → 0.0.2-beta64
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +3 -4
- package/package.json +1 -1
- package/src/tauronAuth.js +7 -6
package/index.js
CHANGED
@@ -136,8 +136,7 @@ class eLicznikDevice {
|
|
136
136
|
|
137
137
|
const data = {
|
138
138
|
username: this.user,
|
139
|
-
password: this.passwd
|
140
|
-
service: SERVICE_URL
|
139
|
+
password: this.passwd
|
141
140
|
};
|
142
141
|
|
143
142
|
|
@@ -206,9 +205,9 @@ class eLicznikDevice {
|
|
206
205
|
rejectUnauthorized: false
|
207
206
|
}),
|
208
207
|
};
|
209
|
-
const response = await this.tauronAuth(options);
|
208
|
+
const response = await this.tauronAuth.request(options);
|
210
209
|
|
211
|
-
this.log(response)
|
210
|
+
this.log(response);
|
212
211
|
const energyImport = 0;
|
213
212
|
const energyExport = 0;
|
214
213
|
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-beta64",
|
5
5
|
"description": "Homebridge plugin (https://github.com/homebridge/homebridge) to read data from Tauron eLicznik.",
|
6
6
|
"license": "MIT",
|
7
7
|
"author": "grzegorz914",
|
package/src/tauronAuth.js
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
const axios = require('axios');
|
3
3
|
|
4
4
|
const LOGIN_URL = 'https://logowanie.tauron-dystrybucja.pl/login?service=https://elicznik.tauron-dystrybucja.pl';
|
5
|
+
const SERVICE_URL = 'https://elicznik.tauron-dystrybucja.pl';
|
5
6
|
|
6
7
|
class axiosTauronAuth {
|
7
8
|
constructor({
|
@@ -9,7 +10,6 @@ class axiosTauronAuth {
|
|
9
10
|
}) {
|
10
11
|
this.username = data.username;
|
11
12
|
this.password = data.password;
|
12
|
-
this.service = data.service;
|
13
13
|
}
|
14
14
|
|
15
15
|
async request() {
|
@@ -17,7 +17,7 @@ class axiosTauronAuth {
|
|
17
17
|
const data = {
|
18
18
|
username: this.username,
|
19
19
|
password: this.password,
|
20
|
-
service:
|
20
|
+
service: SERVICE_URL
|
21
21
|
};
|
22
22
|
|
23
23
|
const options = {
|
@@ -25,10 +25,11 @@ class axiosTauronAuth {
|
|
25
25
|
data: data
|
26
26
|
};
|
27
27
|
const response = await axios.post(options);
|
28
|
-
console.log(response)
|
29
|
-
return response;
|
30
|
-
} catch (err) {
|
31
|
-
|
28
|
+
console.log(response.data);
|
29
|
+
return response.data;
|
30
|
+
} catch (err) {
|
31
|
+
return err
|
32
|
+
}
|
32
33
|
};
|
33
34
|
}
|
34
35
|
module.exports = axiosTauronAuth;
|