Änderungen

Wechseln zu: Navigation, Suche

HM-ES-TX-WM/Strom-Script01

47 Byte hinzugefügt, 19:47, 12. Feb. 2015
<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"
=== '''Script 1''' darf nur einmal am Tag (um 0 Uhr zweckmässigerweise) laufen und ''ermittelt den gestrigen Verbrauch und speichert den Zählerstand''. ===
<div style="background:#eee; border:1px solid #ccc; padding:5px 10px">
:<code>!! Energy Costs Part 1&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br/>!!<br/>!! Berechnet die verbrauchten kWh seit dem letzten Aufruf + Preis<br/>!! sollte einmal tgl. um 0 Uhr laufen<br/>!! 02/15&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br/>!! (c) by thkl<br/>!!<br/>!! Benötigte SystemVariablen:<br/>!! Name&nbsp;: eCountYesterday Typ: Zahl Einheit kWh<br/>!! Name&nbsp;: eCostYesterday Typ: Zahl Einheit&nbsp;: EUR<br/>!! Name&nbsp;: eEXMemory Typ: Zeichenkette<br/>!!<br/>!! Verbrauchte Energie wird nach Scriptlauf in eCountYesterday in kWh gespeichert Kosten in eCostYesterday<br/><br/>!! serialCounter mit Seriennummer des HM Zählers füllen<br/><br/>var serialCounter = "XXXXX";<br/>var dpname = "ENERGY_COUNTER";<br/>var priceKey = "curPrice";<br/><br/>var eEXMemory = dom.GetObject("eEXMemory");<br/>var svCountYesterday = dom.GetObject("eCountYesterday");<br/>var svCostYesterday = dom.GetObject("eCostYesterday");<br/>object devEnergyDP = dom.GetObject("BidCos-RF."#serialCounter#":1."#dpname);<br/>string tmpSVal = eEXMemory.State();<br/>real devcount = devEnergyDP.State();<br/>real statelast = tmpSVal.ToFloat();<br/>real cnyday = devcount-statelast;<br/><br/>string stdout;string stderr;<br/>string cmd = "/bin/sh -c 'cat /etc/config/energyPrice|sed -r \"s/\\"//g\"'";<br/>system.Exec(cmd, &stdout, &stderr);<br/>string sep = "\n";<br/>string part;<br/>string strCur;<br/>real price;<br/><br/>foreach(part,stdout.Split(sep)) {<br/>&nbsp; string key = part.StrValueByIndex(":",0);<br/>&nbsp; string val = part.StrValueByIndex(":",1);<br/>&nbsp; if (key==priceKey){<br/>&nbsp; &nbsp; price = val.ToFloat();<br/>&nbsp; }<br/>&nbsp; if (key=="currency") {<br/>&nbsp; &nbsp; strCur=val;<br/>&nbsp; }<br/>}<br/><br/>eEXMemory.State(devcount.ToString());<br/><br/>integer kwf = 1;<br/><br/>if (priceKey=="curPrice") {<br/>&nbsp; kwf = 1000;<br/>}<br/><br/>real costyed = price * (cnyday/kwf);<br/>svCountYesterday.State((cnyday/kwf));<br/>svCostYesterday.State(costyed);</code><br/>
</div>
=== <br/>'''Script 2''' kann beliebig oft laufen und ermittelt den ''Vebrauch des aktuellen Tages''&nbsp; ===
<div style="background:#eee; border:1px solid #ccc; padding:5px 10px">
:<code>!! Energy Costs Part 2&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br/>!!<br/>!! Berechnet die verbrauchten kWh seit dem letzten Aufruf von Script 1 also im Idealfall<br/>!! den Verbrauch seit Mitternacht<br/>!!<br/>!! kann beliebig oft laufen<br/>!! funktioniert nur in Zusammenhang mit Script 1 richtig<br/>!!<br/>!! 02/15&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br/>!! (c) by thkl<br/>!!<br/>!! Benötigte SystemVariablen:<br/>!! Name&nbsp;: eCountToday Typ: Zahl Einheit kWh<br/>!! Name&nbsp;: eCostToday Typ: Zahl Einheit: EUR<br/>!! Name&nbsp;: eEXMemory Typ: Zeichenkette<br/>!!<br/>!! Verbrauchte Energie wird nach Scriptlauf in eCountToday in kWh gespeichert Kosten in eCostToday<br/><br/>!! serialCounter mit Seriennummer des HM Zählers füllen<br/><br/><br/>var serialCounter = "XXXXX";<br/>var dpname = "ENERGY_COUNTER";<br/>var priceKey = "curPrice";<br/><br/>var eEXMemory = dom.GetObject("eEXMemory");<br/>var svCountToday = dom.GetObject("eCountToday");<br/>var svCostToday = dom.GetObject("eCostToday");<br/><br/>object devEnergyDP = dom.GetObject("BidCos-RF."#serialCounter#":1."#dpname);<br/>string tmpSVal = eEXMemory.State();<br/>real devcount = devEnergyDP.State();<br/>real statelast = tmpSVal.ToFloat();<br/>real cntoday = devcount-statelast;<br/><br/>string stdout;string stderr;<br/>string cmd = "/bin/sh -c 'cat /etc/config/energyPrice|sed -r \"s/\\"//g\"'";<br/>system.Exec(cmd, &stdout, &stderr);<br/>string sep = "\n";<br/>string part;<br/>string strCur;<br/>real price;<br/><br/>foreach(part,stdout.Split(sep)) {<br/>&nbsp; string key = part.StrValueByIndex(":",0);<br/>&nbsp; string val = part.StrValueByIndex(":",1);<br/>&nbsp; if (key==priceKey){<br/>&nbsp; &nbsp; price = val.ToFloat();<br/>&nbsp; }<br/>&nbsp; if (key=="currency") {<br/>&nbsp; &nbsp; strCur=val;<br/>&nbsp; }<br/>}<br/><br/>integer kwf = 1;<br/><br/>if (priceKey=="curPrice") {<br/>&nbsp; kwf = 1000;<br/>}<br/>real costtoday = price * (cntoday/kwf);<br/>svCountToday.State((cntoday/kwf));<br/>svCostToday.State(costtoday);</code><br/>
</div>
&nbsp;
<div style="background:#eee; border:1px solid #ccc; padding:5px 10px">
:<code>!! Energy Costs Part 3&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br/>!!<br/>!! Berechnet die verbrauchten kWh/m3 seit der letzten Abrechnung des Energielieferanten<br/>!!<br/>!! kann beliebig oft laufen<br/>!!<br/>!! 02/15&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br/>!! (c) by thkl<br/>!!<br/>!! Benötigte SystemVariablen:<br/>!! Name&nbsp;: eLastInvoice Typ:Zahl -> hier den Zählerstand der letzten Energieabrechnung in kWh oder m3 eintragen.<br/>!! Name&nbsp;: eStart Typ: Zeichenkette -> hier den aktuellen Zählerstand und den Zählerstand des Energiemessgerätes in ganzen kWh eintragen und zwar wie folgt:<br/>!! Zählerstand EZähler|Zählerstand HM Zähler (Beispiel 17456|5&nbsp;; wenn der Schwarze Kasten im E-Verteiler 17456 zeigt und gleichzeitig das HM Gerät 5) Achtung das HM Gerät zählt in WattStunden (alternativ natürlich die Gaszählerwerte)<br/>!! also / 1000<br/>!! Name&nbsp;: eUsedEnergyCost Typ: Zahl Einheit&nbsp;:EUR&nbsp;<br/>!! Name&nbsp;: eUsedEnergyCount Typ: Zahl Einheit&nbsp;:kWh oder m3<br/>!! Name&nbsp;: eTotalEnergyCount Typ: Zahl Einheit&nbsp;:kWh oder m3<br/>!! Energiekosten werden nach Scriptlauf in eUsedEnergyCost gespeichert<br/>!! Verbrauchte KwH werden nach Scriptlauf in eUsedEnergyCount gespeichert<br/>!! aktueller Stand des Stromzählers wird in eTotalEnergyCount gespeichert</code><br/>
:<code>!!</code><br/>
:<code>!! serialCounter = "" - Hier die Seriennummer des HM Zählregrätes eintragen</code><br/>
:<div id="bloop_customfont" style="margin: 0px;"><div id="bloop_customfont" style="margin: 0px;"><div style="color: rgb(0, 0, 0); font-family: Helvetica, Arial;"><code>!! useAsGasCounter = 0 - E Zähler&nbsp;; = 1 Gas Zähler</code></div><div style="color: rgb(0, 0, 0); font-family: Helvetica, Arial;"><code>!! cuxddevice = Seriennummer des CuxD Exec Devices. Wenn nicht vorhanden leer lassen dann wird system.exec genommen</code></div><div style="color: rgb(0, 0, 0); font-family: Helvetica, Arial;"><br/></div></div></div><div id="bloop_customfont" style="font-family: Helvetica, Arial; color: rgb(0, 0, 0); margin: 0px;"><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>var serialCounter = "";</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>var useAsGasCounter = 0;</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>var cuxddevice = "";</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><br/></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>!! ================ ab hier nichts mehr aendern</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><br/></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>var dpname = "ENERGY_COUNTER";</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>if (useAsGasCounter==1) {</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>&nbsp; dpname = "GAS_ENERGY_COUNTER";</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>}</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><br/></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>var svLastInvoice = dom.GetObject("eLastInvoice");</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>var svMemory = dom.GetObject("eStart");</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>var svUsedEnergyCost = dom.GetObject("eUsedEnergyCost");</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>var svUsedEnergyCount = dom.GetObject("eUsedEnergyCount");</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>var svTotalEnergyCount = dom.GetObject("eTotalEnergyCount");</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><br/></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><br/></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>var memory = svMemory.State();</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>var countLastIncoice = svLastInvoice.State();</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><br/></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>object devEnergyDP = dom.GetObject("BidCos-RF."#serialCounter#":1."#dpname);</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><br/></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>real oec = memory.StrValueByIndex("|",0).ToFloat();</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>real shc = memory.StrValueByIndex("|",1).ToFloat();</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>real chc = devEnergyDP.State();</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><br/></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>string stdout;string stderr;</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><br/></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>string cmd = "/bin/sh -c 'cat /etc/config/energyPrice|sed -r \"s/\\"//g\"'";</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>if (cuxddevice!="") {</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>&nbsp; dom.GetObject("CUxD."#cuxddevice#":1.CMD_SETS").State(cmd);</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>&nbsp; dom.GetObject("CUxD."#cuxddevice#":1.CMD_QUERY_RET").State(1);</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>&nbsp; stdout = dom.GetObject("CUxD."#cuxddevice#":1.CMD_RETS").State();</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>} else {</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>&nbsp; system.Exec(cmd, &stdout, &stderr);</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>}</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><br/></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>string sep = "\n";</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>string part;</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>string strCur;</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><br/></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>real pricekwh=0;</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>real condvalue=0;</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>real heatvalue=0;</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><br/></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>foreach(part,stdout.Split(sep)) {</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>&nbsp; string key = part.StrValueByIndex(":",0);</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>&nbsp; string val = part.StrValueByIndex(":",1);</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>&nbsp;&nbsp;</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>&nbsp; if (useAsGasCounter==1) {</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>&nbsp; if (key=="gasHeatingValue"){</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>&nbsp; &nbsp; heatvalue = val.ToFloat();</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>&nbsp; }</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>&nbsp; if (key=="gasConditionNumber"){</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>&nbsp; &nbsp; condvalue = val.ToFloat();</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>&nbsp; }</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>&nbsp; if (key=="gasPrice"){</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>&nbsp; &nbsp; pricekwh = val.ToFloat();</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>&nbsp; }</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>&nbsp; } else {</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>&nbsp; &nbsp; if (key=="curPrice"){</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>&nbsp; &nbsp; pricekwh = val.ToFloat();</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>&nbsp; }</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>&nbsp; }</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><br/></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>&nbsp; if (key=="currency") {</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>&nbsp; &nbsp; strCur=val;</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>&nbsp; }</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>}</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><br/></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>if (useAsGasCounter==1) {</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><span style="color: rgb(0, 0, 0); font-family: monospace; line-height: 19.5px; background-color: rgb(238, 238, 238);">&nbsp; &nbsp; &nbsp; &nbsp;</span><code>real cec = (chc - shc)+oec;</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><span style="color: rgb(0, 0, 0); font-family: monospace; line-height: 19.5px; background-color: rgb(238, 238, 238);">&nbsp; &nbsp; &nbsp; &nbsp;</span><code>real uec = cec-countLastIncoice.ToFloat();</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><span style="color: rgb(0, 0, 0); font-family: monospace; line-height: 19.5px; background-color: rgb(238, 238, 238);">&nbsp; &nbsp; &nbsp; &nbsp;</span><code>real consumtion = heatvalue * condvalue * uec;</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><span style="color: rgb(0, 0, 0); font-family: monospace; line-height: 19.5px; background-color: rgb(238, 238, 238);">&nbsp; &nbsp; &nbsp; &nbsp;</span><code>real costyear = pricekwh * consumtion;</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><span style="color: rgb(0, 0, 0); font-family: monospace; line-height: 19.5px; background-color: rgb(238, 238, 238);">&nbsp; &nbsp; &nbsp; &nbsp;</span><code>svUsedEnergyCost.State(costyear);</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><span style="color: rgb(0, 0, 0); font-family: monospace; line-height: 19.5px; background-color: rgb(238, 238, 238);">&nbsp; &nbsp; &nbsp; &nbsp;</span><code>svUsedEnergyCount.State(uec);</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><span style="color: rgb(0, 0, 0); font-family: monospace; line-height: 19.5px; background-color: rgb(238, 238, 238);">&nbsp; &nbsp; &nbsp; &nbsp;</span><code>svTotalEnergyCount.State(cec);</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>} else {</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>&nbsp; &nbsp; &nbsp; &nbsp;real cec = ((chc/1000) - shc)+oec;</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><span style="color: rgb(0, 0, 0); font-family: monospace; line-height: 19.5px; background-color: rgb(238, 238, 238);">&nbsp; &nbsp; &nbsp; &nbsp;</span><code>real uec = cec-countLastIncoice.ToFloat();</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><span style="color: rgb(0, 0, 0); font-family: monospace; line-height: 19.5px; background-color: rgb(238, 238, 238);">&nbsp; &nbsp; &nbsp; &nbsp;</span><code>real costyear = pricekwh * (uec);</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><span style="color: rgb(0, 0, 0); font-family: monospace; line-height: 19.5px; background-color: rgb(238, 238, 238);">&nbsp; &nbsp; &nbsp; &nbsp;</span><code>svUsedEnergyCost.State(costyear);</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><span style="color: rgb(0, 0, 0); font-family: monospace; line-height: 19.5px; background-color: rgb(238, 238, 238);">&nbsp; &nbsp; &nbsp; &nbsp;</span><code>svUsedEnergyCount.State(uec);</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><span style="color: rgb(0, 0, 0); font-family: monospace; line-height: 19.5px; background-color: rgb(238, 238, 238);">&nbsp; &nbsp; &nbsp; &nbsp;</span><code>svTotalEnergyCount.State(cec);</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px;"><code>}</code></div><div><br/></div></div>:<div id="bloop_customfont" style="margin: 0px"><div id="bloop_customfont" style="margin: 0px"><div style="color: rgb(0, 0, 0); font-family: Helvetica, Arial"><code>!! useAsGasCounter = 0 - E Zähler&nbsp;; = 1 Gas Zähler</code></div><div style="color: rgb(0, 0, 0); font-family: Helvetica, Arial"><code>!! cuxddevice = Seriennummer des CuxD Exec Devices. Wenn nicht vorhanden leer lassen dann wird system.exec genommen</code></div><div style="color: rgb(0, 0, 0); font-family: Helvetica, Arial"><br/></div></div></div><div id="bloop_customfont" style="font-family: Helvetica, Arial; color: rgb(0, 0, 0); margin: 0px"><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>var serialCounter = "";</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>var useAsGasCounter = 0;</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>var cuxddevice = "";</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><br/></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>!! ================ ab hier nichts mehr aendern</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><br/></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>var dpname = "ENERGY_COUNTER";</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>if (useAsGasCounter==1) {</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>&nbsp; dpname = "GAS_ENERGY_COUNTER";</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>}</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><br/></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>var svLastInvoice = dom.GetObject("eLastInvoice");</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>var svMemory = dom.GetObject("eStart");</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>var svUsedEnergyCost = dom.GetObject("eUsedEnergyCost");</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>var svUsedEnergyCount = dom.GetObject("eUsedEnergyCount");</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>var svTotalEnergyCount = dom.GetObject("eTotalEnergyCount");</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><br/></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><br/></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>var memory = svMemory.State();</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>var countLastIncoice = svLastInvoice.State();</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><br/></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>object devEnergyDP = dom.GetObject("BidCos-RF."#serialCounter#":1."#dpname);</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><br/></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>real oec = memory.StrValueByIndex("|",0).ToFloat();</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>real shc = memory.StrValueByIndex("|",1).ToFloat();</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>real chc = devEnergyDP.State();</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><br/></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>string stdout;string stderr;</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><br/></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>string cmd = "/bin/sh -c 'cat /etc/config/energyPrice|sed -r \"s/\\"//g\"'";</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>if (cuxddevice!="") {</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>&nbsp; dom.GetObject("CUxD."#cuxddevice#":1.CMD_SETS").State(cmd);</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>&nbsp; dom.GetObject("CUxD."#cuxddevice#":1.CMD_QUERY_RET").State(1);</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>&nbsp; stdout = dom.GetObject("CUxD."#cuxddevice#":1.CMD_RETS").State();</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>} else {</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>&nbsp; system.Exec(cmd, &stdout, &stderr);</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>}</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><br/></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>string sep = "\n";</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>string part;</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>string strCur;</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><br/></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>real pricekwh=0;</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>real condvalue=0;</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>real heatvalue=0;</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><br/></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>foreach(part,stdout.Split(sep)) {</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>&nbsp; string key = part.StrValueByIndex(":",0);</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>&nbsp; string val = part.StrValueByIndex(":",1);</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>&nbsp;&nbsp;</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>&nbsp; if (useAsGasCounter==1) {</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>&nbsp; if (key=="gasHeatingValue"){</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>&nbsp; &nbsp; heatvalue = val.ToFloat();</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>&nbsp; }</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>&nbsp; if (key=="gasConditionNumber"){</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>&nbsp; &nbsp; condvalue = val.ToFloat();</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>&nbsp; }</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>&nbsp; if (key=="gasPrice"){</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>&nbsp; &nbsp; pricekwh = val.ToFloat();</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>&nbsp; }</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>&nbsp; } else {</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>&nbsp; &nbsp; if (key=="curPrice"){</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>&nbsp; &nbsp; pricekwh = val.ToFloat();</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>&nbsp; }</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>&nbsp; }</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><br/></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>&nbsp; if (key=="currency") {</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>&nbsp; &nbsp; strCur=val;</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>&nbsp; }</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>}</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><br/></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>if (useAsGasCounter==1) {</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><span style="color: rgb(0, 0, 0); font-family: monospace; line-height: 19.5px; background-color: rgb(238, 238, 238)">&nbsp; &nbsp; &nbsp; &nbsp;</span><code>real cec = (chc - shc)+oec;</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><span style="color: rgb(0, 0, 0); font-family: monospace; line-height: 19.5px; background-color: rgb(238, 238, 238)">&nbsp; &nbsp; &nbsp; &nbsp;</span><code>real uec = cec-countLastIncoice.ToFloat();</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><span style="color: rgb(0, 0, 0); font-family: monospace; line-height: 19.5px; background-color: rgb(238, 238, 238)">&nbsp; &nbsp; &nbsp; &nbsp;</span><code>real consumtion = heatvalue * condvalue * uec;</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><span style="color: rgb(0, 0, 0); font-family: monospace; line-height: 19.5px; background-color: rgb(238, 238, 238)">&nbsp; &nbsp; &nbsp; &nbsp;</span><code>real costyear = pricekwh * consumtion;</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><span style="color: rgb(0, 0, 0); font-family: monospace; line-height: 19.5px; background-color: rgb(238, 238, 238)">&nbsp; &nbsp; &nbsp; &nbsp;</span><code>svUsedEnergyCost.State(costyear);</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><span style="color: rgb(0, 0, 0); font-family: monospace; line-height: 19.5px; background-color: rgb(238, 238, 238)">&nbsp; &nbsp; &nbsp; &nbsp;</span><code>svUsedEnergyCount.State(uec);</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><span style="color: rgb(0, 0, 0); font-family: monospace; line-height: 19.5px; background-color: rgb(238, 238, 238)">&nbsp; &nbsp; &nbsp; &nbsp;</span><code>svTotalEnergyCount.State(cec);</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>} else {</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>&nbsp; &nbsp; &nbsp; &nbsp;real cec = ((chc/1000) - shc)+oec;</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><span style="color: rgb(0, 0, 0); font-family: monospace; line-height: 19.5px; background-color: rgb(238, 238, 238)">&nbsp; &nbsp; &nbsp; &nbsp;</span><code>real uec = cec-countLastIncoice.ToFloat();</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><span style="color: rgb(0, 0, 0); font-family: monospace; line-height: 19.5px; background-color: rgb(238, 238, 238)">&nbsp; &nbsp; &nbsp; &nbsp;</span><code>real costyear = pricekwh * (uec);</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><span style="color: rgb(0, 0, 0); font-family: monospace; line-height: 19.5px; background-color: rgb(238, 238, 238)">&nbsp; &nbsp; &nbsp; &nbsp;</span><code>svUsedEnergyCost.State(costyear);</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><span style="color: rgb(0, 0, 0); font-family: monospace; line-height: 19.5px; background-color: rgb(238, 238, 238)">&nbsp; &nbsp; &nbsp; &nbsp;</span><code>svUsedEnergyCount.State(uec);</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><span style="color: rgb(0, 0, 0); font-family: monospace; line-height: 19.5px; background-color: rgb(238, 238, 238)">&nbsp; &nbsp; &nbsp; &nbsp;</span><code>svTotalEnergyCount.State(cec);</code></div><div id="bloop_customfont" style="line-height: 19.5px; margin: 0px"><code>}</code></div><div><br/></div></div>
</div>
&nbsp;
=== Script 4&nbsp; setzt die CCU interne Zähl-Variable auf den aktuellen Zählerstand ===
<div style="background:#eee; border:1px solid #ccc; padding:5px 10px">
:
 === <pre><code>dom.GetObject("svEnergyCounter_XXXXX_XXXXXXXXXX:1").State(dom.GetObject("BidCos-RF.SERIENNUMMER:1.ENERGY_COUNTER").State()+12345);</code> ===</pre></div><pre>Wobei 12345 der Stand des richtigen Zählers bei 0 Stellung des HM Zählers ist. Bei Bedarf kann man natürlich den HM Zähler durch Batterie raus wieder auf 0 setzen.</pre>
Wichtig:&nbsp;Der Eintrag svEnergyCounter_XXXXX_XXXXXXXXXX:1 ist auf jeder CCU bei jedem Zählgerät unterschiedlich. Du kannst diesen Namen wie folgt ermitteln:
Rufe im WebUI die Programme auf und blende die Systeminternen Programme mit ein. Du wirst ein Programm finden welches&nbsp;<span style="font-family: Verdana, Tahoma, Arial, Helvetica, sans-serif; font-size: 12px; line-height: normal;">prgEnergyCounter_XXXXXX_XXXXXXXXX:1 heisst.</span>
<span style="font-family: Verdana, Tahoma, Arial, Helvetica, sans-serif; font-size: 12px; line-height: normal;">Wobei die ersten&nbsp;</span>5 Stellen die interne Objektnummer und die nächsten Stellen die Seriennummer des Zählgerätes sind. Diesen Teil kopiere und ersetze im Script oben.
.
250
Bearbeitungen