Änderungen
<br/><br/><br/><br/><br/><span style="line-height: 1.6">Es werden folgende Systemvariablen für Script 1 und Script 2 benötigt:</span>
{| border="1" cellpadding="1" cellspacing="1"
</div>
----
Script 2a ist eine Kombination aus Script 1 + 2 ===
''(Werte für heute, gestern, universell Strom / Gas und CuxD)'' ''Bitte Hinweise am Anfang des Scrips beachten!!''
<div style="background:#eee; border:1px solid #ccc; padding:5px 10px"><div id="bloop_customfont" style="font-family:Helvetica,Arial; font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto"><div id="bloop_customfont" style="margin: 0px">!! Energy Costs Part 2a </div><div id="bloop_customfont" style="margin: 0px">!!</div><div id="bloop_customfont" style="margin: 0px">!! Berechnet die verbrauchten kWh/m3 und den Preis für Gas/Strom für den aktuellen Tag </div><div id="bloop_customfont" style="margin: 0px">!! Der erste Aufruf des Tages speichert den Verbrauch des Vortages </div><div id="bloop_customfont" style="margin: 0px">!!</div><div id="bloop_customfont" style="margin: 0px">!! kann beliebig oft laufen sollte aber günstigerweise mindestens einmal jeden Tag um 0 Uhr laufen</div><div id="bloop_customfont" style="margin: 0px">!!</div><div id="bloop_customfont" style="margin: 0px">!! 02/15 </div><div id="bloop_customfont" style="margin: 0px">!! (c) by thkl</div><div id="bloop_customfont" style="margin: 0px">!!</div><div id="bloop_customfont" style="margin: 0px">!! Benötigte SystemVariablen:</div><div id="bloop_customfont" style="margin: 0px">!! Name : eCountToday Typ: Zahl Einheit kWh / m3</div><div id="bloop_customfont" style="margin: 0px">!! Name : eCostToday Typ: Zahl Einheit: EUR</div><div id="bloop_customfont" style="margin: 0px">!!</div><div id="bloop_customfont" style="margin: 0px">!! Name : eCountYesterday Typ: Zahl Einheit kWh / m3</div><div id="bloop_customfont" style="margin: 0px">!! Name : eCostYesterday Typ: Zahl Einheit: EUR</div><div id="bloop_customfont" style="margin: 0px">!!</div><div id="bloop_customfont" style="margin: 0px">!! Name : eEXMemory Typ: Zeichenkette</div><div id="bloop_customfont" style="margin: 0px">!!</div><div id="bloop_customfont" style="margin: 0px">!! serialCounter mit Seriennummer des HM Zählers füllen</div><div id="bloop_customfont" style="margin: 0px">!! useAsGasCounter = true -> Gaszähler ; false -> Elektrozähler</div><div id="bloop_customfont" style="margin: 0px">!! cuxddevice = Seriennummer des CuxD Exec Devices (optional - sonst wird system.exe genutzt)</div><div id="bloop_customfont" style="margin: 0px"><br/></div><div id="bloop_customfont" style="margin: 0px">string serialCounter = "";</div><div id="bloop_customfont" style="margin: 0px">boolean useAsGasCounter = false;</div><div id="bloop_customfont" style="margin: 0px">string cuxddevice = "";</div><div id="bloop_customfont" style="margin: 0px"><br/></div><div id="bloop_customfont" style="margin: 0px">!! ================== do not change anything below ==========</div><div id="bloop_customfont" style="margin: 0px"><br/></div><div id="bloop_customfont" style="margin: 0px">var dpname = "ENERGY_COUNTER";</div><div id="bloop_customfont" style="margin: 0px">if (useAsGasCounter==true) {dpname = "GAS_ENERGY_COUNTER";}<br/></div><div id="bloop_customfont" style="margin: 0px"><br/></div><div id="bloop_customfont" style="margin: 0px">string stdout;string stderr;</div><div id="bloop_customfont" style="margin: 0px">string cmd = "/bin/sh -c 'cat /etc/config/energyPrice|sed -r \"s/\\"//g\"'";</div><div id="bloop_customfont" style="margin: 0px">object devEnergyDP = dom.GetObject("BidCos-RF."#serialCounter#":1."#dpname);</div><div id="bloop_customfont" style="margin: 0px">var eEXMemory = dom.GetObject("eEXMemory");</div><div id="bloop_customfont" style="margin: 0px">integer lastSetMemory = eEXMemory.Timestamp().ToInteger();</div><div id="bloop_customfont" style="margin: 0px">integer now = system.Date("%Y-%m-%d %H:%M:%S").ToTime().ToInteger();</div><div id="bloop_customfont" style="margin: 0px">boolean braveNewDay = ((now-lastSetMemory)>86399); !! Tag hat 86400 Sekunden</div><div id="bloop_customfont" style="margin: 0px"><br/></div><div id="bloop_customfont" style="margin: 0px">string tmpSVal = eEXMemory.State();</div><div id="bloop_customfont" style="margin: 0px">real devcount = devEnergyDP.State();</div><div id="bloop_customfont" style="margin: 0px">real statelast = tmpSVal.ToFloat();</div><div id="bloop_customfont" style="margin: 0px">real cnyday = devcount-statelast;</div><div id="bloop_customfont" style="margin: 0px"><br/></div><div id="bloop_customfont" style="margin: 0px">if (cuxddevice!="") {</div><div id="bloop_customfont" style="margin: 0px"> dom.GetObject("CUxD."#cuxddevice#":1.CMD_SETS").State(cmd);</div><div id="bloop_customfont" style="margin: 0px"> dom.GetObject("CUxD."#cuxddevice#":1.CMD_QUERY_RET").State(1);</div><div id="bloop_customfont" style="margin: 0px"> stdout = dom.GetObject("CUxD."#cuxddevice#":1.CMD_RETS").State();</div><div id="bloop_customfont" style="margin: 0px">} else {</div><div id="bloop_customfont" style="margin: 0px"> system.Exec(cmd, &stdout, &stderr);</div><div id="bloop_customfont" style="margin: 0px">}</div><div id="bloop_customfont" style="margin: 0px"><br/></div><div id="bloop_customfont" style="margin: 0px">string sep = "\n";</div><div id="bloop_customfont" style="margin: 0px">string part;</div><div id="bloop_customfont" style="margin: 0px">string strCur;</div><div id="bloop_customfont" style="margin: 0px">real pricekwh=0.0;</div><div id="bloop_customfont" style="margin: 0px">real condvalue=0.0;</div><div id="bloop_customfont" style="margin: 0px">real heatvalue=0.0;</div><div id="bloop_customfont" style="margin: 0px"><br/></div><div id="bloop_customfont" style="margin: 0px">foreach(part,stdout.Split(sep)) {</div><div id="bloop_customfont" style="margin: 0px"> string key = part.StrValueByIndex(":",0);</div><div id="bloop_customfont" style="margin: 0px"> string val = part.StrValueByIndex(":",1);</div><div id="bloop_customfont" style="margin: 0px"> </div><div id="bloop_customfont" style="margin: 0px"> if (useAsGasCounter==true) {</div><div id="bloop_customfont" style="margin: 0px"> if (key=="gasHeatingValue"){heatvalue = val.ToFloat();}</div><div id="bloop_customfont" style="margin: 0px"> if (key=="gasConditionNumber"){condvalue = val.ToFloat();}</div><div id="bloop_customfont" style="margin: 0px"> if (key=="gasPrice"){pricekwh = val.ToFloat();}</div><div id="bloop_customfont" style="margin: 0px"> } else {</div><div id="bloop_customfont" style="margin: 0px"> if (key=="curPrice"){pricekwh = val.ToFloat();}</div><div id="bloop_customfont" style="margin: 0px"> }</div><div id="bloop_customfont" style="margin: 0px">}</div><div id="bloop_customfont" style="margin: 0px"><br/></div><div id="bloop_customfont" style="margin: 0px">if (braveNewDay==true) {</div><div id="bloop_customfont" style="margin: 0px"> eEXMemory.State(devcount.ToString());</div><div id="bloop_customfont" style="margin: 0px">}</div><div id="bloop_customfont" style="margin: 0px"><br/></div><div id="bloop_customfont" style="margin: 0px">real enerycost = 0.0;</div><div id="bloop_customfont" style="margin: 0px">real enerycount = 0.0;</div><div id="bloop_customfont" style="margin: 0px"><br/></div><div id="bloop_customfont" style="margin: 0px">if (useAsGasCounter==true) {</div><div id="bloop_customfont" style="margin: 0px"> real consumtion = 0;</div><div id="bloop_customfont" style="margin: 0px"> consumtion = heatvalue * condvalue * cnyday;</div><div id="bloop_customfont" style="margin: 0px"> enerycost = pricekwh * consumtion;</div><div id="bloop_customfont" style="margin: 0px"> enerycount = cnyday;</div><div id="bloop_customfont" style="margin: 0px">} else {</div><div id="bloop_customfont" style="margin: 0px"> enerycount = (cnyday/1000);</div><div id="bloop_customfont" style="margin: 0px"> enerycost = pricekwh * enerycount;</div><div id="bloop_customfont" style="margin: 0px">}</div><div id="bloop_customfont" style="margin: 0px"><br/></div><div id="bloop_customfont" style="margin: 0px">if (braveNewDay==true) {</div><div id="bloop_customfont" style="margin: 0px"> dom.GetObject("eCountYesterday").State(enerycount);</div><div id="bloop_customfont" style="margin: 0px"> dom.GetObject("eCostYesterday").State(enerycost);</div><div id="bloop_customfont" style="margin: 0px">} else {</div><div id="bloop_customfont" style="margin: 0px"> dom.GetObject("eCountToday").State(enerycount);</div><div id="bloop_customfont" style="margin: 0px"> dom.GetObject("eCostToday").State(enerycost);</div><div id="bloop_customfont" style="margin: 0px">}</div><div id="bloop_customfont" style="margin: 0px"><br/></div><div id="bloop_customfont" style="margin: 0px"><br/></div></div></div> ===
----