homebridge-tauron-elicznik 0.0.3-beta.11 → 0.0.3-beta.13

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 +10 -14
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -10,7 +10,7 @@ const PLUGIN_NAME = 'homebridge-tauron-elicznik';
10
10
  const PLATFORM_NAME = 'tauroneLicznik';
11
11
 
12
12
  const url = 'https://logowanie.tauron-dystrybucja.pl/login';
13
- const chartUrl = 'https://elicznik.tauron-dystrybucja.pl/index/charts';
13
+ const charturl = 'https://elicznik.tauron-dystrybucja.pl/index/charts';
14
14
  const headers = { 'cache-control': 'no-cache' };
15
15
 
16
16
  let Accessory, Characteristic, Service, Categories, UUID;
@@ -137,6 +137,12 @@ class eLicznikDevice {
137
137
  fsPromises.mkdir(prefDir);
138
138
  }
139
139
 
140
+ this.axiosInstance = axios.create({
141
+ httpsAgent: new https.Agent({
142
+ ciphers: 'DEFAULT@SECLEVEL=1'
143
+ })
144
+ });
145
+
140
146
  //Check device state
141
147
  setInterval(() => {
142
148
  if (this.checkDeviceInfo) {
@@ -173,25 +179,15 @@ class eLicznikDevice {
173
179
  'service': 'https://elicznik.tauron-dystrybucja.pl'
174
180
  }
175
181
 
176
- const url = 'https://logowanie.tauron-dystrybucja.pl/login';
177
- const charturl = 'https://elicznik.tauron-dystrybucja.pl/index/charts';
178
- const headers = { 'cache-control': 'no-cache' };
179
-
180
- const axiosInstance = axios.create({
181
- httpsAgent: new https.Agent({
182
- ciphers: 'DEFAULT@SECLEVEL=1'
183
- })
184
- });
185
-
186
- axiosInstance.post(url, payload, { headers: headers })
182
+ this.axiosInstance.post(url, payload, { headers: headers })
187
183
  .then((response) => {
188
184
  const chart_year = {
189
185
  "dane[chartYear]": 2020,
190
186
  "dane[paramType]": "year",
191
- "dane[smartNr]": meter_id,
187
+ "dane[smartNr]": this.meterId,
192
188
  "dane[checkOZE]": "on"
193
189
  };
194
- return axiosInstance.post(charturl, chart_year, { headers: headers });
190
+ return this.axiosInstance.post(charturl, chart_year, { headers: headers });
195
191
  })
196
192
  .then((response) => {
197
193
  this.log('Device: %s, update Device state: %s', this.name, response.data);
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.3-beta.11",
4
+ "version": "0.0.3-beta.13",
5
5
  "description": "Homebridge plugin (https://github.com/homebridge/homebridge) to read data from Tauron eLicznik.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",