Ich versuche mich gerade daran meinen Stromverbrauch aus diversen Quellen geordnet in kWh zu bringen.
Sinngemäß, bzw. das was ich in dem Blockly erreichen will:
Ließ den Zählerstand in Wh aus, vergleiche ihn mit dem alten Wert, rechne die Erhöhung aus und addiere sie zum Zähler. Klappt alles, sicherlich nicht elegant gelöst, aber Java gibt mir folgenden Fehler aus:
warn: javascript.0 You are assigning a string to the state "javascript.0.Own.Berechnungsvariablen.Verbrauch.Elektro.Desktopvariable" which expects a number. Please fix your code to use a number or change the state type to string. This warning might become an error in future versions.
Blockly Export
Spoiler
<xml xmlns="http://www.w3.org/1999/xhtml ">
<block type="on_ext" id="A]8VM$ovm+gy:;fOq%9" x="12" y="-51"> <mutation items="1"></mutation> <field name="CONDITION">ne</field> <field name="ACK_CONDITION"></field> <value name="OID0"> <shadow type="field_oid" id="_L8Q^7L1WFQkuJebXKx}"> <field name="oid">fritzdect.0.DECT200_087610114581.energy</field> </shadow> </value> <statement name="STATEMENT"> <block type="controls_if" id="io$S+3:RCT5V*/os3oKT"> <mutation elseif="1"></mutation> <value name="IF0"> <block type="logic_compare" id="H?,NFX10V@gR0NNWi-[8"> <field name="OP">GT</field> <value name="A"> <block type="get_value" id="K!q003MPHp|)(pt8U@3c"> <field name="ATTR">val</field> <field name="OID">fritzdect.0.DECT200_087610114581.energy</field> </block> </value> <value name="B"> <block type="get_value" id="q;1LV~zsb:xZrhB5|i5$"> <field name="ATTR">val</field> <field name="OID">javascript.0.Own.Berechnungsvariablen.Verbrauch.Elektro.Desktopvariable</field> </block> </value> </block> </value> <statement name="DO0"> <block type="update" id="Gj=ViOWu*S=~|s(uSmk{"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Own.Berechnungsvariablen.Verbrauch.Elektro.DesktopWh</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="math_arithmetic" id="4EWP$.~r]dz$Zq)wP_*u"> <field name="OP">ADD</field> <value name="A"> <shadow type="math_number" id="L(YySAa=x#p9]Zy$KJfq"> <field name="NUM">1</field> </shadow> <block type="get_value" id="zBeX%bBc^.HA8ZS~DLJ5"> <field name="ATTR">val</field> <field name="OID">javascript.0.Own.Berechnungsvariablen.Verbrauch.Elektro.DesktopWh</field> </block> </value> <value name="B"> <shadow type="math_number" id="toF|[j$MR|/LY5cL$Xt,"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id=",@^X)
xgi^i{9BaawM|O">
<field name="OP">MINUS</field>
<value name="A">
<shadow type="math_number" id="H$a2]QigtUvI6hs}c6Co">
<field name="NUM">1</field>
</shadow>
<block type="get_value" id="NmcfYwqIA@_87t-g3=4J">
<field name="ATTR">val</field>
<field name="OID">fritzdect.0.DECT200_087610114581.energy</field>
</block>
</value>
<value name="B">
<shadow type="math_number" id="P]+;TKxdvsYpq;}HIUR$">
<field name="NUM">1</field>
</shadow>
<block type="get_value" id="Ib|m%qw(vt[2NFnnr/S"> <field name="ATTR">val</field> <field name="OID">javascript.0.Own.Berechnungsvariablen.Verbrauch.Elektro.Desktopvariable</field> </block> </value> </block> </value> </block> </value> <next> <block type="update" id="A1!]80mB7+|/{Jb@ON8N"> <mutation delay_input="false"></mutation> <field name="OID">javascript.0.Own.Berechnungsvariablen.Verbrauch.Elektro.Desktopvariable</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="get_value" id="H~$H3:;VK7BIdvJ1b*i]"> <field name="ATTR">val</field> <field name="OID">fritzdect.0.DECT200_087610114581.energy</field> </block> </value> </block> </next> </block> </statement> <value name="IF1"> <block type="logic_compare" id="60Me2gh84YGDJ0)nI9P3"> <field name="OP">LT</field> <value name="A"> <block type="get_value" id="utEmQIL89b2Z-tQOmnX,"> <field name="ATTR">val</field> <field name="OID">fritzdect.0.DECT200_087610114581.energy</field> </block> </value> <value name="B"> <block type="get_value" id="}BbI6#5hB_zwQzzD8hGX"> <field name="ATTR">val</field> <field name="OID">javascript.0.Own.Berechnungsvariablen.Verbrauch.Elektro.Desktopvariable</field> </block> </value> </block> </value> <statement name="DO1"> <block type="update" id="jd,;YR0hOIp(4L
=:*N3">
<mutation delay_input="false"></mutation>
<field name="OID">javascript.0.Own.Berechnungsvariablen.Verbrauch.Elektro.Desktopvariable</field>
<field name="WITH_DELAY">FALSE</field>
<value name="VALUE">
<block type="get_value" id="PpTi}KpAp#fi}89Vc=ni">
<field name="ATTR">val</field>
<field name="OID">fritzdect.0.DECT200_087610114581.energy</field>
</block>
</value>
</block>
</statement>
</block>
</statement>
</block>
</xml>
Und Bild in schlechter Auflösung...
Nach meinem Verständnis ist hier nichts mehr als String.