homebridge-tauron-elicznik 0.0.2-beta33 → 0.0.2-beta37
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.
- package/index.js +8 -4
- package/package.json +1 -1
- package/src/elicznik.py +4 -3
package/index.js
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
const path = require('path');
|
4
4
|
const fs = require('fs');
|
5
5
|
const fsPromises = require('fs').promises;
|
6
|
-
const
|
6
|
+
const pyshell = require('python-shell');
|
7
7
|
|
8
8
|
const PLUGIN_NAME = 'homebridge-tauron-elicznik';
|
9
9
|
const PLATFORM_NAME = 'tauroneLicznik';
|
@@ -170,14 +170,18 @@ class eLicznikDevice {
|
|
170
170
|
async updateDeviceState() {
|
171
171
|
this.log.debug('Device: %s %s, requesting Device state.', this.meterId, this.name);
|
172
172
|
try {
|
173
|
+
var options = {
|
174
|
+
mode: 'text',
|
175
|
+
pythonOptions: ['-u'],
|
176
|
+
args: [this.user, this.passwd, this.meterId]
|
177
|
+
};
|
173
178
|
|
174
|
-
PythonShell.run('./src/elicznik.py', (err, results)
|
179
|
+
pyshell.PythonShell.run('./src/elicznik.py', options, function (err, results) {
|
175
180
|
if (err) throw err;
|
176
181
|
// results is an array consisting of messages collected during execution
|
177
|
-
console.log('results: %j', results);
|
182
|
+
console.log('results: %j', results.toString());
|
178
183
|
});
|
179
184
|
|
180
|
-
this.log.debug('Device: %s %s, debug response: %s', this.meterId, this.name, response1);
|
181
185
|
const energyImport = 0;
|
182
186
|
const energyExport = 0;
|
183
187
|
if (this.tauroneLicznikEnergyService) {
|
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-
|
4
|
+
"version": "0.0.2-beta37",
|
5
5
|
"description": "Homebridge plugin (https://github.com/homebridge/homebridge) to read data from Tauron eLicznik.",
|
6
6
|
"license": "MIT",
|
7
7
|
"author": "grzegorz914",
|
package/src/elicznik.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
#!/usr/bin/env python
|
2
2
|
|
3
|
+
import sys
|
3
4
|
import requests
|
4
5
|
from requests import adapters
|
5
6
|
import ssl
|
@@ -7,9 +8,9 @@ from urllib3 import poolmanager
|
|
7
8
|
import datetime
|
8
9
|
|
9
10
|
# Add login details & meter ID here:
|
10
|
-
username =
|
11
|
-
password =
|
12
|
-
meter_id =
|
11
|
+
username = sys.argv[0]
|
12
|
+
password = sys.argv[1]
|
13
|
+
meter_id = sys.argv[2]
|
13
14
|
|
14
15
|
payload = {
|
15
16
|
'username': username,
|