homebridge-tauron-elicznik 0.0.3-beta.4 → 0.0.3-beta.5
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +18 -18
- package/package.json +1 -1
package/index.js
CHANGED
@@ -4,6 +4,7 @@ const path = require('path');
|
|
4
4
|
const fs = require('fs');
|
5
5
|
const fsPromises = fs.promises;
|
6
6
|
const axios = require('axios');
|
7
|
+
const https = require('https');
|
7
8
|
|
8
9
|
const PLUGIN_NAME = 'homebridge-tauron-elicznik';
|
9
10
|
const PLATFORM_NAME = 'tauroneLicznik';
|
@@ -150,35 +151,34 @@ class eLicznikDevice {
|
|
150
151
|
}.bind(this), this.refreshInterval * 1000);
|
151
152
|
}
|
152
153
|
|
153
|
-
|
154
|
+
getDeviceInfo() {
|
154
155
|
this.log.debug('Device: %s %s, requesting Device Info.', this.meterId, this.name);
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
} catch (error) {
|
167
|
-
this.log.error('Device: %s %s, Device Info eror: %s, state: Offline, trying to reconnect', this.meterId, this.name, error);
|
168
|
-
this.checkDeviceInfo = true;
|
169
|
-
}
|
156
|
+
|
157
|
+
this.log('-------- %s --------', this.name);
|
158
|
+
this.log('Manufacturer: %s', this.manufacturer);
|
159
|
+
this.log('Model: %s', this.modelName);
|
160
|
+
this.log('Meter Id: %s', this.meterId);
|
161
|
+
this.log('Serialnr: %s', this.serialNumber);
|
162
|
+
this.log('Firmware: %s', this.firmwareRevision);
|
163
|
+
this.log('----------------------------------');
|
164
|
+
|
165
|
+
this.checkDeviceInfo = false;
|
166
|
+
this.updateDeviceState();
|
170
167
|
}
|
171
168
|
|
172
169
|
async updateDeviceState() {
|
173
170
|
this.log.debug('Device: %s %s, requesting Device state.', this.meterId, this.name);
|
174
171
|
try {
|
175
|
-
const url = `${CHARTS_URL}?dane[chartYear]=
|
172
|
+
const url = `${CHARTS_URL}?dane[chartYear]=2022&dane[paramType]=year&dane[checkOZE]=on&dane[smartNr]=${this.meterId}`;
|
176
173
|
const options = {
|
177
174
|
method: 'POST',
|
178
175
|
url: url
|
179
176
|
};
|
180
177
|
|
181
178
|
const login = await axios.post(LOGIN_URL, {
|
179
|
+
httpsAgent: new https.Agent({
|
180
|
+
rejectUnauthorized: false
|
181
|
+
}),
|
182
182
|
username: this.user,
|
183
183
|
password: this.passwd,
|
184
184
|
});
|
@@ -203,7 +203,7 @@ class eLicznikDevice {
|
|
203
203
|
//this.prepareAccessory();
|
204
204
|
}
|
205
205
|
} catch (error) {
|
206
|
-
this.log.error('Device: %s
|
206
|
+
this.log.error('Device: %s, update Device state error: %s', this.name, error);
|
207
207
|
this.checkDeviceState = false;
|
208
208
|
this.checkDeviceInfo = true;
|
209
209
|
}
|
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.
|
4
|
+
"version": "0.0.3-beta.5",
|
5
5
|
"description": "Homebridge plugin (https://github.com/homebridge/homebridge) to read data from Tauron eLicznik.",
|
6
6
|
"license": "MIT",
|
7
7
|
"author": "grzegorz914",
|