homebridge-tauron-elicznik 0.0.3-beta.13 → 0.0.3-beta.15
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +39 -39
- package/package.json +1 -1
package/index.js
CHANGED
@@ -138,6 +138,7 @@ class eLicznikDevice {
|
|
138
138
|
}
|
139
139
|
|
140
140
|
this.axiosInstance = axios.create({
|
141
|
+
method: 'POST',
|
141
142
|
httpsAgent: new https.Agent({
|
142
143
|
ciphers: 'DEFAULT@SECLEVEL=1'
|
143
144
|
})
|
@@ -172,48 +173,47 @@ class eLicznikDevice {
|
|
172
173
|
async updateDeviceState() {
|
173
174
|
this.log.debug('Device: %s %s, requesting Device state.', this.meterId, this.name);
|
174
175
|
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
176
|
+
try {
|
177
|
+
// Add login details & meter ID here:
|
178
|
+
const payload = {
|
179
|
+
'username': this.user,
|
180
|
+
'password': this.passwd,
|
181
|
+
'service': 'https://elicznik.tauron-dystrybucja.pl'
|
182
|
+
}
|
181
183
|
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
})
|
192
|
-
.
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
this.energyExport = energyExport;
|
184
|
+
const chart_year = {
|
185
|
+
"dane[chartYear]": 2020,
|
186
|
+
"dane[paramType]": "year",
|
187
|
+
"dane[smartNr]": this.meterId,
|
188
|
+
"dane[checkOZE]": "on"
|
189
|
+
};
|
190
|
+
|
191
|
+
const response = await this.axiosInstance(url, payload, { headers: headers });
|
192
|
+
this.log('Device: %s, update Device state: %s', this.name, response.data);
|
193
|
+
const response1 = await this.axiosInstance(charturl, chart_year, { headers: headers });
|
194
|
+
this.log('Device: %s, update Device state: %s', this.name, response1.data);
|
195
|
+
|
196
|
+
const energyImport = 0;
|
197
|
+
const energyExport = 0;
|
198
|
+
if (this.tauroneLicznikEnergyService) {
|
199
|
+
this.tauroneLicznikEnergyService
|
200
|
+
.updateCharacteristic(Characteristic.tauroneLicznikEnergyImport, energyImport)
|
201
|
+
.updateCharacteristic(Characteristic.tauroneLicznikEnergyExport, energyExport);
|
202
|
+
}
|
203
|
+
this.energyImport = energyImport;
|
204
|
+
this.energyExport = energyExport;
|
204
205
|
|
205
|
-
|
206
|
+
this.checkDeviceState = true;
|
206
207
|
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
.
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
});
|
208
|
+
//start prepare accessory
|
209
|
+
if (this.startPrepareAccessory) {
|
210
|
+
//this.prepareAccessory();
|
211
|
+
}
|
212
|
+
} catch (error) {
|
213
|
+
this.log.error('Device: %s %s, update Device state error: %s', this.meterId, this.name, error);
|
214
|
+
this.checkDeviceState = false;
|
215
|
+
this.checkDeviceInfo = true;
|
216
|
+
};
|
217
217
|
}
|
218
218
|
|
219
219
|
//Prepare accessory
|
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.15",
|
5
5
|
"description": "Homebridge plugin (https://github.com/homebridge/homebridge) to read data from Tauron eLicznik.",
|
6
6
|
"license": "MIT",
|
7
7
|
"author": "grzegorz914",
|