homebridge-tauron-elicznik 0.0.2-beta4 → 0.0.2-beta43

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 +3 -36
  2. package/package.json +3 -4
package/index.js CHANGED
@@ -4,15 +4,10 @@ const path = require('path');
4
4
  const axios = require('axios');
5
5
  const fs = require('fs');
6
6
  const fsPromises = require('fs').promises;
7
- const qs = require('qs')
8
7
 
9
8
  const PLUGIN_NAME = 'homebridge-tauron-elicznik';
10
9
  const PLATFORM_NAME = 'tauroneLicznik';
11
10
 
12
- const SERVICE_URL = 'https://elicznik.tauron-dystrybucja.pl';
13
- const LOGIN_URL = 'https://logowanie.tauron-dystrybucja.pl/login';
14
- const CHARTS_URL = 'https://elicznik.tauron-dystrybucja.pl/index/charts';
15
-
16
11
  let Accessory, Characteristic, Service, Categories, UUID;
17
12
 
18
13
  module.exports = (api) => {
@@ -175,48 +170,20 @@ class eLicznikDevice {
175
170
  async updateDeviceState() {
176
171
  this.log.debug('Device: %s %s, requesting Device state.', this.meterId, this.name);
177
172
  try {
178
- const headers = {
179
- 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0'
180
- };
181
-
182
- const options = qs.stringify({
183
- 'username': this.user,
184
- 'password': this.password,
185
- 'service': SERVICE_URL
186
- });
187
-
188
- this.axiosInstance = axios.create({
189
- method: 'POST',
190
- baseURL: LOGIN_URL,
191
- headers: {
192
- 'content-type': 'application/x-www-form-urlencoded'
193
- },
194
- timeout: 5000,
195
- });
196
-
197
- const chart = {
198
- "dane[chartYear]": 2020,
199
- "dane[paramType]": "year",
200
- "dane[smartNr]": this.meterId,
201
- "dane[checkOZE]": "on"
202
- }
203
173
 
204
- const response = await this.axiosInstance(options);
205
- this.log.debug('Device: %s %s, debug response: %s', this.meterId, this.name, response.data);
206
- const energyImport = response.data;
207
- this.log(response.data)
174
+ const energyImport = 0;
208
175
  const energyExport = 0;
209
176
  if (this.tauroneLicznikEnergyService) {
210
177
  this.tauroneLicznikEnergyService
211
178
  .updateCharacteristic(Characteristic.tauroneLicznikEnergyImport, energyImport)
212
- .updateCharacteristic(Characteristic.tauroneLicznikEnergyImport, energyExport);
179
+ .updateCharacteristic(Characteristic.tauroneLicznikEnergyExport, energyExport);
213
180
  }
214
181
  this.energyImport = energyImport;
215
182
  this.energyExport = energyExport;
216
183
 
217
184
  this.checkDeviceState = true;
218
185
  } catch (error) {
219
- this.log.error('Device: %s %s, update Device state error: %s, state: Offline', this.meterId, this.name, error);
186
+ this.log.error('Device: %s %s, update Device state error: %s', this.meterId, this.name, error);
220
187
  this.checkDeviceState = false;
221
188
  this.checkDeviceInfo = true;
222
189
  }
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-beta4",
4
+ "version": "0.0.2-beta43",
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,8 +31,7 @@
31
31
  "homebridge": ">=1.3.0"
32
32
  },
33
33
  "dependencies": {
34
- "axios": "^0.21.4",
35
- "qs": "^6.10.1"
34
+ "axios": "^0.21.4"
36
35
  },
37
36
  "keywords": [
38
37
  "homebridge",
@@ -45,4 +44,4 @@
45
44
  "scripts": {
46
45
  "test": "echo \"Error: no test specified\" && exit 1"
47
46
  }
48
- }
47
+ }