NEWS
Daten aus einer Website mit Javascript
-
Schau mal hier (http://forum.iobroker.net/viewtopic.php?f=30&t=4395 ) Ich hatte letztens eine ähnliche Frage nur für einen Stromzähler und dessen Weboberfläche. Dein Post get anscheinend laut Code an die Adresse
xmlreq.open("POST", "mux_http", true);
Vorher muss aber anscheinend noch die URL zusammengebaut werden
xmlreq.setRequestHeader("Content-length", params.length);
Diese sind laut Code
id="+getCookie("id")+"&show=D_Y_6|D_Y_7|D_C_1_1~",1);
Der Cookie scheint für Standardabfragen aber sehr einfach zu sein:
setCookie("id",parseInt( Math.random() * ( (9999+1) - 1000 )));
Mit den Informationen solltest Du einen Call machen können nach dem Artikel oben und den genannten Parametern. Je nachdem wie die Informationen zurückkommen, mußt Du dann nur noch das Resultat parsen.
Grüße, Jens
-
Hallo zusammen,
momentan nutze ich noch CCU.IO, aber ich den nächsten Wochen wollte ich auch auf ioBroker umsteigen…
Seit zwei Wochen haben wir auch eine SC18 von Grünbeck und ich möchte die Daten auslesen.
Anbei noch ein paar Zusatz Infos:
Das auslesen der Daten geschieht per Post-Requests.
Mit HttpRequester sende ich folgende Anfrage
POST http://192.168.1.1/mux_http Content-Length: 69 Content-type: application/x-www-form-urlencoded id=951&show=D_A_1_2|D_A_3_1|D_Y_1|D_Y_5|~
Und erhalte folgende Rückmeldung
<data>`ok`<d_a_1_2>0.20</d_a_1_2> <d_a_3_1>6</d_a_3_1><d_y_1>32</d_y_1><d_y_5>0</d_y_5></data>
D_A_1_2 = Restkapazität
D_A_3_1 = Letzte Regeneration
D_Y_1 = Wasserverbrauch Gestern
D_Y_5 = Aktueller Regenerationsschritt
Leider bin ich auch noch nicht weiter gekommen.
Sebbo hast du schon eine Lösung?
Grüße,
Thomas
-
Hallo zusammen,
Für die CCU gibt es mittlerweile eine Lösung.
https://homematic-forum.de/forum/viewto … 41#p356849
Grüße,
Fruehwi
-
Hallo Leute,
Da bei mir die vorhergehenden Lösungen nicht funktionierten hier mein Code der durch sehr viel Testen entstanden ist.
Mein Lösungsweg führt über die RegEx Funktion da ich es nicht geschafft habe einen XML Response zu erhalten.
// StateMaschine
! ````
var i
! // Wasserverbrauch
var path = 'Messwerte.0.SC18.Wasserverbrauch.';
! for ( i = 1; i < 15; i++ ) {
if (i<10)var id = path + 'D_Y_2_0' + i;
else var id = path + 'D_Y_2_' + i ;
! var obj = {};
obj.type = 'state';
obj.common = {};
obj.common.name = 'Wasserverbrauch vor ' + i + ' Tagen' ;
obj.common.type = 'number';
obj.common.role = 'number';
obj.common.desc = 'Wasserverbrauch vor ' + i + ' Tagen';
obj.common.read = true;
obj.common.write = true;
obj.common.def = 0;
obj.common.min = 0;
obj.common.unit = 'Liter';setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); });
! }
! // Regenerationen
var path = 'Messwerte.0.SC18.Regenerationen.';for ( i = 1; i < 15; i++ ) {
if (i<10)var id = path + 'D_Y_4_0' + i;
else var id = path + 'D_Y_4_' + i ;! var obj = {};
obj.type = 'state';
obj.common = {};
obj.common.name = 'Zeitpunkt Regenereation ' + i + ' vor aktueller';
obj.common.type = 'string';
obj.common.role = 'string';
obj.common.desc = 'Zeitpunkt Regenereation ' + i + ' vor aktueller';
obj.common.read = true;
obj.common.write = true;
obj.common.def = 0;
obj.common.min = 0;
obj.common.unit = '';setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); });
! }
! // Allgemeine Felder
var path = 'Messwerte.0.SC18.Allgemein.';
! var id = path + 'D_C_4_2';
var obj = {};
obj.type = 'state';
obj.common = {};
obj.common.name = 'Uhrzeit' ;
obj.common.type = 'string';
obj.common.role = 'string';
obj.common.desc = 'Uhrzeit';
obj.common.read = true;
obj.common.write = true;
obj.common.def = 0;
obj.common.min = 0;
obj.common.unit = 'Uhr';setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); }); var id = path + 'D_C_5_1'; var obj = {}; obj.type = 'state'; obj.common = {}; obj.common.name = 'Ansprechverhalten' ; obj.common.type = 'number'; obj.common.role = 'number'; obj.common.desc = 'Ansprechverhalten'; obj.common.read = true; obj.common.write = true; obj.common.def = 0; obj.common.min = 0; obj.common.unit = ''; setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); }); var id = path + 'D_C_4_1'; var obj = {}; obj.type = 'state'; obj.common = {}; obj.common.name = 'Regenerationszeitpunkt' ; obj.common.type = 'number'; obj.common.role = 'number'; obj.common.desc = 'Regenerationszeitpunkt 0= Auto 1= Fest'; obj.common.read = true; obj.common.write = true; obj.common.def = 0; obj.common.min = 0; obj.common.unit = ''; setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); }); var id = path + 'D_C_4_3'; var obj = {}; obj.type = 'state'; obj.common = {}; obj.common.name = 'Startzeit Regeneration' ; obj.common.type = 'string'; obj.common.role = 'string'; obj.common.desc = 'Startzeit Regeneration'; obj.common.read = true; obj.common.write = true; obj.common.def = 0; obj.common.min = 0; obj.common.unit = 'Uhr'; setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); }); var id = path + 'D_C_7_1'; var obj = {}; obj.type = 'state'; obj.common = {}; obj.common.name = 'Soll Service Intervalldauer' ; obj.common.type = 'number'; obj.common.role = 'number'; obj.common.desc = 'Soll Service Intervalldauer'; obj.common.read = true; obj.common.write = true; obj.common.def = 0; obj.common.min = 0; obj.common.unit = 'Tage'; setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); }); var id = path + 'D_A_2_2'; var obj = {}; obj.type = 'state'; obj.common = {}; obj.common.name = 'Tage bis zur nächsten Wartung' ; obj.common.type = 'number'; obj.common.role = 'number'; obj.common.desc = 'Tage bis zur nächsten Wartung'; obj.common.read = true; obj.common.write = true; obj.common.def = 0; obj.common.min = 0; obj.common.unit = 'Tage'; setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); }); var id = path + 'D_Y_5'; var obj = {}; obj.type = 'state'; obj.common = {}; obj.common.name = 'Aktueller Regenerationsschritt 0= keine Regeneration 1= Soletank füllen 2= Besalzen 3= Verdrängen 4= Rückspülen 5= Erstfiltrat' ; obj.common.type = 'number'; obj.common.role = 'number'; obj.common.desc = 'Aktueller Regenerationsschritt 0= keine Regeneration 1= Soletank füllen 2= Besalzen 3= Verdrängen 4= Rückspülen 5= Erstfiltrat'; obj.common.read = true; obj.common.write = true; obj.common.def = 0; obj.common.min = 0; obj.common.unit = ''; setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); }); var id = path + 'D_Y_7'; var obj = {}; obj.type = 'state'; obj.common = {}; obj.common.name = 'Inbetriebnahme-Datum' ; obj.common.type = 'string'; obj.common.role = 'string'; obj.common.desc = 'Inbetriebnahme-Datum'; obj.common.read = true; obj.common.write = true; obj.common.def = 0; obj.common.min = 0; obj.common.unit = ''; setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); }); var id = path + 'D_Y_8_11'; var obj = {}; obj.type = 'state'; obj.common = {}; obj.common.name = 'Ergebnis letzter E-Mail Versand 0=keine Mail versandt 1=Mail erfolgreich versandt 2=Benutzerdaten fehlerhaft 3= kein Internetzugang/Server nicht bereit' ; obj.common.type = 'number'; obj.common.role = 'number'; obj.common.desc = 'Ergebnis letzter E-Mail Versand 0=keine Mail versandt 1=Mail erfolgreich versandt 2=Benutzerdaten fehlerhaft 3= kein Internetzugang/Server nicht bereit'; obj.common.read = true; obj.common.write = true; obj.common.def = 0; obj.common.min = 0; obj.common.unit = ''; setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); }); var id = path + 'D_Y_10_1'; var obj = {}; obj.type = 'state'; obj.common = {}; obj.common.name = 'Aktuelle Restkapazität Austauscher' ; obj.common.type = 'number'; obj.common.role = 'number'; obj.common.desc = 'Aktuelle Restkapazität Austauscher'; obj.common.read = true; obj.common.write = true; obj.common.def = 0; obj.common.min = 0; obj.common.unit = '%'; setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); }); var id = path + 'D_Y_13'; var obj = {}; obj.type = 'state'; obj.common = {}; obj.common.name = '0= Austauscher gestört/in Regeneration 1= Austauscher in Betrieb' ; obj.common.type = 'number'; obj.common.role = 'number'; obj.common.desc = '0= Austauscher gestört/in Regeneration 1= Austauscher in Betrieb'; obj.common.read = true; obj.common.write = true; obj.common.def = 0; obj.common.min = 0; obj.common.unit = ''; setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); }); var id = path + 'D_Y_14'; var obj = {}; obj.type = 'state'; obj.common = {}; obj.common.name = 'Voraussichtliche nächste Regeneration' ; obj.common.type = 'string'; obj.common.role = 'string'; obj.common.desc = 'Voraussichtliche nächste Regeneration'; obj.common.read = true; obj.common.write = true; obj.common.def = 0; obj.common.min = 0; obj.common.unit = ''; setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); });
//region D_B_1 Regeneration
var id = path + 'D_B_1';
var obj = {};
obj.type = 'state';
obj.common = {};
obj.common.name = 'Regeneration aktiv' ;
obj.common.type = 'number';
obj.common.role = 'number';
obj.common.desc = 'Regeneration aktiv';
obj.common.read = true;
obj.common.write = true;
obj.common.def = 0;
obj.common.min = 0;
obj.common.unit = '';setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); });
// Aktualwerte
var path = 'Messwerte.0.SC18.Aktualwerte.';! //region D_A_1_1
var id = path + 'D_A_1_1';
var obj = {};
obj.type = 'state';
obj.common = {};
obj.common.name = 'Aktueller Durchfluss' ;
obj.common.type = 'number';
obj.common.role = 'number';
obj.common.desc = 'Aktueller Durchfluss';
obj.common.read = true;
obj.common.write = true;
obj.common.def = 0;
obj.common.min = 0;
obj.common.unit = 'm³/h';setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); });
//endregion D_A_1_1
! //region D_A_1_2
! var id = path + 'D_A_1_2';
var obj = {};
obj.type = 'state';
obj.common = {};
obj.common.name = 'Restkapazität' ;
obj.common.type = 'number';
obj.common.role = 'number';
obj.common.desc = 'Restkapazität';
obj.common.read = true;
obj.common.write = true;
obj.common.def = 0;
obj.common.min = 0;
obj.common.unit = 'm³*°dH';setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); });
//endregion
//region D_A_1_3
var id = path + 'D_A_1_3';
var obj = {};
obj.type = 'state';
obj.common = {};
obj.common.name = 'Kapazitätszahl' ;
obj.common.type = 'number';
obj.common.role = 'number';
obj.common.desc = 'Kapazitätszahl';
obj.common.read = true;
obj.common.write = true;
obj.common.def = 0;
obj.common.min = 0;
obj.common.unit = 'm³*°dH';setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); });
! //endregion
! //region D_A_2_1
! var id = path + 'D_A_2_1';
var obj = {};
obj.type = 'state';
obj.common = {};
obj.common.name = 'Restzeit/-menge Reg.Schritt' ;
obj.common.type = 'number';
obj.common.role = 'number';
obj.common.desc = 'Restzeit/-menge Reg.Schritt';
obj.common.read = true;
obj.common.write = true;
obj.common.def = 0;
obj.common.min = 0;
obj.common.unit = 'l oder min';setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); });
! //endregion
! //region D_A_3_1
! var id = path + 'D_A_3_1';
var obj = {};
obj.type = 'state';
obj.common = {};
obj.common.name = 'Letzte Regeneration' ;
obj.common.type = 'string';
obj.common.role = 'string';
obj.common.desc = 'Letzte Regeneration vor x h';
obj.common.read = true;
obj.common.write = true;
obj.common.def = 0;
obj.common.min = 0;
obj.common.unit = 'h';setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); });
//endregion
! //region D_A_3_2
var id = path + 'D_A_3_2'; var obj = {}; obj.type = 'state'; obj.common = {}; obj.common.name = 'Letzte Regeneration Über' ; obj.common.type = 'number'; obj.common.role = 'number'; obj.common.desc = 'Letzte Regeneration Über'; obj.common.read = true; obj.common.write = true; obj.common.def = 0; obj.common.min = 0; obj.common.unit = '%'; setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); });
//endregion
! ````
// Logger
! ````
// Wichtige Daten hier anpassen
// V1.0: Erstellung
// V1.1: Header mit Konstanten hinzu;
// Verbindungsüberwachung hinzu;
// V1.2: Datum auslesen entfernt
// Sommer/Winterzeit auslesen entfernt
! // Hier IP Adresse der Anlage eintragen
var constIP = "192.168.0.132"
// Hier Namen der State Variable eintragen wenn Verbindung über Ping Adapter geprüft werden soll
// Wenn kein Ping Adapter verwendet werden soll dan True eintragen
var statePingAdapter = 'ping.0.matthias-SS15HT.192_168_0_132'/192 168 0 132/
// Hier Abfragezyklus in Sekunden eintragen
var constTick = 5
! var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
! var parser = require('xmldom').DOMParser;
! var xhr = new XMLHttpRequest();
var requestNumber = 1 ;
! xhr.onload = function () { };
xhr.onerror = function () { };
! var varInterval = setInterval(Interval, constTick * 1000 );
! function Interval() {
! var conection = getState(statePingAdapter)
//console.log(co.val);
if (conection.val)
{
! xhr.open("POST","http://" + constIP + "/mux_http");
xhr.setRequestHeader("Content-type", "application/json");
xhr.responseType = "document";
! switch(requestNumber) {
case 1:
//console.log('Request ' + requestNumber + ' ausgeführt');
xhr.send("id=8871&show=D_Y_2_1|D_Y_2_2|D_Y_2_3|D_Y_2_4|D_Y_2_5|D_Y_2_6|D_Y_2_7|D_Y_2_8|D_Y_2_9|D_Y_2_10|D_Y_2_11|D_Y_2_12|D_Y_2_13|D_Y_2_14~");
xhr.onreadystatechange = function()
{
if (xhr.readyState==4)
{
if (xhr.status == 200)
{
if (xhr.responseText)
{
var str = xhr.responseText;const regex = /<data>`([^\<]+)<\/code><d_y_2_1>([^\<]+)<\/D_Y_2_1><d_y_2_2>([^\<]+)<\/D_Y_2_2><d_y_2_3>([^\<]+)<\/D_Y_2_3><d_y_2_4>([^\<]+)<\/D_Y_2_4><d_y_2_5>([^\<]+)<\/D_Y_2_5><d_y_2_6>([^\<]+)<\/D_Y_2_6><d_y_2_7>([^\<]+)<\/D_Y_2_7><d_y_2_8>([^\<]+)<\/D_Y_2_8><d_y_2_9>([^\<]+)<\/D_Y_2_9><d_y_2_10>([^\<]+)<\/D_Y_2_10><d_y_2_11>([^\<]+)<\/D_Y_2_11><d_y_2_12>([^\<]+)<\/D_Y_2_12><d_y_2_13>([^\<]+)<\/D_Y_2_13><d_y_2_14>([^\<]+)<\/D_Y_2_14><\/data>/; const subst = regex.exec(str); if (subst) { for ( i = 1; i < 15; i++ ) { i1 = i + 1; if (i < 10) setState("Messwerte.0.SC18.Wasserverbrauch.D_Y_2_0" + i , parseInt(subst[i1]) ); else setState("Messwerte.0.SC18.Wasserverbrauch.D_Y_2_" + i , parseInt(subst[i1]) ); } } requestNumber = 2; } } } }; break; case 2: //console.log('Request ' + requestNumber + ' ausgeführt'); xhr.send("id=8871&show=D_C_4_1|D_C_4_2|D_C_4_3|D_C_5_1|D_C_7_1~"); xhr.onreadystatechange = function() { if (xhr.readyState==4) { if (xhr.status == 200) { if (xhr.responseText) { var str = xhr.responseText; const regex = /<data>`([^\<]+)<\/code><d_c_4_1>([^\<]+)<\/D_C_4_1><d_c_4_2>([^\<]+)<\/D_C_4_2><d_c_4_3>([^\<]+)<\/D_C_4_3><d_c_5_1>([^\<]+)<\/D_C_5_1><d_c_7_1>([^\<]+)<\/D_C_7_1><\/data>/; const subst = regex.exec(str); if (subst) { setState("Messwerte.0.SC18.Allgemein.D_C_4_1" , parseInt(subst[2]) ); setState("Messwerte.0.SC18.Allgemein.D_C_4_2" , subst[3] ); setState("Messwerte.0.SC18.Allgemein.D_C_4_3" , subst[4] ); setState("Messwerte.0.SC18.Allgemein.D_C_5_1" , parseInt(subst[5]) ); setState("Messwerte.0.SC18.Allgemein.D_C_7_1" , parseInt(subst[6]) ); } requestNumber = 3; } } } }; break; case 3: //console.log('Request ' + requestNumber + ' ausgeführt'); xhr.send("id=8871&show=D_Y_4_1|D_Y_4_2|D_Y_4_3|D_Y_4_4|D_Y_4_5|D_Y_4_6|D_Y_4_7|D_Y_4_8|D_Y_4_9|D_Y_4_10|D_Y_4_11|D_Y_4_12|D_Y_4_13|D_Y_4_14~"); xhr.onreadystatechange = function() { if (xhr.readyState==4) { if (xhr.status == 200) { if (xhr.responseText) { var str = xhr.responseText; const regex = /<data>`([^\<]+)<\/code><d_y_4_1>([^\<]+)<\/D_Y_4_1><d_y_4_2>([^\<]+)<\/D_Y_4_2><d_y_4_3>([^\<]+)<\/D_Y_4_3><d_y_4_4>([^\<]+)<\/D_Y_4_4><d_y_4_5>([^\<]+)<\/D_Y_4_5><d_y_4_6>([^\<]+)<\/D_Y_4_6><d_y_4_7>([^\<]+)<\/D_Y_4_7><d_y_4_8>([^\<]+)<\/D_Y_4_8><d_y_4_9>([^\<]+)<\/D_Y_4_9><d_y_4_10>([^\<]+)<\/D_Y_4_10><d_y_4_11>([^\<]+)<\/D_Y_4_11><d_y_4_12>([^\<]+)<\/D_Y_4_12><d_y_4_13>([^\<]+)<\/D_Y_4_13><d_y_4_14>([^\<]+)<\/D_Y_4_14><\/data>/; const subst = regex.exec(str); if (subst) { for ( i = 1; i < 15; i++ ) { i1 = i + 1; if (i < 10) setState("Messwerte.0.SC18.Regenerationen.D_Y_4_0" + i , subst[i1] ); else setState("Messwerte.0.SC18.Regenerationen.D_Y_4_" + i , subst[i1] ); } requestNumber = 4; } } } } }; break; case 4: //console.log('Request ' + requestNumber + ' ausgeführt'); xhr.send("id=8871&show=D_Y_5|D_Y_7|D_Y_8_11|D_Y_10_1|D_Y_13|D_Y_14|D_B_1|D_C_5_1~"); xhr.onreadystatechange = function() { if (xhr.readyState==4) { if (xhr.status == 200) { if (xhr.responseText) { var str = xhr.responseText; const regex = /<data>`([^\<]+)<\/code><d_y_5>([^\<]+)<\/D_Y_5><d_y_7>([^\<]+)<\/D_Y_7><d_y_8_11>([^\<]+)<\/D_Y_8_11><d_y_10_1>([^\<]+)<\/D_Y_10_1><d_y_13>([^\<]+)<\/D_Y_13><d_y_14>([^\<]+)<\/D_Y_14><d_b_1>([^\<]+)<\/D_B_1><d_c_5_1>([^\<]+)<\/D_C_5_1><\/data>/; const subst = regex.exec(str); if (subst) { setState("Messwerte.0.SC18.Allgemein.D_Y_5" , parseInt(subst[2]) ); setState("Messwerte.0.SC18.Allgemein.D_Y_7" , subst[3] ); setState("Messwerte.0.SC18.Allgemein.D_Y_8_11" , parseInt(subst[4]) ); setState("Messwerte.0.SC18.Allgemein.D_Y_10_1" , parseInt(subst[5]) ); setState("Messwerte.0.SC18.Allgemein.D_Y_13" , parseInt(subst[6]) ); setState("Messwerte.0.SC18.Allgemein.D_Y_14" , subst[7] ); setState("Messwerte.0.SC18.Allgemein.D_B_1" , parseInt(subst[8]) ); setState("Messwerte.0.SC18.Allgemein.D_C_5_1" , parseInt(subst[9]) ); } requestNumber = 5; } } } }; break; case 5: //console.log('Request ' + requestNumber + ' ausgeführt'); xhr.send("id=8871&show=D_A_1_1|D_A_1_2|D_A_1_3|D_A_2_1|D_A_3_1|D_A_3_2~"); xhr.onreadystatechange = function() { if (xhr.readyState==4) { if (xhr.status == 200) { if (xhr.responseText) { var str = xhr.responseText; const regex = /<data>`([^\<]+)<\/code><d_a_1_1>([^\<]+)<\/D_A_1_1><d_a_1_2>([^\<]+)<\/D_A_1_2><d_a_1_3>([^\<]+)<\/D_A_1_3><d_a_2_1>([^\<]+)<\/D_A_2_1><d_a_3_1>([^\<]+)<\/D_A_3_1><d_a_3_2>([^\<]+)<\/D_A_3_2><\/data>/; const subst = regex.exec(str); if (subst) { setState("Messwerte.0.SC18.Aktualwerte.D_A_1_1" , parseFloat(subst[2]) ); setState("Messwerte.0.SC18.Aktualwerte.D_A_1_2" , parseFloat(subst[3]) ); setState("Messwerte.0.SC18.Aktualwerte.D_A_1_3" , parseFloat(subst[4]) ); setState("Messwerte.0.SC18.Aktualwerte.D_A_2_1" , parseInt(subst[5]) ); setState("Messwerte.0.SC18.Aktualwerte.D_A_3_1" , subst[6] ); setState("Messwerte.0.SC18.Aktualwerte.D_A_3_2" , parseInt(subst[7]) ); } requestNumber = 1; } } } };
}
}
}</d_a_3_2></d_a_3_1></d_a_2_1></d_a_1_3></d_a_1_2></d_a_1_1></data></d_c_5_1></d_b_1></d_y_14></d_y_13></d_y_10_1></d_y_8_11></d_y_7></d_y_5>
</data></d_y_4_14></d_y_4_13></d_y_4_12></d_y_4_11></d_y_4_10></d_y_4_9></d_y_4_8></d_y_4_7></d_y_4_6></d_y_4_5></d_y_4_4></d_y_4_3></d_y_4_2></d_y_4_1></data></d_c_7_1></d_c_5_1></d_c_4_3></d_c_4_2></d_c_4_1>
</data></d_y_2_14></d_y_2_13></d_y_2_12></d_y_2_11></d_y_2_10></d_y_2_9></d_y_2_8></d_y_2_7></d_y_2_6></d_y_2_5></d_y_2_4></d_y_2_3></d_y_2_2></d_y_2_1>`</data>
```` ``Folgende zusätzliche NPM Module sind bei mir hinzugefügt:xmlhttprequest,xml,jquery,xml2js,xmldom,regex
Folgende Adapter sollten aktiv sein:
Parser
Ping
Vlt. Hilft das jemanden. :D``
-
Hey hiasii12,
ich habe heut auch eine Grünbeck SC18 erhalten und gleich dein Skript getestet.
Habe die IP Adresse eingetragen, leider kommen folgende Fehler im LOG:
javascript.0 2018-10-24 20:44:49.250 error at Object.Interval (script.js.common.logger:16:5)
javascript.0 2018-10-24 20:44:49.249 error at setRequestHeader (/opt/iobroker/node_modules/iobroker.javascript/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:201:13)
javascript.0 2018-10-24 20:44:49.248 error Error in callback: Error: INVALID_STATE_ERR: send flag is true
javascript.0 2018-10-24 20:44:46.246 error at Object.Interval (script.js.common.logger:16:5)
javascript.0 2018-10-24 20:44:46.246 error at setRequestHeader (/opt/iobroker/node_modules/iobroker.javascript/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:201:13)
javascript.0 2018-10-24 20:44:46.244 error Error in callback: Error: INVALID_STATE_ERR: send flag is true
Ordnerstruktur wird erstellt, doch ist alles leer bei den Werten.
Was mache ich falsch?
-
Hast du die betreffenden NPM Module aktiviert?
-
Ja, hab die hier alles in den Javascript Adapter eingetragen
xmlhttprequest,xml,jquery,xml2js,xmldom,regex
Gesendet von meinem BND-L21 mit Tapatalk
-
so, nun läufts hatte versehentlich in der IP Adresse einen / zu viel…
Datenpunkte werden nun fleisig befüllt, doch leider kommen noch ein Fehler... sollte vermutlich nicht sein oder?
21:09:35.687 [info] javascript.0 script.js.common.logger: Request 2 ausgeführt
21:09:37.688 [warn] javascript.0 at Interval.xhr.onreadystatechange (script.js.common.logger:72:33)
21:09:37.690 [warn] javascript.0 at Interval.xhr.onreadystatechange (script.js.common.logger:74:33)
21:09:38.691 [info] javascript.0 script.js.common.logger: Request 3 ausgeführt
21:09:41.694 [error] javascript.0 at Object.Interval (script.js.common.logger:16:5)
21:09:44.696 [info] javascript.0 script.js.common.logger: Request 3 ausgeführt
21:09:47.700 [info] javascript.0 script.js.common.logger: Request 4 ausgeführt
21:09:50.702 [info] javascript.0 script.js.common.logger: Request 5 ausgeführt
21:09:53.709 [error] javascript.0 at Object.Interval (script.js.common.logger:16:5)
21:09:56.711 [info] javascript.0 script.js.common.logger: Request 5 ausgeführt
21:09:59.715 [error] javascript.0 at Object.Interval (script.js.common.logger:16:5)
21:10:02.718 [info] javascript.0 script.js.common.logger: Request 5 ausgeführt
21:10:05.723 [info] javascript.0 script.js.common.logger: Request 1 ausgeführt
21:10:08.729 [error] javascript.0 at Object.Interval (script.js.common.logger:16:5)
21:10:11.731 [info] javascript.0 script.js.common.logger: Request 1 ausgeführt
-
leider kenne ich mich mit javascript bisher noch gar nicht aus…
was bedeutet den der fehler?
16:20:07.535 [error] javascript.0 at Object.Interval (script.js.common.logger:16:5)
bzw im log steht folgendes:
javascript.0 2018-10-28 17:09:38.484 error at Object.Interval (script.js.common.logger:16:5)
javascript.0 2018-10-28 17:09:38.484 error at setRequestHeader (/opt/iobroker/node_modules/iobroker.javascript/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:201:13)
javascript.0 2018-10-28 17:09:38.483 error Error in callback: Error: INVALID_STATE_ERR: send flag is true
-
Hallo Leute,
ich habe auch eine Grünbeck SC18.
Leider verstehe ich ioBroker zur Zeit so mal gar nicht…..
Wie seid ihr vorgegangen um die Daten final im Viewer zu sehen? (Grünbeck SC18)
welches Widget und was wo eingetragen?
-
Hey Hallo,
kann mir jemand genau erklären wo in iobroker ich das alles eingeben muss ?
Habe auch eine Grünbeck und bin Anfänger.
Vielen Dank
Hallo Leute,
Da bei mir die vorhergehenden Lösungen nicht funktionierten hier mein Code der durch sehr viel Testen entstanden ist.
Mein Lösungsweg führt über die RegEx Funktion da ich es nicht geschafft habe einen XML Response zu erhalten.
// StateMaschine
! ````
// Wasserverbrauch
var path = 'Messwerte.0.SC18.Wasserverbrauch.';
! for ( i = 1; i < 15; i++ ) {
if (i<10)var id = path + 'D_Y_2_0' + i;
else var id = path + 'D_Y_2_' + i ;
! var obj = {};
obj.type = 'state';
obj.common = {};
obj.common.name = 'Wasserverbrauch vor ' + i + ' Tagen' ;
obj.common.type = 'number';
obj.common.role = 'number';
obj.common.desc = 'Wasserverbrauch vor ' + i + ' Tagen';
obj.common.read = true;
obj.common.write = true;
obj.common.def = 0;
obj.common.min = 0;
obj.common.unit = 'Liter';setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); });
! }
! // Regenerationen
var path = 'Messwerte.0.SC18.Regenerationen.';for ( i = 1; i < 15; i++ ) {
if (i<10)var id = path + 'D_Y_4_0' + i;
else var id = path + 'D_Y_4_' + i ;! var obj = {};
obj.type = 'state';
obj.common = {};
obj.common.name = 'Prozentsatz Regenereation ' + i + 'vor aktueller';
obj.common.type = 'string';
obj.common.role = 'string';
obj.common.desc = 'Prozentsatz Regenereation ' + i + 'vor aktueller';
obj.common.read = true;
obj.common.write = true;
obj.common.def = 0;
obj.common.min = 0;
obj.common.unit = '';setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); });
! }
! // Allgemeine Felder
var path = 'Messwerte.0.SC18.Allgemein.';
! var id = path + 'D_C_4_2';
var obj = {};
obj.type = 'state';
obj.common = {};
obj.common.name = 'Uhrzeit' ;
obj.common.type = 'string';
obj.common.role = 'string';
obj.common.desc = 'Uhrzeit';
obj.common.read = true;
obj.common.write = true;
obj.common.def = 0;
obj.common.min = 0;
obj.common.unit = 'Uhr';setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); }); var id = path + 'D_C_5_1'; var obj = {}; obj.type = 'state'; obj.common = {}; obj.common.name = 'Ansprechverhalten' ; obj.common.type = 'number'; obj.common.role = 'number'; obj.common.desc = 'Ansprechverhalten'; obj.common.read = true; obj.common.write = true; obj.common.def = 0; obj.common.min = 0; obj.common.unit = ''; setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); }); var id = path + 'D_C_5_2'; var obj = {}; obj.type = 'state'; obj.common = {}; obj.common.name = 'Datum' ; obj.common.type = 'String'; obj.common.role = 'String'; obj.common.desc = 'Datum'; obj.common.read = true; obj.common.write = true; obj.common.def = 0; obj.common.min = 0; obj.common.unit = ''; setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); }); var id = path + 'D_C_5_3'; var obj = {}; obj.type = 'state'; obj.common = {}; obj.common.name = 'Sommer/Winterzeit' ; obj.common.type = 'number'; obj.common.role = 'number'; obj.common.desc = 'Sommer/Winterzeit'; obj.common.read = true; obj.common.write = true; obj.common.def = 0; obj.common.min = 0; obj.common.unit = ''; setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); }); var id = path + 'D_F_1'; var obj = {}; obj.type = 'state'; obj.common = {}; obj.common.name = 'Regenerationszeitpunkt' ; obj.common.type = 'number'; obj.common.role = 'number'; obj.common.desc = 'Regenerationszeitpunkt 0= Auto 1= Fest'; obj.common.read = true; obj.common.write = true; obj.common.def = 0; obj.common.min = 0; obj.common.unit = ''; setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); }); var id = path + 'D_C_4_3'; var obj = {}; obj.type = 'state'; obj.common = {}; obj.common.name = 'Startzeit Regeneration' ; obj.common.type = 'string'; obj.common.role = 'string'; obj.common.desc = 'Startzeit Regeneration'; obj.common.read = true; obj.common.write = true; obj.common.def = 0; obj.common.min = 0; obj.common.unit = 'Uhr'; setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); }); var id = path + 'D_C_7_1'; var obj = {}; obj.type = 'state'; obj.common = {}; obj.common.name = 'Soll Service Intervalldauer' ; obj.common.type = 'number'; obj.common.role = 'number'; obj.common.desc = 'Soll Service Intervalldauer'; obj.common.read = true; obj.common.write = true; obj.common.def = 0; obj.common.min = 0; obj.common.unit = 'Tage'; setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); }); var id = path + 'D_A_2_2'; var obj = {}; obj.type = 'state'; obj.common = {}; obj.common.name = 'Tage bis zur nächsten Wartung' ; obj.common.type = 'number'; obj.common.role = 'number'; obj.common.desc = 'Tage bis zur nächsten Wartung'; obj.common.read = true; obj.common.write = true; obj.common.def = 0; obj.common.min = 0; obj.common.unit = 'Tage'; setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); }); var id = path + 'D_Y_5'; var obj = {}; obj.type = 'state'; obj.common = {}; obj.common.name = 'Aktueller Regenerationsschritt 0= keine Regeneration 1= Soletank füllen 2= Besalzen 3= Verdrängen 4= Rückspülen 5= Erstfiltrat' ; obj.common.type = 'number'; obj.common.role = 'number'; obj.common.desc = 'Aktueller Regenerationsschritt 0= keine Regeneration 1= Soletank füllen 2= Besalzen 3= Verdrängen 4= Rückspülen 5= Erstfiltrat'; obj.common.read = true; obj.common.write = true; obj.common.def = 0; obj.common.min = 0; obj.common.unit = ''; setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); }); var id = path + 'D_Y_7'; var obj = {}; obj.type = 'state'; obj.common = {}; obj.common.name = 'Inbetriebnahme-Datum' ; obj.common.type = 'string'; obj.common.role = 'string'; obj.common.desc = 'Inbetriebnahme-Datum'; obj.common.read = true; obj.common.write = true; obj.common.def = 0; obj.common.min = 0; obj.common.unit = ''; setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); }); var id = path + 'D_Y_8_11'; var obj = {}; obj.type = 'state'; obj.common = {}; obj.common.name = 'Ergebnis letzter E-Mail Versand 0=keine Mail versandt 1=Mail erfolgreich versandt 2=Benutzerdaten fehlerhaft 3= kein Internetzugang/Server nicht bereit' ; obj.common.type = 'number'; obj.common.role = 'number'; obj.common.desc = 'Ergebnis letzter E-Mail Versand 0=keine Mail versandt 1=Mail erfolgreich versandt 2=Benutzerdaten fehlerhaft 3= kein Internetzugang/Server nicht bereit'; obj.common.read = true; obj.common.write = true; obj.common.def = 0; obj.common.min = 0; obj.common.unit = ''; setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); }); var id = path + 'D_Y_10_1'; var obj = {}; obj.type = 'state'; obj.common = {}; obj.common.name = 'Aktuelle Restkapazität Austauscher' ; obj.common.type = 'number'; obj.common.role = 'number'; obj.common.desc = 'Aktuelle Restkapazität Austauscher'; obj.common.read = true; obj.common.write = true; obj.common.def = 0; obj.common.min = 0; obj.common.unit = '%'; setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); }); var id = path + 'D_Y_13'; var obj = {}; obj.type = 'state'; obj.common = {}; obj.common.name = '0= Austauscher gestört/in Regeneration 1= Austauscher in Betrieb' ; obj.common.type = 'number'; obj.common.role = 'number'; obj.common.desc = '0= Austauscher gestört/in Regeneration 1= Austauscher in Betrieb'; obj.common.read = true; obj.common.write = true; obj.common.def = 0; obj.common.min = 0; obj.common.unit = ''; setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); }); var id = path + 'D_Y_14'; var obj = {}; obj.type = 'state'; obj.common = {}; obj.common.name = 'Voraussichtliche nächste Regeneration' ; obj.common.type = 'string'; obj.common.role = 'string'; obj.common.desc = 'Voraussichtliche nächste Regeneration'; obj.common.read = true; obj.common.write = true; obj.common.def = 0; obj.common.min = 0; obj.common.unit = ''; setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); });
//region D_B_1 Regeneration
var id = path + 'D_B_1';
var obj = {};
obj.type = 'state';
obj.common = {};
obj.common.name = 'Regeneration aktiv' ;
obj.common.type = 'number';
obj.common.role = 'number';
obj.common.desc = 'Regeneration aktiv';
obj.common.read = true;
obj.common.write = true;
obj.common.def = 0;
obj.common.min = 0;
obj.common.unit = '';setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); });
// Aktualwerte
var path = 'Messwerte.0.SC18.Aktualwerte.';! //region D_A_1_1
var id = path + 'D_A_1_1';
var obj = {};
obj.type = 'state';
obj.common = {};
obj.common.name = 'Aktueller Durchfluss' ;
obj.common.type = 'number';
obj.common.role = 'number';
obj.common.desc = 'Aktueller Durchfluss';
obj.common.read = true;
obj.common.write = true;
obj.common.def = 0;
obj.common.min = 0;
obj.common.unit = 'm³/h';setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); });
//endregion D_A_1_1
! //region D_A_1_2
! var id = path + 'D_A_1_2';
var obj = {};
obj.type = 'state';
obj.common = {};
obj.common.name = 'Restkapazität' ;
obj.common.type = 'number';
obj.common.role = 'number';
obj.common.desc = 'Restkapazität';
obj.common.read = true;
obj.common.write = true;
obj.common.def = 0;
obj.common.min = 0;
obj.common.unit = 'm³*°dH';setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); });
//endregion
//region D_A_1_3
var id = path + 'D_A_1_3';
var obj = {};
obj.type = 'state';
obj.common = {};
obj.common.name = 'Kapazitätszahl' ;
obj.common.type = 'number';
obj.common.role = 'number';
obj.common.desc = 'Kapazitätszahl';
obj.common.read = true;
obj.common.write = true;
obj.common.def = 0;
obj.common.min = 0;
obj.common.unit = 'm³*°dH';setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); });
! //endregion
! //region D_A_2_1
! var id = path + 'D_A_2_1';
var obj = {};
obj.type = 'state';
obj.common = {};
obj.common.name = 'Restzeit/-menge Reg.Schritt' ;
obj.common.type = 'number';
obj.common.role = 'number';
obj.common.desc = 'Restzeit/-menge Reg.Schritt';
obj.common.read = true;
obj.common.write = true;
obj.common.def = 0;
obj.common.min = 0;
obj.common.unit = 'l oder min';setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); });
! //endregion
! //region D_A_3_1
! var id = path + 'D_A_3_1';
var obj = {};
obj.type = 'state';
obj.common = {};
obj.common.name = 'Letzte Regeneration' ;
obj.common.type = 'string';
obj.common.role = 'string';
obj.common.desc = 'Letzte Regeneration vor x h';
obj.common.read = true;
obj.common.write = true;
obj.common.def = 0;
obj.common.min = 0;
obj.common.unit = 'h';setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); });
//endregion
! //region D_A_3_2
var id = path + 'D_A_3_2'; var obj = {}; obj.type = 'state'; obj.common = {}; obj.common.name = 'Letzte Regeneration Über' ; obj.common.type = 'number'; obj.common.role = 'number'; obj.common.desc = 'Letzte Regeneration Über'; obj.common.read = true; obj.common.write = true; obj.common.def = 0; obj.common.min = 0; obj.common.unit = '%'; setObject(id, obj, function(err) { if(err) log('Cannot write object: ' + err); else setState(id, obj.common.def); });
//endregion
! ````
// Logger
! ````
var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
! var parser = require('xmldom').DOMParser;
! var xhr = new XMLHttpRequest();
var requestNumber = 1 ;
! xhr.onload = function () { };
xhr.onerror = function () { };
! var varInterval = setInterval(Interval, 3000);
! function Interval() {xhr.open("POST","http://[IP-der-Anlage-Einfügen]/mux_http");
xhr.setRequestHeader("Content-type", "application/json");
xhr.responseType = "document";! switch(requestNumber) {
case 1:
console.log('Request ' + requestNumber + ' ausgeführt');
xhr.send("id=8871&show=D_Y_2_1|D_Y_2_2|D_Y_2_3|D_Y_2_4|D_Y_2_5|D_Y_2_6|D_Y_2_7|D_Y_2_8|D_Y_2_9|D_Y_2_10|D_Y_2_11|D_Y_2_12|D_Y_2_13|D_Y_2_14~");
xhr.onreadystatechange = function()
{
if (xhr.readyState==4)
{
if (xhr.status == 200)
{
if (xhr.responseText)
{
var str = xhr.responseText;const regex = /<data>`([^\<]+)<\/code><d_y_2_1>([^\<]+)<\/D_Y_2_1><d_y_2_2>([^\<]+)<\/D_Y_2_2><d_y_2_3>([^\<]+)<\/D_Y_2_3><d_y_2_4>([^\<]+)<\/D_Y_2_4><d_y_2_5>([^\<]+)<\/D_Y_2_5><d_y_2_6>([^\<]+)<\/D_Y_2_6><d_y_2_7>([^\<]+)<\/D_Y_2_7><d_y_2_8>([^\<]+)<\/D_Y_2_8><d_y_2_9>([^\<]+)<\/D_Y_2_9><d_y_2_10>([^\<]+)<\/D_Y_2_10><d_y_2_11>([^\<]+)<\/D_Y_2_11><d_y_2_12>([^\<]+)<\/D_Y_2_12><d_y_2_13>([^\<]+)<\/D_Y_2_13><d_y_2_14>([^\<]+)<\/D_Y_2_14><\/data>/; const subst = regex.exec(str); if (subst) { for ( i = 1; i < 15; i++ ) { i1 = i + 1; if (i < 10) setState("Messwerte.0.SC18.Wasserverbrauch.D_Y_2_0" + i , parseInt(subst[i1]) ); else setState("Messwerte.0.SC18.Wasserverbrauch.D_Y_2_" + i , parseInt(subst[i1]) ); } } requestNumber = 2; } } } }; break; case 2: console.log('Request ' + requestNumber + ' ausgeführt'); xhr.send("id=8871&show=D_C_4_2|D_C_5_2|D_C_5_3|D_C_4_1|D_C_4_3|D_C_5_1|D_C_7_1~"); xhr.onreadystatechange = function() { if (xhr.readyState==4) { if (xhr.status == 200) { if (xhr.responseText) { var str = xhr.responseText; const regex = /<data>`([^\<]+)<\/code><d_c_4_2>([^\<]+)<\/D_C_4_2><d_c_5_2>([^\<]+)<\/D_C_5_2><d_c_5_3>([^\<]+)<\/D_C_5_3><d_c_4_1>([^\<]+)<\/D_C_4_1><d_c_4_3>([^\<]+)<\/D_C_4_3><d_c_5_1>([^\<]+)<\/D_C_5_1><d_c_7_1>([^\<]+)<\/D_C_7_1><\/data>/; const subst = regex.exec(str); if (subst) { setState("Messwerte.0.SC18.Allgemein.D_C_4_2" , subst[2] ); setState("Messwerte.0.SC18.Allgemein.D_C_5_2" , subst[3] ); setState("Messwerte.0.SC18.Allgemein.D_C_5_3" , parseInt(subst[4]) ); setState("Messwerte.0.SC18.Allgemein.D_C_4_1" , parseInt(subst[5]) ); setState("Messwerte.0.SC18.Allgemein.D_C_4_3" , subst[6] ); setState("Messwerte.0.SC18.Allgemein.D_C_5_1" , parseInt(subst[7]) ); setState("Messwerte.0.SC18.Allgemein.D_C_7_1" , parseInt(subst[8]) );
!
} requestNumber = 3; } } } }; break; case 3: console.log('Request ' + requestNumber + ' ausgeführt'); xhr.send("id=8871&show=D_Y_4_1|D_Y_4_2|D_Y_4_3|D_Y_4_4|D_Y_4_5|D_Y_4_6|D_Y_4_7|D_Y_4_8|D_Y_4_9|D_Y_4_10|D_Y_4_11|D_Y_4_12|D_Y_4_13|D_Y_4_14~"); xhr.onreadystatechange = function() { if (xhr.readyState==4) { if (xhr.status == 200) { if (xhr.responseText) { var str = xhr.responseText; const regex = /<data>`([^\<]+)<\/code><d_y_4_1>([^\<]+)<\/D_Y_4_1><d_y_4_2>([^\<]+)<\/D_Y_4_2><d_y_4_3>([^\<]+)<\/D_Y_4_3><d_y_4_4>([^\<]+)<\/D_Y_4_4><d_y_4_5>([^\<]+)<\/D_Y_4_5><d_y_4_6>([^\<]+)<\/D_Y_4_6><d_y_4_7>([^\<]+)<\/D_Y_4_7><d_y_4_8>([^\<]+)<\/D_Y_4_8><d_y_4_9>([^\<]+)<\/D_Y_4_9><d_y_4_10>([^\<]+)<\/D_Y_4_10><d_y_4_11>([^\<]+)<\/D_Y_4_11><d_y_4_12>([^\<]+)<\/D_Y_4_12><d_y_4_13>([^\<]+)<\/D_Y_4_13><d_y_4_14>([^\<]+)<\/D_Y_4_14><\/data>/; const subst = regex.exec(str); if (subst) { for ( i = 1; i < 15; i++ ) { i1 = i + 1; if (i < 10) setState("Messwerte.0.SC18.Regenerationen.D_Y_4_0" + i , subst[i1] ); else setState("Messwerte.0.SC18.Regenerationen.D_Y_4_" + i , subst[i1] ); } requestNumber = 4; } } } } }; break; case 4: console.log('Request ' + requestNumber + ' ausgeführt'); xhr.send("id=8871&show=D_Y_5|D_Y_7|D_Y_8_11|D_Y_10_1|D_Y_13|D_Y_14|D_B_1|D_C_5_1|D_F_1~"); xhr.onreadystatechange = function() { if (xhr.readyState==4) { if (xhr.status == 200) { if (xhr.responseText) { var str = xhr.responseText; const regex = /<data>`([^\<]+)<\/code><d_y_5>([^\<]+)<\/D_Y_5><d_y_7>([^\<]+)<\/D_Y_7><d_y_8_11>([^\<]+)<\/D_Y_8_11><d_y_10_1>([^\<]+)<\/D_Y_10_1><d_y_13>([^\<]+)<\/D_Y_13><d_y_14>([^\<]+)<\/D_Y_14><d_b_1>([^\<]+)<\/D_B_1><d_c_5_1>([^\<]+)<\/D_C_5_1><\/data>/; const subst = regex.exec(str); if (subst) { setState("Messwerte.0.SC18.Allgemein.D_Y_5" , parseInt(subst[2]) ); setState("Messwerte.0.SC18.Allgemein.D_Y_7" , subst[3] ); setState("Messwerte.0.SC18.Allgemein.D_Y_8_11" , parseInt(subst[4]) ); setState("Messwerte.0.SC18.Allgemein.D_Y_10_1" , parseInt(subst[5]) ); setState("Messwerte.0.SC18.Allgemein.D_Y_13" , parseInt(subst[6]) ); setState("Messwerte.0.SC18.Allgemein.D_Y_14" , subst[7] ); setState("Messwerte.0.SC18.Allgemein.D_B_1" , parseInt(subst[8]) ); setState("Messwerte.0.SC18.Allgemein.D_C_5_1" , parseInt(subst[9]) ); } requestNumber = 5; } } } }; break; case 5: console.log('Request ' + requestNumber + ' ausgeführt'); xhr.send("id=8871&show=D_A_1_1|D_A_1_2|D_A_1_3|D_A_2_1|D_A_3_1|D_A_3_2~"); xhr.onreadystatechange = function() { if (xhr.readyState==4) { if (xhr.status == 200) { if (xhr.responseText) { var str = xhr.responseText; const regex = /<data>`([^\<]+)<\/code><d_a_1_1>([^\<]+)<\/D_A_1_1><d_a_1_2>([^\<]+)<\/D_A_1_2><d_a_1_3>([^\<]+)<\/D_A_1_3><d_a_2_1>([^\<]+)<\/D_A_2_1><d_a_3_1>([^\<]+)<\/D_A_3_1><d_a_3_2>([^\<]+)<\/D_A_3_2><\/data>/; const subst = regex.exec(str); if (subst) { setState("Messwerte.0.SC18.Aktualwerte.D_A_1_1" , parseFloat(subst[2]) ); setState("Messwerte.0.SC18.Aktualwerte.D_A_1_2" , parseFloat(subst[3]) ); setState("Messwerte.0.SC18.Aktualwerte.D_A_1_3" , parseFloat(subst[4]) ); setState("Messwerte.0.SC18.Aktualwerte.D_A_2_1" , parseInt(subst[5]) ); setState("Messwerte.0.SC18.Aktualwerte.D_A_3_1" , subst[6] ); setState("Messwerte.0.SC18.Aktualwerte.D_A_3_2" , parseInt(subst[7]) ); } requestNumber = 1; } } } };
}
!
!}</d_a_3_2></d_a_3_1></d_a_2_1></d_a_1_3></d_a_1_2></d_a_1_1>
</data></d_c_5_1></d_b_1></d_y_14></d_y_13></d_y_10_1></d_y_8_11></d_y_7></d_y_5>
</data></d_y_4_14></d_y_4_13></d_y_4_12></d_y_4_11></d_y_4_10></d_y_4_9></d_y_4_8></d_y_4_7></d_y_4_6></d_y_4_5></d_y_4_4></d_y_4_3></d_y_4_2></d_y_4_1></data></d_c_7_1></d_c_5_1></d_c_4_3></d_c_4_1></d_c_5_3></d_c_5_2></d_c_4_2>
</data></d_y_2_14></d_y_2_13></d_y_2_12></d_y_2_11></d_y_2_10></d_y_2_9></d_y_2_8></d_y_2_7></d_y_2_6></d_y_2_5></d_y_2_4></d_y_2_3></d_y_2_2></d_y_2_1>`</data>
```` ``Folgende zusätzliche NPM Module sind bei mir hinzugefügt:xmlhttprequest,xml,jquery,xml2js,xmldom,regex
Vlt. Hilft das jemanden. :D`` `
-
Ich werde Versuchen sobald ich etwas Zeit finde hier eine Bebilderte Anleitung zu erstellen.
-
Das wäre schön, Danke
-
OK ich habe es hinbekommen, (jipiehhhh)
Ich versuche es auchmal für andere zu erklären:
es braucht die Adapter:
-Javascript
-Parser
im Javascript müssen bei als zusätzliche NPM
Module:
xmlhttprequest,xml,jquery,xml2js,xmldom,regex
eingetragen werden.
Bild1
Dann 2 Javascripte anlegen,
Script 1 der Text aus StateMaschine , siehe Post oben.
Script 2 der Text aus Logger, siehe Post oben.
ACHTUNG, anlegen der Scripte bei Namen "ohne Gruppe"
Bild 2
Script 1 legt die Datenpunkte an
Script 2 holt die Daten.
Schon tauchen die Punkte bei Objekten auf (sollten sie zumindest)
Bild 3
Jetzt im Vis Editor ein "Value" Widget einfügen und bei ID den gewünschten Wert (hier Wasserverbrauch gestern) auswählen fertig!
Bild 4
sollte ich etwas vergessen haben bitte ich die Profis es nachzutragen.
9876_java2.jpg
9876_java.jpg
9876_datendarstellen.jpg
9876_objekt.jpg -
Passt genau so.
Dann spar ich mir die Anleitung.
-
Und für alle die sich die Arbeit sparen wollen hänge ich gleich mal mein Widget export an: (unfertig)
! [{"tpl":"tplValueFloat","data":{"oid":"Messwerte.0.SC18.Wasserverbrauch.D_Y_2_01","g_fixed":false,"g_visibility":false,"g_css_font_text":true,"g_css_background":false,"g_css_shadow_padding":false,"g_css_border":false,"g_gestures":false,"g_signals":false,"g_last_change":false,"visibility-cond":"==","visibility-val":1,"visibility-groups-action":"hide","is_comma":"true","factor":"1","signals-cond-0":"==","signals-val-0":true,"signals-icon-0":"/vis/signals/lowbattery.png","signals-icon-size-0":0,"signals-blink-0":false,"signals-horz-0":0,"signals-vert-0":0,"signals-hide-edit-0":false,"signals-cond-1":"==","signals-val-1":true,"signals-icon-1":"/vis/signals/lowbattery.png","signals-icon-size-1":0,"signals-blink-1":false,"signals-horz-1":0,"signals-vert-1":0,"signals-hide-edit-1":false,"signals-cond-2":"==","signals-val-2":true,"signals-icon-2":"/vis/signals/lowbattery.png","signals-icon-size-2":0,"signals-blink-2":false,"signals-horz-2":0,"signals-vert-2":0,"signals-hide-edit-2":false,"lc-type":"last-change","lc-is-interval":true,"lc-is-moment":false,"lc-format":"","lc-position-vert":"top","lc-position-horz":"right","lc-offset-vert":0,"lc-offset-horz":0,"lc-font-size":"12px","lc-font-family":"","lc-font-style":"","lc-bkg-color":"","lc-color":"","lc-border-width":"0","lc-border-style":"","lc-border-color":"","lc-border-radius":10,"lc-zindex":0,"html_append_plural":" Liter"},"style":{"left":"325px","top":"108px","color":"#ffffff","width":"111"},"widgetSet":"basic"},{"tpl":"tplValueString","data":{"oid":"nothing_selected","g_fixed":false,"g_visibility":false,"g_css_font_text":true,"g_css_background":false,"g_css_shadow_padding":false,"g_css_border":false,"g_gestures":false,"g_signals":false,"g_last_change":false,"visibility-cond":"==","visibility-val":1,"visibility-groups-action":"hide","signals-cond-0":"==","signals-val-0":true,"signals-icon-0":"/vis/signals/lowbattery.png","signals-icon-size-0":0,"signals-blink-0":false,"signals-horz-0":0,"signals-vert-0":0,"signals-hide-edit-0":false,"signals-cond-1":"==","signals-val-1":true,"signals-icon-1":"/vis/signals/lowbattery.png","signals-icon-size-1":0,"signals-blink-1":false,"signals-horz-1":0,"signals-vert-1":0,"signals-hide-edit-1":false,"signals-cond-2":"==","signals-val-2":true,"signals-icon-2":"/vis/signals/lowbattery.png","signals-icon-size-2":0,"signals-blink-2":false,"signals-horz-2":0,"signals-vert-2":0,"signals-hide-edit-2":false,"lc-type":"last-change","lc-is-interval":true,"lc-is-moment":false,"lc-format":"","lc-position-vert":"top","lc-position-horz":"right","lc-offset-vert":0,"lc-offset-horz":0,"lc-font-size":"12px","lc-font-family":"","lc-font-style":"","lc-bkg-color":"","lc-color":"","lc-border-width":"0","lc-border-style":"","lc-border-color":"","lc-border-radius":10,"lc-zindex":0,"html_prepend":"Wasserverbrauch gestern"},"style":{"left":"123px","top":"107px","color":"#ffffff","width":"200","height":"20px"},"widgetSet":"basic"},{"tpl":"tplValueFloat","data":{"oid":"Messwerte.0.SC18.Allgemein.D_Y_13","g_fixed":false,"g_visibility":false,"g_css_font_text":true,"g_css_background":false,"g_css_shadow_padding":false,"g_css_border":false,"g_gestures":false,"g_signals":false,"g_last_change":false,"visibility-cond":"==","visibility-val":1,"visibility-groups-action":"hide","is_comma":"true","factor":"1","signals-cond-0":"==","signals-val-0":true,"signals-icon-0":"/vis/signals/lowbattery.png","signals-icon-size-0":0,"signals-blink-0":false,"signals-horz-0":0,"signals-vert-0":0,"signals-hide-edit-0":false,"signals-cond-1":"==","signals-val-1":true,"signals-icon-1":"/vis/signals/lowbattery.png","signals-icon-size-1":0,"signals-blink-1":false,"signals-horz-1":0,"signals-vert-1":0,"signals-hide-edit-1":false,"signals-cond-2":"==","signals-val-2":true,"signals-icon-2":"/vis/signals/lowbattery.png","signals-icon-size-2":0,"signals-blink-2":false,"signals-horz-2":0,"signals-vert-2":0,"signals-hide-edit-2":false,"lc-type":"last-change","lc-is-interval":true,"lc-is-moment":false,"lc-format":"","lc-position-vert":"top","lc-position-horz":"right","lc-offset-vert":0,"lc-offset-horz":0,"lc-font-size":"12px","lc-font-family":"","lc-font-style":"","lc-bkg-color":"","lc-color":"","lc-border-width":"0","lc-border-style":"","lc-border-color":"","lc-border-radius":10,"lc-zindex":0},"style":{"left":"325px","top":"188px","color":"#ffffff","width":"111"},"widgetSet":"basic"},{"tpl":"tplValueString","data":{"oid":"Messwerte.0.SC18.Allgemein.D_Y_13","g_fixed":false,"g_visibility":false,"g_css_font_text":true,"g_css_background":false,"g_css_shadow_padding":false,"g_css_border":false,"g_gestures":false,"g_signals":false,"g_last_change":false,"visibility-cond":"==","visibility-val":1,"visibility-groups-action":"hide","signals-cond-0":"==","signals-val-0":true,"signals-icon-0":"/vis/signals/lowbattery.png","signals-icon-size-0":0,"signals-blink-0":false,"signals-horz-0":0,"signals-vert-0":0,"signals-hide-edit-0":false,"signals-cond-1":"==","signals-val-1":true,"signals-icon-1":"/vis/signals/lowbattery.png","signals-icon-size-1":0,"signals-blink-1":false,"signals-horz-1":0,"signals-vert-1":0,"signals-hide-edit-1":false,"signals-cond-2":"==","signals-val-2":true,"signals-icon-2":"/vis/signals/lowbattery.png","signals-icon-size-2":0,"signals-blink-2":false,"signals-horz-2":0,"signals-vert-2":0,"signals-hide-edit-2":false,"lc-type":"last-change","lc-is-interval":true,"lc-is-moment":false,"lc-format":"","lc-position-vert":"top","lc-position-horz":"right","lc-offset-vert":0,"lc-offset-horz":0,"lc-font-size":"12px","lc-font-family":"","lc-font-style":"","lc-bkg-color":"","lc-color":"","lc-border-width":"0","lc-border-style":"","lc-border-color":"","lc-border-radius":10,"lc-zindex":0,"html_prepend":"Austauscher gestört"},"style":{"left":"123px","top":"187px","color":"#ffffff","width":"180","height":"20px"},"widgetSet":"basic"},{"tpl":"tplValueFloat","data":{"oid":"Messwerte.0.SC18.Allgemein.D_Y_13","g_fixed":false,"g_visibility":false,"g_css_font_text":true,"g_css_background":false,"g_css_shadow_padding":false,"g_css_border":false,"g_gestures":false,"g_signals":false,"g_last_change":false,"visibility-cond":"==","visibility-val":1,"visibility-groups-action":"hide","is_comma":"true","factor":"1","signals-cond-0":"==","signals-val-0":true,"signals-icon-0":"/vis/signals/lowbattery.png","signals-icon-size-0":0,"signals-blink-0":false,"signals-horz-0":0,"signals-vert-0":0,"signals-hide-edit-0":false,"signals-cond-1":"==","signals-val-1":true,"signals-icon-1":"/vis/signals/lowbattery.png","signals-icon-size-1":0,"signals-blink-1":false,"signals-horz-1":0,"signals-vert-1":0,"signals-hide-edit-1":false,"signals-cond-2":"==","signals-val-2":true,"signals-icon-2":"/vis/signals/lowbattery.png","signals-icon-size-2":0,"signals-blink-2":false,"signals-horz-2":0,"signals-vert-2":0,"signals-hide-edit-2":false,"lc-type":"last-change","lc-is-interval":true,"lc-is-moment":false,"lc-format":"","lc-position-vert":"top","lc-position-horz":"right","lc-offset-vert":0,"lc-offset-horz":0,"lc-font-size":"12px","lc-font-family":"","lc-font-style":"","lc-bkg-color":"","lc-color":"","lc-border-width":"0","lc-border-style":"","lc-border-color":"","lc-border-radius":10,"lc-zindex":0},"style":{"left":"325px","top":"208px","color":"#ffffff","width":"111"},"widgetSet":"basic"},{"tpl":"tplValueString","data":{"oid":"","g_fixed":false,"g_visibility":false,"g_css_font_text":true,"g_css_background":false,"g_css_shadow_padding":false,"g_css_border":false,"g_gestures":false,"g_signals":false,"g_last_change":false,"visibility-cond":"==","visibility-val":1,"visibility-groups-action":"hide","signals-cond-0":"==","signals-val-0":true,"signals-icon-0":"/vis/signals/lowbattery.png","signals-icon-size-0":0,"signals-blink-0":false,"signals-horz-0":0,"signals-vert-0":0,"signals-hide-edit-0":false,"signals-cond-1":"==","signals-val-1":true,"signals-icon-1":"/vis/signals/lowbattery.png","signals-icon-size-1":0,"signals-blink-1":false,"signals-horz-1":0,"signals-vert-1":0,"signals-hide-edit-1":false,"signals-cond-2":"==","signals-val-2":true,"signals-icon-2":"/vis/signals/lowbattery.png","signals-icon-size-2":0,"signals-blink-2":false,"signals-horz-2":0,"signals-vert-2":0,"signals-hide-edit-2":false,"lc-type":"last-change","lc-is-interval":true,"lc-is-moment":false,"lc-format":"","lc-position-vert":"top","lc-position-horz":"right","lc-offset-vert":0,"lc-offset-horz":0,"lc-font-size":"12px","lc-font-family":"","lc-font-style":"","lc-bkg-color":"","lc-color":"","lc-border-width":"0","lc-border-style":"","lc-border-color":"","lc-border-radius":10,"lc-zindex":0,"html_prepend":"Soletank besalzen"},"style":{"left":"123px","top":"207px","color":"#ffffff","width":"180","height":"20px"},"widgetSet":"basic"},{"tpl":"tplValueFloat","data":{"oid":"Messwerte.0.SC18.Aktualwerte.D_A_1_1","g_fixed":false,"g_visibility":false,"g_css_font_text":true,"g_css_background":false,"g_css_shadow_padding":false,"g_css_border":false,"g_gestures":false,"g_signals":false,"g_last_change":false,"visibility-cond":"==","visibility-val":1,"visibility-groups-action":"hide","is_comma":"true","factor":"1","signals-cond-0":"==","signals-val-0":true,"signals-icon-0":"/vis/signals/lowbattery.png","signals-icon-size-0":0,"signals-blink-0":false,"signals-horz-0":0,"signals-vert-0":0,"signals-hide-edit-0":false,"signals-cond-1":"==","signals-val-1":true,"signals-icon-1":"/vis/signals/lowbattery.png","signals-icon-size-1":0,"signals-blink-1":false,"signals-horz-1":0,"signals-vert-1":0,"signals-hide-edit-1":false,"signals-cond-2":"==","signals-val-2":true,"signals-icon-2":"/vis/signals/lowbattery.png","signals-icon-size-2":0,"signals-blink-2":false,"signals-horz-2":0,"signals-vert-2":0,"signals-hide-edit-2":false,"lc-type":"last-change","lc-is-interval":true,"lc-is-moment":false,"lc-format":"","lc-position-vert":"top","lc-position-horz":"right","lc-offset-vert":0,"lc-offset-horz":0,"lc-font-size":"12px","lc-font-family":"","lc-font-style":"","lc-bkg-color":"","lc-color":"","lc-border-width":"0","lc-border-style":"","lc-border-color":"","lc-border-radius":10,"lc-zindex":0},"style":{"left":"325px","top":"228px","color":"#ffffff","width":"111"},"widgetSet":"basic"},{"tpl":"tplValueString","data":{"oid":"Messwerte.0.SC18.Allgemein.D_Y_13","g_fixed":false,"g_visibility":false,"g_css_font_text":true,"g_css_background":false,"g_css_shadow_padding":false,"g_css_border":false,"g_gestures":false,"g_signals":false,"g_last_change":false,"visibility-cond":"==","visibility-val":1,"visibility-groups-action":"hide","signals-cond-0":"==","signals-val-0":true,"signals-icon-0":"/vis/signals/lowbattery.png","signals-icon-size-0":0,"signals-blink-0":false,"signals-horz-0":0,"signals-vert-0":0,"signals-hide-edit-0":false,"signals-cond-1":"==","signals-val-1":true,"signals-icon-1":"/vis/signals/lowbattery.png","signals-icon-size-1":0,"signals-blink-1":false,"signals-horz-1":0,"signals-vert-1":0,"signals-hide-edit-1":false,"signals-cond-2":"==","signals-val-2":true,"signals-icon-2":"/vis/signals/lowbattery.png","signals-icon-size-2":0,"signals-blink-2":false,"signals-horz-2":0,"signals-vert-2":0,"signals-hide-edit-2":false,"lc-type":"last-change","lc-is-interval":true,"lc-is-moment":false,"lc-format":"","lc-position-vert":"top","lc-position-horz":"right","lc-offset-vert":0,"lc-offset-horz":0,"lc-font-size":"12px","lc-font-family":"","lc-font-style":"","lc-bkg-color":"","lc-color":"","lc-border-width":"0","lc-border-style":"","lc-border-color":"","lc-border-radius":10,"lc-zindex":0,"html_prepend":"Aktueller Druchfluss"},"style":{"left":"123px","top":"227px","color":"#ffffff","width":"180","height":"20px"},"widgetSet":"basic"},{"tpl":"tplValueFloat","data":{"oid":"Messwerte.0.SC18.Aktualwerte.D_A_1_2","g_fixed":false,"g_visibility":false,"g_css_font_text":true,"g_css_background":false,"g_css_shadow_padding":false,"g_css_border":false,"g_gestures":false,"g_signals":false,"g_last_change":false,"visibility-cond":"==","visibility-val":1,"visibility-groups-action":"hide","is_comma":"true","factor":"1","signals-cond-0":"==","signals-val-0":true,"signals-icon-0":"/vis/signals/lowbattery.png","signals-icon-size-0":0,"signals-blink-0":false,"signals-horz-0":0,"signals-vert-0":0,"signals-hide-edit-0":false,"signals-cond-1":"==","signals-val-1":true,"signals-icon-1":"/vis/signals/lowbattery.png","signals-icon-size-1":0,"signals-blink-1":false,"signals-horz-1":0,"signals-vert-1":0,"signals-hide-edit-1":false,"signals-cond-2":"==","signals-val-2":true,"signals-icon-2":"/vis/signals/lowbattery.png","signals-icon-size-2":0,"signals-blink-2":false,"signals-horz-2":0,"signals-vert-2":0,"signals-hide-edit-2":false,"lc-type":"last-change","lc-is-interval":true,"lc-is-moment":false,"lc-format":"","lc-position-vert":"top","lc-position-horz":"right","lc-offset-vert":0,"lc-offset-horz":0,"lc-font-size":"12px","lc-font-family":"","lc-font-style":"","lc-bkg-color":"","lc-color":"","lc-border-width":"0","lc-border-style":"","lc-border-color":"","lc-border-radius":10,"lc-zindex":0,"html_prepend":"","html_append_plural":" m³*°dH"},"style":{"left":"325px","top":"248px","color":"#ffffff","width":"111"},"widgetSet":"basic"},{"tpl":"tplValueString","data":{"oid":"Messwerte.0.SC18.Allgemein.D_Y_13","g_fixed":false,"g_visibility":false,"g_css_font_text":true,"g_css_background":false,"g_css_shadow_padding":false,"g_css_border":false,"g_gestures":false,"g_signals":false,"g_last_change":false,"visibility-cond":"==","visibility-val":1,"visibility-groups-action":"hide","signals-cond-0":"==","signals-val-0":true,"signals-icon-0":"/vis/signals/lowbattery.png","signals-icon-size-0":0,"signals-blink-0":false,"signals-horz-0":0,"signals-vert-0":0,"signals-hide-edit-0":false,"signals-cond-1":"==","signals-val-1":true,"signals-icon-1":"/vis/signals/lowbattery.png","signals-icon-size-1":0,"signals-blink-1":false,"signals-horz-1":0,"signals-vert-1":0,"signals-hide-edit-1":false,"signals-cond-2":"==","signals-val-2":true,"signals-icon-2":"/vis/signals/lowbattery.png","signals-icon-size-2":0,"signals-blink-2":false,"signals-horz-2":0,"signals-vert-2":0,"signals-hide-edit-2":false,"lc-type":"last-change","lc-is-interval":true,"lc-is-moment":false,"lc-format":"","lc-position-vert":"top","lc-position-horz":"right","lc-offset-vert":0,"lc-offset-horz":0,"lc-font-size":"12px","lc-font-family":"","lc-font-style":"","lc-bkg-color":"","lc-color":"","lc-border-width":"0","lc-border-style":"","lc-border-color":"","lc-border-radius":10,"lc-zindex":0,"html_prepend":"Restkapazität"},"style":{"left":"123px","top":"247px","color":"#ffffff","width":"180","height":"20px"},"widgetSet":"basic"},{"tpl":"tplValueFloat","data":{"oid":"Messwerte.0.SC18.Aktualwerte.D_A_3_1","g_fixed":false,"g_visibility":false,"g_css_font_text":true,"g_css_background":false,"g_css_shadow_padding":false,"g_css_border":false,"g_gestures":false,"g_signals":false,"g_last_change":false,"visibility-cond":"==","visibility-val":1,"visibility-groups-action":"hide","is_comma":"true","factor":"1","signals-cond-0":"==","signals-val-0":true,"signals-icon-0":"/vis/signals/lowbattery.png","signals-icon-size-0":0,"signals-blink-0":false,"signals-horz-0":0,"signals-vert-0":0,"signals-hide-edit-0":false,"signals-cond-1":"==","signals-val-1":true,"signals-icon-1":"/vis/signals/lowbattery.png","signals-icon-size-1":0,"signals-blink-1":false,"signals-horz-1":0,"signals-vert-1":0,"signals-hide-edit-1":false,"signals-cond-2":"==","signals-val-2":true,"signals-icon-2":"/vis/signals/lowbattery.png","signals-icon-size-2":0,"signals-blink-2":false,"signals-horz-2":0,"signals-vert-2":0,"signals-hide-edit-2":false,"lc-type":"last-change","lc-is-interval":true,"lc-is-moment":false,"lc-format":"","lc-position-vert":"top","lc-position-horz":"right","lc-offset-vert":0,"lc-offset-horz":0,"lc-font-size":"12px","lc-font-family":"","lc-font-style":"","lc-bkg-color":"","lc-color":"","lc-border-width":"0","lc-border-style":"","lc-border-color":"","lc-border-radius":10,"lc-zindex":0},"style":{"left":"325px","top":"268px","color":"#ffffff","width":"111px"},"widgetSet":"basic"},{"tpl":"tplValueString","data":{"oid":"Messwerte.0.SC18.Allgemein.D_Y_13","g_fixed":false,"g_visibility":false,"g_css_font_text":true,"g_css_background":false,"g_css_shadow_padding":false,"g_css_border":false,"g_gestures":false,"g_signals":false,"g_last_change":false,"visibility-cond":"==","visibility-val":1,"visibility-groups-action":"hide","signals-cond-0":"==","signals-val-0":true,"signals-icon-0":"/vis/signals/lowbattery.png","signals-icon-size-0":0,"signals-blink-0":false,"signals-horz-0":0,"signals-vert-0":0,"signals-hide-edit-0":false,"signals-cond-1":"==","signals-val-1":true,"signals-icon-1":"/vis/signals/lowbattery.png","signals-icon-size-1":0,"signals-blink-1":false,"signals-horz-1":0,"signals-vert-1":0,"signals-hide-edit-1":false,"signals-cond-2":"==","signals-val-2":true,"signals-icon-2":"/vis/signals/lowbattery.png","signals-icon-size-2":0,"signals-blink-2":false,"signals-horz-2":0,"signals-vert-2":0,"signals-hide-edit-2":false,"lc-type":"last-change","lc-is-interval":true,"lc-is-moment":false,"lc-format":"","lc-position-vert":"top","lc-position-horz":"right","lc-offset-vert":0,"lc-offset-horz":0,"lc-font-size":"12px","lc-font-family":"","lc-font-style":"","lc-bkg-color":"","lc-color":"","lc-border-width":"0","lc-border-style":"","lc-border-color":"","lc-border-radius":10,"lc-zindex":0,"html_prepend":"letzte Regeneration"},"style":{"left":"123px","top":"267px","color":"#ffffff","width":"180","height":"20px"},"widgetSet":"basic"},{"tpl":"tplValueFloat","data":{"oid":"Messwerte.0.SC18.Wasserverbrauch.D_Y_2_02","g_fixed":false,"g_visibility":false,"g_css_font_text":true,"g_css_background":false,"g_css_shadow_padding":false,"g_css_border":false,"g_gestures":false,"g_signals":false,"g_last_change":false,"visibility-cond":"==","visibility-val":1,"visibility-groups-action":"hide","is_comma":"true","factor":"1","signals-cond-0":"==","signals-val-0":true,"signals-icon-0":"/vis/signals/lowbattery.png","signals-icon-size-0":0,"signals-blink-0":false,"signals-horz-0":0,"signals-vert-0":0,"signals-hide-edit-0":false,"signals-cond-1":"==","signals-val-1":true,"signals-icon-1":"/vis/signals/lowbattery.png","signals-icon-size-1":0,"signals-blink-1":false,"signals-horz-1":0,"signals-vert-1":0,"signals-hide-edit-1":false,"signals-cond-2":"==","signals-val-2":true,"signals-icon-2":"/vis/signals/lowbattery.png","signals-icon-size-2":0,"signals-blink-2":false,"signals-horz-2":0,"signals-vert-2":0,"signals-hide-edit-2":false,"lc-type":"last-change","lc-is-interval":true,"lc-is-moment":false,"lc-format":"","lc-position-vert":"top","lc-position-horz":"right","lc-offset-vert":0,"lc-offset-horz":0,"lc-font-size":"12px","lc-font-family":"","lc-font-style":"","lc-bkg-color":"","lc-color":"","lc-border-width":"0","lc-border-style":"","lc-border-color":"","lc-border-radius":10,"lc-zindex":0,"html_append_plural":" Liter"},"style":{"left":"325px","top":"128px","color":"#ffffff","width":"111"},"widgetSet":"basic"},{"tpl":"tplValueString","data":{"oid":"nothing_selected","g_fixed":false,"g_visibility":false,"g_css_font_text":true,"g_css_background":false,"g_css_shadow_padding":false,"g_css_border":false,"g_gestures":false,"g_signals":false,"g_last_change":false,"visibility-cond":"==","visibility-val":1,"visibility-groups-action":"hide","signals-cond-0":"==","signals-val-0":true,"signals-icon-0":"/vis/signals/lowbattery.png","signals-icon-size-0":0,"signals-blink-0":false,"signals-horz-0":0,"signals-vert-0":0,"signals-hide-edit-0":false,"signals-cond-1":"==","signals-val-1":true,"signals-icon-1":"/vis/signals/lowbattery.png","signals-icon-size-1":0,"signals-blink-1":false,"signals-horz-1":0,"signals-vert-1":0,"signals-hide-edit-1":false,"signals-cond-2":"==","signals-val-2":true,"signals-icon-2":"/vis/signals/lowbattery.png","signals-icon-size-2":0,"signals-blink-2":false,"signals-horz-2":0,"signals-vert-2":0,"signals-hide-edit-2":false,"lc-type":"last-change","lc-is-interval":true,"lc-is-moment":false,"lc-format":"","lc-position-vert":"top","lc-position-horz":"right","lc-offset-vert":0,"lc-offset-horz":0,"lc-font-size":"12px","lc-font-family":"","lc-font-style":"","lc-bkg-color":"","lc-color":"","lc-border-width":"0","lc-border-style":"","lc-border-color":"","lc-border-radius":10,"lc-zindex":0,"html_prepend":"Wasserverbr. vor 2 Tagen"},"style":{"left":"123px","top":"127px","color":"#ffffff","width":"180","height":"20px"},"widgetSet":"basic"},{"tpl":"tplValueFloat","data":{"oid":"Messwerte.0.SC18.Wasserverbrauch.D_Y_2_03","g_fixed":false,"g_visibility":false,"g_css_font_text":true,"g_css_background":false,"g_css_shadow_padding":false,"g_css_border":false,"g_gestures":false,"g_signals":false,"g_last_change":false,"visibility-cond":"==","visibility-val":1,"visibility-groups-action":"hide","is_comma":"true","factor":"1","signals-cond-0":"==","signals-val-0":true,"signals-icon-0":"/vis/signals/lowbattery.png","signals-icon-size-0":0,"signals-blink-0":false,"signals-horz-0":0,"signals-vert-0":0,"signals-hide-edit-0":false,"signals-cond-1":"==","signals-val-1":true,"signals-icon-1":"/vis/signals/lowbattery.png","signals-icon-size-1":0,"signals-blink-1":false,"signals-horz-1":0,"signals-vert-1":0,"signals-hide-edit-1":false,"signals-cond-2":"==","signals-val-2":true,"signals-icon-2":"/vis/signals/lowbattery.png","signals-icon-size-2":0,"signals-blink-2":false,"signals-horz-2":0,"signals-vert-2":0,"signals-hide-edit-2":false,"lc-type":"last-change","lc-is-interval":true,"lc-is-moment":false,"lc-format":"","lc-position-vert":"top","lc-position-horz":"right","lc-offset-vert":0,"lc-offset-horz":0,"lc-font-size":"12px","lc-font-family":"","lc-font-style":"","lc-bkg-color":"","lc-color":"","lc-border-width":"0","lc-border-style":"","lc-border-color":"","lc-border-radius":10,"lc-zindex":0,"html_append_plural":" Liter"},"style":{"left":"325px","top":"148px","color":"#ffffff","width":"111"},"widgetSet":"basic"},{"tpl":"tplValueString","data":{"oid":"nothing_selected","g_fixed":false,"g_visibility":false,"g_css_font_text":true,"g_css_background":false,"g_css_shadow_padding":false,"g_css_border":false,"g_gestures":false,"g_signals":false,"g_last_change":false,"visibility-cond":"==","visibility-val":1,"visibility-groups-action":"hide","signals-cond-0":"==","signals-val-0":true,"signals-icon-0":"/vis/signals/lowbattery.png","signals-icon-size-0":0,"signals-blink-0":false,"signals-horz-0":0,"signals-vert-0":0,"signals-hide-edit-0":false,"signals-cond-1":"==","signals-val-1":true,"signals-icon-1":"/vis/signals/lowbattery.png","signals-icon-size-1":0,"signals-blink-1":false,"signals-horz-1":0,"signals-vert-1":0,"signals-hide-edit-1":false,"signals-cond-2":"==","signals-val-2":true,"signals-icon-2":"/vis/signals/lowbattery.png","signals-icon-size-2":0,"signals-blink-2":false,"signals-horz-2":0,"signals-vert-2":0,"signals-hide-edit-2":false,"lc-type":"last-change","lc-is-interval":true,"lc-is-moment":false,"lc-format":"","lc-position-vert":"top","lc-position-horz":"right","lc-offset-vert":0,"lc-offset-horz":0,"lc-font-size":"12px","lc-font-family":"","lc-font-style":"","lc-bkg-color":"","lc-color":"","lc-border-width":"0","lc-border-style":"","lc-border-color":"","lc-border-radius":10,"lc-zindex":0,"html_prepend":"Wasserverbr. vor 3 Tagen"},"style":{"left":"123px","top":"147px","color":"#ffffff","width":"180","height":"20px"},"widgetSet":"basic"},{"tpl":"tplValueFloat","data":{"oid":"Messwerte.0.SC18.Wasserverbrauch.D_Y_2_04","g_fixed":false,"g_visibility":false,"g_css_font_text":true,"g_css_background":false,"g_css_shadow_padding":false,"g_css_border":false,"g_gestures":false,"g_signals":false,"g_last_change":false,"visibility-cond":"==","visibility-val":1,"visibility-groups-action":"hide","is_comma":"true","factor":"1","signals-cond-0":"==","signals-val-0":true,"signals-icon-0":"/vis/signals/lowbattery.png","signals-icon-size-0":0,"signals-blink-0":false,"signals-horz-0":0,"signals-vert-0":0,"signals-hide-edit-0":false,"signals-cond-1":"==","signals-val-1":true,"signals-icon-1":"/vis/signals/lowbattery.png","signals-icon-size-1":0,"signals-blink-1":false,"signals-horz-1":0,"signals-vert-1":0,"signals-hide-edit-1":false,"signals-cond-2":"==","signals-val-2":true,"signals-icon-2":"/vis/signals/lowbattery.png","signals-icon-size-2":0,"signals-blink-2":false,"signals-horz-2":0,"signals-vert-2":0,"signals-hide-edit-2":false,"lc-type":"last-change","lc-is-interval":true,"lc-is-moment":false,"lc-format":"","lc-position-vert":"top","lc-position-horz":"right","lc-offset-vert":0,"lc-offset-horz":0,"lc-font-size":"12px","lc-font-family":"","lc-font-style":"","lc-bkg-color":"","lc-color":"","lc-border-width":"0","lc-border-style":"","lc-border-color":"","lc-border-radius":10,"lc-zindex":0,"html_append_plural":" Liter"},"style":{"left":"325px","top":"168px","color":"#ffffff","width":"111"},"widgetSet":"basic"},{"tpl":"tplValueString","data":{"oid":"nothing_selected","g_fixed":false,"g_visibility":false,"g_css_font_text":true,"g_css_background":false,"g_css_shadow_padding":false,"g_css_border":false,"g_gestures":false,"g_signals":false,"g_last_change":false,"visibility-cond":"==","visibility-val":1,"visibility-groups-action":"hide","signals-cond-0":"==","signals-val-0":true,"signals-icon-0":"/vis/signals/lowbattery.png","signals-icon-size-0":0,"signals-blink-0":false,"signals-horz-0":0,"signals-vert-0":0,"signals-hide-edit-0":false,"signals-cond-1":"==","signals-val-1":true,"signals-icon-1":"/vis/signals/lowbattery.png","signals-icon-size-1":0,"signals-blink-1":false,"signals-horz-1":0,"signals-vert-1":0,"signals-hide-edit-1":false,"signals-cond-2":"==","signals-val-2":true,"signals-icon-2":"/vis/signals/lowbattery.png","signals-icon-size-2":0,"signals-blink-2":false,"signals-horz-2":0,"signals-vert-2":0,"signals-hide-edit-2":false,"lc-type":"last-change","lc-is-interval":true,"lc-is-moment":false,"lc-format":"","lc-position-vert":"top","lc-position-horz":"right","lc-offset-vert":0,"lc-offset-horz":0,"lc-font-size":"12px","lc-font-family":"","lc-font-style":"","lc-bkg-color":"","lc-color":"","lc-border-width":"0","lc-border-style":"","lc-border-color":"","lc-border-radius":10,"lc-zindex":0,"html_prepend":"Wasserverbr. vor 4 Tagen"},"style":{"left":"123px","top":"167px","color":"#ffffff","width":"180","height":"20px"},"widgetSet":"basic"},{"tpl":"tplFrame","data":{"g_fixed":false,"g_visibility":false,"g_css_font_text":false,"g_css_background":false,"g_css_shadow_padding":true,"g_css_border":true,"g_gestures":false,"g_signals":false,"g_last_change":false,"visibility-cond":"==","visibility-val":1,"visibility-groups-action":"hide","title":"","title_color":"black","title_top":"-10","title_left":"15","header_height":"0","header_color":"black","signals-cond-0":"==","signals-val-0":true,"signals-icon-0":"/vis/signals/lowbattery.png","signals-icon-size-0":0,"signals-blink-0":false,"signals-horz-0":0,"signals-vert-0":0,"signals-hide-edit-0":false,"signals-cond-1":"==","signals-val-1":true,"signals-icon-1":"/vis/signals/lowbattery.png","signals-icon-size-1":0,"signals-blink-1":false,"signals-horz-1":0,"signals-vert-1":0,"signals-hide-edit-1":false,"signals-cond-2":"==","signals-val-2":true,"signals-icon-2":"/vis/signals/lowbattery.png","signals-icon-size-2":0,"signals-blink-2":false,"signals-horz-2":0,"signals-vert-2":0,"signals-hide-edit-2":false,"lc-type":"last-change","lc-is-interval":true,"lc-is-moment":false,"lc-format":"","lc-position-vert":"top","lc-position-horz":"right","lc-offset-vert":0,"lc-offset-horz":0,"lc-font-size":"12px","lc-font-family":"","lc-font-style":"","lc-bkg-color":"","lc-color":"","lc-border-width":"0","lc-border-style":"","lc-border-color":"","lc-border-radius":10,"lc-zindex":0},"style":{"left":"117px","top":"75px","width":"305px","height":"213px","border-width":"3px","border-style":"groove","z-index":0},"widgetSet":"basic"},{"tpl":"tplValueString","data":{"oid":"nothing_selected","g_fixed":false,"g_visibility":false,"g_css_font_text":true,"g_css_background":false,"g_css_shadow_padding":false,"g_css_border":false,"g_gestures":false,"g_signals":false,"g_last_change":false,"visibility-cond":"==","visibility-val":1,"visibility-groups-action":"hide","signals-cond-0":"==","signals-val-0":true,"signals-icon-0":"/vis/signals/lowbattery.png","signals-icon-size-0":0,"signals-blink-0":false,"signals-horz-0":0,"signals-vert-0":0,"signals-hide-edit-0":false,"signals-cond-1":"==","signals-val-1":true,"signals-icon-1":"/vis/signals/lowbattery.png","signals-icon-size-1":0,"signals-blink-1":false,"signals-horz-1":0,"signals-vert-1":0,"signals-hide-edit-1":false,"signals-cond-2":"==","signals-val-2":true,"signals-icon-2":"/vis/signals/lowbattery.png","signals-icon-size-2":0,"signals-blink-2":false,"signals-horz-2":0,"signals-vert-2":0,"signals-hide-edit-2":false,"lc-type":"last-change","lc-is-interval":true,"lc-is-moment":false,"lc-format":"","lc-position-vert":"top","lc-position-horz":"right","lc-offset-vert":0,"lc-offset-horz":0,"lc-font-size":"12px","lc-font-family":"","lc-font-style":"","lc-bkg-color":"","lc-color":"","lc-border-width":"0","lc-border-style":"","lc-border-color":"","lc-border-radius":10,"lc-zindex":0,"html_prepend":"Grünbeck SC18"},"style":{"left":"123px","top":"85px","color":"#f8b03a","width":"200px","height":"20px","font-weight":"bold","font-size":"large"},"widgetSet":"basic"}]
Das sollte dann so aussehen:
9876_gruenb.jpg -
Vielen lieben Dank für die Anleitung,
bei mir läuft es jetzt auch endlich
Hier und da noch was Einstellen, aber klappt.
OK ich habe es hinbekommen, (jipiehhhh)
Ich versuche es auchmal für andere zu erklären:
es braucht die Adapter:
-Javascript
-Parser
im Javascript müssen bei als zusätzliche NPM
Module:
xmlhttprequest,xml,jquery,xml2js,xmldom,regex
eingetragen werden.
Bild1
Dann 2 Javascripte anlegen,
Script 1 der Text aus StateMaschine , siehe Post oben.
Script 2 der Text aus Logger, siehe Post oben.
ACHTUNG, anlegen der Scripte bei Namen "ohne Gruppe"
Bild 2
Script 1 legt die Datenpunkte an
Script 2 holt die Daten.
Schon tauchen die Punkte bei Objekten auf (sollten sie zumindest)
Bild 3
Jetzt im Vis Editor ein "Value" Widget einfügen und bei ID den gewünschten Wert (hier Wasserverbrauch gestern) auswählen fertig!
Bild 4
sollte ich etwas vergessen haben bitte ich die Profis es nachzutragen. `
9941_gr_nbeck.jpg -
Hallo zusammen,
leider bekomme ich es nicht hin. Kann mir hier jemand helfen? Installation habe ich exakt nach der Vorgabe gemacht, IP-Adresse wurde eingetragen etc.
LOG zeigt:
javascript.0 2018-11-30 16:31:07.483 warn at process._tickCallback (internal/process/next_tick.js:180:9)
javascript.0 2018-11-30 16:31:07.483 warn at _combinedTickCallback (internal/process/next_tick.js:138:11)
javascript.0 2018-11-30 16:31:07.483 warn at endReadableNT (_stream_readable.js:1064:12)
javascript.0 2018-11-30 16:31:07.482 warn at IncomingMessage.emit (events.js:208:7)
javascript.0 2018-11-30 16:31:07.482 warn at emitNone (events.js:111:20)
javascript.0 2018-11-30 16:31:07.482 warn at IncomingMessage. <anonymous>(/opt/iobroker/node_modules/iobroker.javascript/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:447:13)
javascript.0 2018-11-30 16:31:07.481 warn at setState (/opt/iobroker/node_modules/iobroker.javascript/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:610:14)
javascript.0 2018-11-30 16:31:07.481 warn at exports.XMLHttpRequest.dispatchEvent (/opt/iobroker/node_modules/iobroker.javascript/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:591:25)
javascript.0 2018-11-30 16:31:07.480 warn at exports.XMLHttpRequest.Interval.xhr.onreadystatechange (script.js.Datenholen:74:33)
javascript.0 2018-11-30 16:31:07.478 warn State "Messwerte.0.SC18.Allgemein.D_C_4_1" not found
javascript.0 2018-11-30 16:31:07.477 warn at process._tickCallback (internal/process/next_tick.js:180:9)
javascript.0 2018-11-30 16:31:07.477 warn at _combinedTickCallback (internal/process/next_tick.js:138:11)
javascript.0 2018-11-30 16:31:07.477 warn at endReadableNT (_stream_readable.js:1064:12)
javascript.0 2018-11-30 16:31:07.476 warn at IncomingMessage.emit (events.js:208:7)
javascript.0 2018-11-30 16:31:07.476 warn at emitNone (events.js:111:20)
javascript.0 2018-11-30 16:31:07.476 warn at IncomingMessage. <anonymous>(/opt/iobroker/node_modules/iobroker.javascript/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:447:13)
javascript.0 2018-11-30 16:31:07.475 warn at setState (/opt/iobroker/node_modules/iobroker.javascript/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:610:14)
javascript.0 2018-11-30 16:31:07.475 warn at exports.XMLHttpRequest.dispatchEvent (/opt/iobroker/node_modules/iobroker.javascript/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:591:25)
javascript.0 2018-11-30 16:31:07.474 warn at exports.XMLHttpRequest.Interval.xhr.onreadystatechange (script.js.Datenholen:72:33)
javascript.0 2018-11-30 16:31:07.472 warn Wrong type of Messwerte.0.SC18.Allgemein.D_C_5_2: "string". Please fix, while deprecated and will not work in next versions.
javascript.0 2018-11-30 16:31:05.055 info script.js.Datenholen: Request 2 ausgeführt
javascript.0 2018-11-30 16:31:02.050 info script.js.Datenholen: Request 1 ausgeführt
javascript.0 2018-11-30 16:30:59.045 info script.js.Datenholen: Request 5 ausgeführt
javascript.0 2018-11-30 16:30:56.041 info script.js.Datenholen: Request 4 ausgeführt
javascript.0 2018-11-30 16:30:53.039 info script.js.Datenholen: Request 3 ausgeführt</anonymous></anonymous>
-
laufen beide Scripte bei dir?
Stop mal das Statemaschine Script…
-
Hallo Fangemeinde vom IO-Broker,
ich bin seit 5 Tagen auch endlich glücklicher Besitzer eines Raspberry und habe mich dank des guten Image sofort für den IO-Broker als Smarthome Projekt entschieden. Neben dem PI-Hole läuft derzeit aktiv nur der IO-Broker.
Ich habe auch eine SC18 Enthärtung, die ja per App viel zu sagen hat, aber eben sehr kryptisch.
Zunächst ein Dank an diesen Beitrag, ich habe es in kurzer Zeit ohne besondere Vorkenntnisse zum Laufen bekommen.
Durch meine derzeit aktuelle Version vom IO-Broker (3.5.10) sind die hier hinterlegten Bilder auch schon wieder veraltet,
z.B. Javascribt Ablageverzeichnis.
Ich habe die Scribts derzeit ins Root-Verzeichnis gespeichert, da ich das Verzeichnis Global oder Common als falsch erachtet habe.
Weiterhin habe ich es so verstanden, dass im Scribt 1 eigentlich nur einmalig die Datenfelder wie im Bild 3 dargestellt angelegt werden.
Somit muss dieses Scribt nur einmal ausgeführt werden. Richtig ?
Mit dem Logger werden jetzt die Daten permanent befüllt, die aus der SC18 entnommern werden.
Somit liest er fortlaufend die aktuellen Anlagedaten in den Parser.
Wichtig zu erwähnen für alle Anfänger (wie mich) -im Scribt 2 in der Zeile 15 ist die IP-Adresse der eigenen Anlage fest einzutragen
( Keine Constante im Kopf des Scribt festgelegt).
Meine Anlage wird ab sofort ausgelesen und ich bin echt begeistert, wie schnell ich meine ersten Lösungen im IO-Broker dank Euch fertig habe.!
Besten Dank - nun nur noch die Visualisierung und die 2. VIS ist nach dem tankerkönig online.
Zusätzlich bin ich beim Überlegen die Messwerte z.B. für Verbrauch als Metadaten auch in den SQL-Server zu schreiben und dort zu archivieren.
Wie schreiben uns weiter !