Skip to content

Commit

Permalink
see issue #383: add optionally parameters to HTTP call
Browse files Browse the repository at this point in the history
  • Loading branch information
rg-engineering committed Dec 8, 2024
1 parent 1286802 commit 8538095
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 28 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ Attention: command in datapoint ebus.0.cmd is deleted after executing of command
Placeholder for the next version (at the beginning of the line):
### **WORK IN PROGRESS**
-->

### **WORK IN PROGRESS**
* (René) migration to jsonConfig
* (René) see issue #383: add optionally parameters to HTTP call

### 3.3.8 (2024-11-24)
* (René) update dependencies
* (René) issue #381: install widgets again
Expand Down
14 changes: 7 additions & 7 deletions admin/i18n/de/translations.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{
"Circuit4Find": "Gerät, in der nach Parametern gesucht wird",
"History4Vis2": "Erstellen Sie einen Verlaufswert für das VIS-2-Widget",
"Circuit4Find": "Gerät, in dem nach Parametern gesucht wird",
"History4Vis2": "Kompatibilität der Verlaufswerte für das (neue) VIS-2-Widget",
"active": "aktiv",
"addParameter": "zusätzliche Parameter",
"circuit": "Gerät",
"ebus_adapter_settings": "ebus Adaptereinstellungen",
"hint_ebusd": "Für den Adapter wird ein laufender ebusd incl. alle notwendigen Konfigurationen benötigt. Dieser Adapter verwendet HTML, um Daten von ebusd zu lesen und TCP, um auf ebusd zu schreiben",
"hint_ebusd": "Für den Adapter wird ein laufender ebusd incl. aller notwendigen Konfigurationen benötigt. Dieser Adapter verwendet HTML, um Daten von ebusd zu lesen und TCP (Telnet), um auf ebusd zu schreiben",
"hint_ebusd_history": "Liste aller Datenpunktnamen, die mit dem ebus-History-Widget verwendet werden sollen.",
"hint_ebusd_polled": "Liste aller Datenpunktnamen, die vom Adapter abgefragt werden sollen.",
"hint_ebusd_polled": "Liste aller Datenpunktnamen, die vom Adapter aktv abgefragt werden sollen.",
"historyDP": "Verlaufsdatenpunkte",
"maxretries": "maximale Anzahl von Wiederholungen, um einen Befehl zu senden",
"name": "Name",
"parse_timeout": "Download und Abfrage-Timeout [Sekunden]",
"polledDP": "abgefragte Datenpunkte",
"readInterval": "Intervall zum Lesen von Daten aus ebusd [min]",
"target_HTTPPort": "target HTTP Port zum Lesen von Daten",
"target_IP": "Ziel-IP",
"target_TelnetPort": "Telnet Port zum Schreiben von Daten",
"target_HTTPPort": "HTTP Port zum Lesen von Daten",
"target_IP": "IP-Adresse",
"target_TelnetPort": "TCP (Telnet) Port zum Schreiben von Daten",
"useBoolean4Onoff": "Boolean anstelle Strings für Datenpunkte mit Ein-/Aus-Werten verwenden"
}
6 changes: 3 additions & 3 deletions admin/i18n/en/translations.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"Circuit4Find": "Circuit in which parameters are searched ",
"History4Vis2": "Create history value for VIS-2 widget",
"History4Vis2": "compatibility to history value for (new) VIS-2 widget",
"active": "active",
"addParameter": "additional parameter",
"circuit": "circuit",
Expand All @@ -14,8 +14,8 @@
"parse_timeout": "download and poll timeout [seconds]",
"polledDP": "polled datapoints",
"readInterval": "interval to read data from ebusd [min]",
"target_HTTPPort": "target HTTP Port to read data",
"target_HTTPPort": "HTTP Port to read data",
"target_IP": "target IP",
"target_TelnetPort": "target telnet Port to write data",
"target_TelnetPort": "TCP (Telnet) Port to write data",
"useBoolean4Onoff": "use boolean instead string for datapoints with on/off values "
}
4 changes: 2 additions & 2 deletions admin/jsonConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@
{
"type": "text",
"attr": "name",
"width": "16% ",
"width": "20% ",
"title": "name",
"tooltip": "optional parameter name",
"filter": false,
Expand All @@ -220,7 +220,7 @@
{
"type": "text",
"attr": "value",
"width": "16% ",
"width": "20% ",
"title": "value",
"tooltip": "optional parameter value",
"filter": false,
Expand Down
14 changes: 7 additions & 7 deletions admin/words.js

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions io-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,6 @@
"name": "secret",
"value": "SECRET"
}



]
}
}
24 changes: 18 additions & 6 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ async function main() {

FillPolledVars();
FillHistoryVars();
FillHistoryVars();
FillHTTPParamsVars();

await checkVariables();

Expand Down Expand Up @@ -642,15 +642,27 @@ function VersionCheck() {
//get data via https in json -> this is the main data receiver; telnet just triggers ebusd to read data;
//https://github.com/john30/ebusd/wiki/3.2.-HTTP-client




async function ebusd_ReceiveData() {

const sUrl = "http://" + adapter.config.targetIP + ":" + parseInt(adapter.config.targetHTTPPort) + "/data";
let sUrl = "http://" + adapter.config.targetIP + ":" + parseInt(adapter.config.targetHTTPPort) + "/data";

//todo: Erweiterung mit optionalen parametern
//Erweiterung mit optionalen parametern
var paramsCnt = 0;
if (oHTTPParamsVars !== undefined && oHTTPParamsVars != null && oHTTPParamsVars.length > 0) {
for (let i = 0; i < oHTTPParamsVars.length; i++) {

if (oHTTPParamsVars[i].active) {
if (paramsCnt == 0) {
sUrl += "?" ;
}
else {
sUrl += "&";
}
sUrl += oHTTPParamsVars[i].name + "=" + oHTTPParamsVars[i].value;
paramsCnt++;
}
}
}

adapter.log.debug("request data from " + sUrl);

Expand Down

0 comments on commit 8538095

Please sign in to comment.