Änderungen

Wechseln zu: Navigation, Suche

HM-ES-TX-WM/Strom-Script01

3.225 Byte hinzugefügt, 16:50, 12. Feb. 2015
<br/><br/>Es werden folgende Systemvariablen für Script 1 und Script 2 benötigt:
{| border="1" cellpadding="1" cellspacing="1"
| "XXXXX"; -> hier wieder Seriennummer anpassen<br/>
|}
 
&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 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 : eLastInvoice Typ:Zahl -> hier den Zählerstand der letzten Energieabrechnung in kWh eintragen.<br/>!! Name : 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 ; 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<br/>!! also / 1000<br/>!! Name : eUsedEnergyCost Typ: Zahl Einheit :EUR&nbsp;<br/>!! Name : eUsedEnergyCount Typ: Zahl Einheit :kWh<br/>!! Name : eTotalEnergyCount Typ: Zahl Einheit :kWh<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<br/>!! serialCounter mit Seriennummer des HM Zählers füllen<br/><br/><br/>var serialCounter = "XXXXX";<br/><br/>var dpname = "ENERGY_COUNTER";<br/>var priceKey = "curPrice";<br/><br/>var svLastInvoice = dom.GetObject("eLastInvoice");<br/>var svMemory = dom.GetObject("eStart");<br/>var svUsedEnergyCost = dom.GetObject("eUsedEnergyCost");<br/>var svUsedEnergyCount = dom.GetObject("eUsedEnergyCount");<br/>var svTotalEnergyCount = dom.GetObject("eTotalEnergyCount");<br/><br/><br/>var memory = svMemory.State();<br/>var countLastIncoice = svLastInvoice.State();<br/><br/>object devEnergyDP = dom.GetObject("BidCos-RF."#serialCounter#":1."#dpname);<br/><br/>real oec = memory.StrValueByIndex("|",0).ToFloat();<br/>real shc = memory.StrValueByIndex("|",1).ToFloat();<br/>real chc = devEnergyDP.State();<br/><br/>real cec = ((chc/1000) - shc)+oec;<br/>real uec = cec-countLastIncoice.ToFloat();<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/><br/>real costyear = price * (uec);<br/>svUsedEnergyCost.State(costyear);<br/>svUsedEnergyCount.State(uec);<br/>svTotalEnergyCount.State(cec);</code><br/>
 
&nbsp;
</div>
&nbsp;.
250
Bearbeitungen