homebridge-tauron-elicznik 0.0.2-beta83 → 0.0.2-beta84

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 (2) hide show
  1. package/index.js +9 -7
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -4,6 +4,7 @@ const path = require('path');
4
4
  const axios = require('axios');
5
5
  const axiosTauronAuth = require('./src/tauronAuth.js');
6
6
  const https = require('https');
7
+ const qs = require('qs');
7
8
  const fs = require('fs');
8
9
  const fsPromises = fs.promises;
9
10
 
@@ -14,8 +15,8 @@ const SERVICE_URL = 'https://elicznik.tauron-dystrybucja.pl';
14
15
  const LOGIN_URL = 'https://logowanie.tauron-dystrybucja.pl/login';
15
16
  const CHARTS_URL = 'https://elicznik.tauron-dystrybucja.pl/index/charts';
16
17
  const HEADERS = {
17
- 'cache-control': 'no-cache'
18
- }
18
+ 'content-type': 'application/x-www-form-urlencoded'
19
+ };
19
20
 
20
21
  let Accessory, Characteristic, Service, Categories, UUID;
21
22
 
@@ -192,9 +193,9 @@ class eLicznikDevice {
192
193
  try {
193
194
  const url = CHARTS_URL + '?dane[chartYear]=2021&dane[paramType]=year&dane[checkOZE]=on&dane[smartNr]=' + this.meterId;
194
195
 
195
- const agent = new https.Agent({
196
+ const agent = new https.Agent({
196
197
  rejectUnauthorized: false
197
- });
198
+ });
198
199
 
199
200
  const payload = {
200
201
  username: this.username,
@@ -203,11 +204,12 @@ class eLicznikDevice {
203
204
  };
204
205
  const options = {
205
206
  method: 'POST',
206
- data: payload,
207
207
  headers: HEADERS,
208
- httpsAgent: agent
208
+ data: qs.stringify(payload),
209
+ httpsAgent: agent,
210
+ url: LOGIN_URL
209
211
  };
210
- const response = await axios(LOGIN_URL, options);
212
+ const response = await axios(options);
211
213
 
212
214
  //const response = await this.tauronAuth.request(url);
213
215
 
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-beta83",
4
+ "version": "0.0.2-beta84",
5
5
  "description": "Homebridge plugin (https://github.com/homebridge/homebridge) to read data from Tauron eLicznik.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",