This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Themabewertung:
  • 0 Bewertung(en) - 0 im Durchschnitt
  • 1
  • 2
  • 3
  • 4
  • 5
Javascript zum umrechnen watt in kw/h täglich auf 0 setzten
#1
Hallo,
aktuell habe ich dieses script am laufen (iobroker)

[font=Consolas, "Courier New", monospace]const idPower = 'mqtt.0.solpiplog.pip.pvchargew';  // cur_power
const idEnergy = 'Tagesproduktion'// kWh
 
// Energie-Datenpunkt erzeugen
createState(idEnergy, 1.11, {type'number', unit: 'kWh'}); // Anfangswert anpassen !
 
var energy = 1000 * getState(idEnergy).val; // Wh, erzeugt beim ersten Skripstart Fehler
 
on({id: idPower}, function(dp) {
   energy = energy + dp.oldState.val * (dp.state.ts - dp.oldState.ts) / 3600000// Wh
   setState(idEnergy, Math.round(energy) / 1000true); // kWh mit 3 Nachkommastellen
   });[/font]


nun möchte ich das um 0uhr nachts der Wer Tagesproduktion auf 0 gesetzt wird und bekomme das nicht so recht hin.
Zitieren


Gehe zu:


Benutzer, die gerade dieses Thema anschauen: 1 Gast/Gäste