NEWS
[Gelöst]SQL Logging auswerten
-
Hallo,
ich logge in eine SQL Datenbank. Damit mache ich aktuell eigentlich nur FLOT Anzeigen bzw. Graphen.
Ist es möglich mir von einem Wert einen MAX wert des Aktuellen Tages anzeigen zu lassen?
Bin leider nicht wirklich Firm mit SQL.
Danke für Eure Hilfe
Gruß Thomas
-
-
super danke
nun taucht aber gleich ein Problem auf.
Ich habe ein neues Javascript angelegt
dann den Code eingefügt.
die ID habe ich ersetzt durch die ID des wertes den ich haben möchte?
wo kommt die Anzeige raus?
hier mien code
`var end = new Date().getTime(); sendTo('sql.0', 'getHistory', { id: '"modbus.0.holdingRegisters.557_I_Batt"/*Ladestrom in A*/', options: { start: end - 3600000, end: end, aggregate: 'minmax' // or 'none' to get raw values } }, function (result) { for (var i = 0; i < result.result.length; i++) { console.log(result.result[i].id + ' ' + new Date(result.result[i].ts).toISOString()); } });` Danke nochmal. Gruß Thomas[/i][/i] -
`function maxStrom() { var end = new Date().getTime(); sendTo('sql.0', 'getHistory', { id: "modbus.0.holdingRegisters.557_I_Batt"/*Ladestrom in A*/, options: { start: end - 24 * 3600000, end: end, aggregate: 'none' } }, function (result) { var max = 0; for (var i = 0; i < result.result.length; i++) { if(result.result[i].val > max) max = result.result[i].val; } log('Maximaler Ladestrom: ' + max + ' A'); // oder, wenn Datenpunkt vorhanden: setState(idMaxStrom, max, true); }); } maxStrom(); // Skriptstart schedule('0 0 * * *', maxStrom); // täglich um Mitternacht` [/i][/i] -
hab mir das setstate noch eingebaut. ist das so richtig? habe den datenpunkt als gemischt erstell.
`function maxStrom() { var end = new Date().getTime(); sendTo('sql.0', 'getHistory', { id: "modbus.0.holdingRegisters.557_I_Batt"/*Ladestrom in A*/, options: { start: end - 24 * 3600000, end: end, aggregate: 'none' } }, function (result) { var max = 0; for (var i = 0; i < result.result.length; i++) { if(result.result[i].val > max) max = result.result[i].val; } log('Maximaler Ladestrom: ' + max + ' A'); // oder, wenn Datenpunkt vorhanden: setState("javascript.0.MaxLadestrom", max, true); }); } maxStrom(); // Skriptstart schedule('0 0 * * *', maxStrom); // täglich um Mitternacht` danke für deine Hilfe![/i][/i]
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login