NEWS
Javascript-Instanz ist deaktiviert (sporad. ca. nach 1 Tag)
-
@codierknecht
Der Eintrag ist jetzt aus dem Modbus Adapter.Den "timerId=undefined" Eintrag gibt es aber auch hier zum Beispiel:
getState(id=0_userdata.0.Photovoltaik.PV_addiere_Watt_Master_und_Watt_Slave, timerId=undefined) => {"val":0,"ack":false,"ts":1679000222124,"q":0,"c":"script.js.common.Kostal.Kostal2von2","from":"system.adapter.javascript.0","user":"system.user.admin","lc":1678989765166}
-
@tomate sagte in Javascript-Instanz ist deaktiviert (sporad. ca. nach 1 Tag):
Kostal2von2
Gibt es ein Script "Kostal2von2"?
Zeig mal ... -
@codierknecht said in Javascript-Instanz ist deaktiviert (sporad. ca. nach 1 Tag):
Script "Kostal2von2"
<xml xmlns="https://developers.google.com/blockly/xml"> <block type="on" id="Ov.=`e?|BF;:NKk%]0}l" x="-763" y="-313"> <field name="OID">0_userdata.0.Zyklus-Blinker.1Sekunden-Takt</field> <field name="CONDITION">ne</field> <field name="ACK_CONDITION"></field> <statement name="STATEMENT"> <block type="comment" id="hYY`}cf(5yxmf8ApKrA5"> <field name="COMMENT">Hausverbrauch_berechnen</field> <next> <block type="comment" id="{]-ZugJEAj`h}8aN.:Cc"> <field name="COMMENT">Bedingung bei Verbrauch (Zukauf)</field> <next> <block type="controls_if" id="d?Ut}rB7U;nn8h~1DTs{"> <value name="IF0"> <block type="logic_compare" id="!]]V*$Cx=JORAcy.#S%@"> <field name="OP">GT</field> <value name="A"> <block type="get_value" id="TmGEO_`~#`j@QI1X-f*_"> <field name="ATTR">val</field> <field name="OID">modbus.0.holdingRegisters.0_Active_power+</field> </block> </value> <value name="B"> <block type="math_number" id="zu@Q;yF5a!`g#@/m*2@["> <field name="NUM">0</field> </block> </value> </block> </value> <statement name="DO0"> <block type="control" id="5cqKzvHOm.t0dVcgGIC{"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Photovoltaik.PV-Hausverbrauch</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="math_arithmetic" id="B-`bM)2M!I+^nb-_zk;E"> <field name="OP">ADD</field> <value name="A"> <shadow type="math_number" id="W`T6v0$]V:C5j)w%%$=x"> <field name="NUM">1</field> </shadow> <block type="get_value" id="yGtvKad$M~tIQP1oicuQ"> <field name="ATTR">val</field> <field name="OID">0_userdata.0.Photovoltaik.PV_addiere_Watt_Master_und_Watt_Slave</field> </block> </value> <value name="B"> <shadow type="math_number" id="]H3?6[!S^?8OU}Tq#1q4"> <field name="NUM">1</field> </shadow> <block type="get_value" id="yw_zU(^N!S^YXL$MqJM0"> <field name="ATTR">val</field> <field name="OID">modbus.0.holdingRegisters.0_Active_power+</field> </block> </value> </block> </value> </block> </statement> <next> <block type="comment" id="NQRiW:4qvPO_/_g]zrN4"> <field name="COMMENT">Bedingung bei Einspeisung (Verkauf)</field> <next> <block type="controls_if" id="3hl65%3DD-$lD.,_o#+]"> <value name="IF0"> <block type="logic_compare" id="J!V:qpcNTtI?-+QX$=|p"> <field name="OP">GT</field> <value name="A"> <block type="get_value" id="YL*bbXgXN,_!Xa}d4_):"> <field name="ATTR">val</field> <field name="OID">modbus.0.holdingRegisters.3_Active_power-</field> </block> </value> <value name="B"> <block type="math_number" id="SIInUpV_ZZg)[.h;0u.E"> <field name="NUM">0</field> </block> </value> </block> </value> <statement name="DO0"> <block type="control" id="KgKhBC/re=xPvd6-a4zO"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Photovoltaik.PV-Hausverbrauch</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="math_arithmetic" id="7xRPKP]pfG68Mjc^z_td"> <field name="OP">MINUS</field> <value name="A"> <shadow type="math_number"> <field name="NUM">1</field> </shadow> <block type="get_value" id="b5-Y@2^4Qg*S)Zz?_vb-"> <field name="ATTR">val</field> <field name="OID">0_userdata.0.Photovoltaik.PV_addiere_Watt_Master_und_Watt_Slave</field> </block> </value> <value name="B"> <shadow type="math_number" id="@8uR6C(!}Cdxgd[X5:BQ"> <field name="NUM">1</field> </shadow> <block type="get_value" id="5`B(@z1]=^is.+[Ut]x?"> <field name="ATTR">val</field> <field name="OID">modbus.0.holdingRegisters.3_Active_power-</field> </block> </value> </block> </value> </block> </statement> <next> <block type="comment" id="/@#}F@E?(VaR3NWdp|8E"> <field name="COMMENT">MAster + Slave addiert</field> <next> <block type="control" id="iWN|=KsdUNHnigm_L*`L"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Photovoltaik.PV_addiere_Watt_Master_und_Watt_Slave</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="math_arithmetic" id="v8|u+o|+wH`mlay/.pxq"> <field name="OP">ADD</field> <value name="A"> <shadow type="math_number"> <field name="NUM">1</field> </shadow> <block type="get_value" id="aLh[RWvw~Iys^B8B^-L5"> <field name="ATTR">val</field> <field name="OID">plenticore.0.devices.local.ac.P</field> </block> </value> <value name="B"> <shadow type="math_number"> <field name="NUM">1</field> </shadow> <block type="get_value" id="(dK6wM~5W,{YDM4WVK.4"> <field name="ATTR">val</field> <field name="OID">plenticore.1.devices.local.ac.P</field> </block> </value> </block> </value> <next> <block type="comment" id="B-BgIgiV3fL6:my};bcN"> <field name="COMMENT">Wert von Smartmeter zu S7 schicken</field> <next> <block type="control" id=":Q@wY8XR6#uF=@.y3UG9"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">s7.0.DBs.DB30.PV_Smartmeter_Wirkleistung_verkaufen</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="get_value" id="59eJEd=v7?]v6r1dSBR)"> <field name="ATTR">val</field> <field name="OID">modbus.0.holdingRegisters.3_Active_power-</field> </block> </value> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> </block> </xml>
-
@tomate
Du liest mehrfach den gleichen Wert aus den Objekten.
Das verbrät reichlich Ressourcen. Ich würde das anders lösen:
-
@codierknecht said in Javascript-Instanz ist deaktiviert (sporad. ca. nach 1 Tag):
@tomate
Du liest mehrfach den gleichen Wert aus den Objekten.
Das verbrät reichlich Ressourcen. Ich würde das anders lösen:
Das schaut super und interessant aus.
Würdest du mir den Code (Export) schicken?
(-: -
@tomate sagte in Javascript-Instanz ist deaktiviert (sporad. ca. nach 1 Tag):
Würdest du mir den Code (Export) schicken?
Versuch's mal nachzubauen - das ist nicht schwer ... und übt
Ich kann mir gut vorstellen, dass es da noch andere Kandidaten für Optimierung gibt. -
@codierknecht Danke erstmal.
Direkt reinkopiert läuft es noch nicht.
Da schau ich noch woran das liegt.
Sicher habe ich noch viel Optimierungsbedarf. (-:Zum Thema "timerId=undefined" fällt dir bei dem Skript auch nichts ein, oder?
-
@tomate sagte in Javascript-Instanz ist deaktiviert (sporad. ca. nach 1 Tag):
Zum Thema "timerId=undefined" fällt dir bei dem Skript auch nichts ein, oder?
Nö - ist ja kein Timer im Script.
Aber warte mal ab - vielleicht kann ja eine der Koniferen etwas dazu sagenHattest Du da mal mit Timeouts gespielt?
Schau mal in den JS Quellcode Deines Scripts - vielleicht ist da noch 'ne Leiche versteckt.
Kann ich mir aber eigentlich nicht vorstellen. -
@codierknecht
Hab jetzt ein wenig aufgeräumt.
Die Meldungen stehen aber immer noch im LOG.
Den Eintrag "timerId=undefined" findet mal ziemlich oft.
Kann mir jemand sagen, was es damit auf sich hat?2023-03-22 18:53:26.815 - info: javascript.0 (3766800) script.js.common.Kostal.Kostal2von2: setForeignState(id=s7.0.DBs.DB30.PV_Smartmeter_Wirkleistung_verkaufen, state={"val":0,"ack":false,"ts":1679507606815,"q":0,"from":"system.adapter.javascript.0","lc":1679507569781,"c":"script.js.common.Kostal.Kostal2von2"}) 2023-03-22 18:53:27.814 - info: javascript.0 (3766800) script.js.common.Kostal.Kostal2von2: getState(id=plenticore.0.devices.local.ac.P, timerId=undefined) => {"val":0,"ack":true,"ts":1679507605830,"q":0,"from":"system.adapter.plenticore.0","user":"system.user.admin","lc":1679507443679} 2023-03-22 18:53:27.815 - info: javascript.0 (3766800) script.js.common.Kostal.Kostal2von2: getState(id=plenticore.1.devices.local.ac.P, timerId=undefined) => {"val":0,"ack":true,"ts":1679507605718,"q":0,"from":"system.adapter.plenticore.1","user":"system.user.admin","lc":1679507254097} 2023-03-22 18:53:27.815 - info: javascript.0 (3766800) script.js.common.Kostal.Kostal2von2: setForeignState(id=0_userdata.0.Photovoltaik.PV_addiere_Watt_Master_und_Watt_Slave, state={"val":0,"ack":false,"ts":1679507607815,"q":0,"from":"system.adapter.javascript.0","lc":1679507443736,"c":"script.js.common.Kostal.Kostal2von2"}) 2023-03-22 18:53:27.815 - info: javascript.0 (3766800) script.js.common.Kostal.Kostal2von2: getState(id=0_userdata.0.Photovoltaik.PV_addiere_Watt_Master_und_Watt_Slave, timerId=undefined) => {"val":0,"ack":false,"ts":1679507606814,"q":0,"c":"script.js.common.Kostal.Kostal2von2","from":"system.adapter.javascript.0","user":"system.user.admin","lc":1679507443736} 2023-03-22 18:53:27.815 - info: javascript.0 (3766800) script.js.common.Kostal.Kostal2von2: getState(id=modbus.0.holdingRegisters.3_Active_power-, timerId=undefined) => {"val":0,"ack":true,"ts":1679504181421,"q":0,"from":"system.adapter.modbus.0","user":"system.user.admin","lc":1679504181421} 2023-03-22 18:53:27.815 - info: javascript.0 (3766800) script.js.common.Kostal.Kostal2von2: getState(id=modbus.0.holdingRegisters.0_Active_power+, timerId=undefined) => {"val":842.9,"ack":true,"ts":1679507607070,"q":0,"from":"system.adapter.modbus.0","user":"system.user.admin","lc":1679507607070} 2023-03-22 18:53:27.815 - info: javascript.0 (3766800) script.js.common.Kostal.Kostal2von2: setForeignState(id=0_userdata.0.Photovoltaik.PV-Hausverbrauch, state={"val":842.9,"ack":false,"ts":1679507607815,"q":0,"from":"system.adapter.javascript.0","lc":1679507607815,"c":"script.js.common.Kostal.Kostal2von2"}) 2023-03-22 18:53:27.815 - info: javascript.0 (3766800) script.js.common.Kostal.Kostal2von2: setForeignState(id=s7.0.DBs.DB30.PV_Smartmeter_Wirkleistung_verkaufen, state={"val":0,"ack":false,"ts":1679507607815,"q":0,"from":"system.adapter.javascript.0","lc":1679507569781,"c":"script.js.common.Kostal.Kostal2von2"}) 2023-03-22 18:53:28.815 - info: javascript.0 (3766800) script.js.common.Kostal.Kostal2von2: getState(id=plenticore.0.devices.local.ac.P, timerId=undefined) => {"val":0,"ack":true,"ts":1679507608577,"q":0,"from":"system.adapter.plenticore.0","user":"system.user.admin","lc":1679507443679} 2023-03-22 18:53:28.816 - info: javascript.0 (3766800) script.js.common.Kostal.Kostal2von2: getState(id=plenticore.1.devices.local.ac.P, timerId=undefined) => {"val":0,"ack":true,"ts":1679507608467,"q":0,"from":"system.adapter.plenticore.1","user":"system.user.admin","lc":1679507254097} 2023-03-22 18:53:28.816 - info: javascript.0 (3766800) script.js.common.Kostal.Kostal2von2: setForeignState(id=0_userdata.0.Photovoltaik.PV_addiere_Watt_Master_und_Watt_Slave, state={"val":0,"ack":false,"ts":1679507608816,"q":0,"from":"system.adapter.javascript.0","lc":1679507443736,"c":"script.js.common.Kostal.Kostal2von2"}) 2023-03-22 18:53:28.816 - info: javascript.0 (3766800) script.js.common.Kostal.Kostal2von2: getState(id=0_userdata.0.Photovoltaik.PV_addiere_Watt_Master_und_Watt_Slave, timerId=undefined) => {"val":0,"ack":false,"ts":1679507607815,"q":0,"c":"script.js.common.Kostal.Kostal2von2","from":"system.adapter.javascript.0","user":"system.user.admin","lc":1679507443736} 2023-03-22 18:53:28.816 - info: javascript.0 (3766800) script.js.common.Kostal.Kostal2von2: getState(id=modbus.0.holdingRegisters.3_Active_power-, timerId=undefined) => {"val":0,"ack":true,"ts":1679504181421,"q":0,"from":"system.adapter.modbus.0","user":"system.user.admin","lc":1679504181421} 2023-03-22 18:53:28.816 - info: javascript.0 (3766800) script.js.common.Kostal.Kostal2von2: getState(id=modbus.0.holdingRegisters.0_Active_power+, timerId=undefined) => {"val":836.3,"ack":true,"ts":1679507608131,"q":0,"from":"system.adapter.modbus.0","user":"system.user.admin","lc":1679507608131} 2023-03-22 18:53:28.816 - info: javascript.0 (3766800) script.js.common.Kostal.Kostal2von2: setForeignState(id=0_userdata.0.Photovoltaik.PV-Hausverbrauch, state={"val":836.3,"ack":false,"ts":1679507608816,"q":0,"from":"system.adapter.javascript.0","lc":1679507608816,"c":"script.js.common.Kostal.Kostal2von2"}) 2023-03-22 18:53:28.816 - info: javascript.0 (3766800) script.js.common.Kostal.Kostal2von2: setForeignState(id=s7.0.DBs.DB30.PV_Smartmeter_Wirkleistung_verkaufen, state={"val":0,"ack":false,"ts":1679507608816,"q":0,"from":"system.adapter.javascript.0","lc":1679507569781,"c":"script.js.common.Kostal.Kostal2von2"})
-
Das Script von Kostal2von2:
<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="!WZBe;{`hZ_A:/_%1~.K">Var_PV_addiere_Watt_Master_und_Watt_Slave</variable> <variable id="ddq^0tp(GPEs4g+1BS5w">Var_WirkleistungSmartMeterEinspeisung-VERKAUF</variable> <variable id="3+QuPjTrBo,!hDErGT(:">Var_WirkleistungSmartMeterVerbrauch-ZUKAUF</variable> </variables> <block type="on" id="Ov.=`e?|BF;:NKk%]0}l" x="-737" y="-287"> <field name="OID">0_userdata.0.Zyklus-Blinker.1Sekunden-Takt</field> <field name="CONDITION">ne</field> <field name="ACK_CONDITION"></field> <statement name="STATEMENT"> <block type="comment" id="/@#}F@E?(VaR3NWdp|8E"> <field name="COMMENT">Master + Slave addiert</field> <next> <block type="control" id="iWN|=KsdUNHnigm_L*`L"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Photovoltaik.PV_addiere_Watt_Master_und_Watt_Slave</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="math_arithmetic" id="v8|u+o|+wH`mlay/.pxq"> <field name="OP">ADD</field> <value name="A"> <shadow type="math_number"> <field name="NUM">1</field> </shadow> <block type="get_value" id="aLh[RWvw~Iys^B8B^-L5"> <field name="ATTR">val</field> <field name="OID">plenticore.0.devices.local.ac.P</field> </block> </value> <value name="B"> <shadow type="math_number"> <field name="NUM">1</field> </shadow> <block type="get_value" id="(dK6wM~5W,{YDM4WVK.4"> <field name="ATTR">val</field> <field name="OID">plenticore.1.devices.local.ac.P</field> </block> </value> </block> </value> <next> <block type="variables_set" id="?-p8mD1~@)HX/qJ@cX~y"> <field name="VAR" id="!WZBe;{`hZ_A:/_%1~.K">Var_PV_addiere_Watt_Master_und_Watt_Slave</field> <value name="VALUE"> <block type="get_value" id="jD{_z|vy(SHp7u$H}}1."> <field name="ATTR">val</field> <field name="OID">0_userdata.0.Photovoltaik.PV_addiere_Watt_Master_und_Watt_Slave</field> </block> </value> <next> <block type="variables_set" id="*Wryv4gfA/kuYq#/xBj}"> <field name="VAR" id="ddq^0tp(GPEs4g+1BS5w">Var_WirkleistungSmartMeterEinspeisung-VERKAUF</field> <value name="VALUE"> <block type="get_value" id="ofA-J@2Q5HfH%/e%i/jl"> <field name="ATTR">val</field> <field name="OID">modbus.0.holdingRegisters.3_Active_power-</field> </block> </value> <next> <block type="variables_set" id="g;/Ch)9FoT{+R(gqWbOq"> <field name="VAR" id="3+QuPjTrBo,!hDErGT(:">Var_WirkleistungSmartMeterVerbrauch-ZUKAUF</field> <value name="VALUE"> <block type="get_value" id="[+Au~;zK6Wf:h=gV7FRK"> <field name="ATTR">val</field> <field name="OID">modbus.0.holdingRegisters.0_Active_power+</field> </block> </value> <next> <block type="comment" id="hYY`}cf(5yxmf8ApKrA5"> <field name="COMMENT">Hausverbrauch_berechnen</field> <next> <block type="comment" id="{]-ZugJEAj`h}8aN.:Cc"> <field name="COMMENT">Bedingung bei Verbrauch (Zukauf)</field> <next> <block type="controls_if" id="d?Ut}rB7U;nn8h~1DTs{"> <value name="IF0"> <block type="logic_compare" id="!]]V*$Cx=JORAcy.#S%@"> <field name="OP">GT</field> <value name="A"> <block type="variables_get" id="9:gpf!zoOVhuHg|Xj{~^"> <field name="VAR" id="3+QuPjTrBo,!hDErGT(:">Var_WirkleistungSmartMeterVerbrauch-ZUKAUF</field> </block> </value> <value name="B"> <block type="math_number" id="zu@Q;yF5a!`g#@/m*2@["> <field name="NUM">0</field> </block> </value> </block> </value> <statement name="DO0"> <block type="control" id="5cqKzvHOm.t0dVcgGIC{"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Photovoltaik.PV-Hausverbrauch</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="math_arithmetic" id="B-`bM)2M!I+^nb-_zk;E"> <field name="OP">ADD</field> <value name="A"> <shadow type="math_number" id="W`T6v0$]V:C5j)w%%$=x"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="lqz?y;XIQ9nnryeEWn{("> <field name="VAR" id="!WZBe;{`hZ_A:/_%1~.K">Var_PV_addiere_Watt_Master_und_Watt_Slave</field> </block> </value> <value name="B"> <shadow type="math_number" id="]H3?6[!S^?8OU}Tq#1q4"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="f^I}2mTr|sEz,~C:NIay"> <field name="VAR" id="3+QuPjTrBo,!hDErGT(:">Var_WirkleistungSmartMeterVerbrauch-ZUKAUF</field> </block> </value> </block> </value> </block> </statement> <next> <block type="comment" id="NQRiW:4qvPO_/_g]zrN4"> <field name="COMMENT">Bedingung bei Einspeisung (Verkauf)</field> <next> <block type="controls_if" id="3hl65%3DD-$lD.,_o#+]"> <value name="IF0"> <block type="logic_compare" id="=VS6OH2+t@;K4oHlf#k7"> <field name="OP">GT</field> <value name="A"> <block type="variables_get" id="g{`]%J9$RVs?:6sY:`kF"> <field name="VAR" id="ddq^0tp(GPEs4g+1BS5w">Var_WirkleistungSmartMeterEinspeisung-VERKAUF</field> </block> </value> <value name="B"> <block type="math_number" id="SQ84NCu@ftLv)om1[W}|"> <field name="NUM">0</field> </block> </value> </block> </value> <statement name="DO0"> <block type="control" id="KgKhBC/re=xPvd6-a4zO"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Photovoltaik.PV-Hausverbrauch</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="math_arithmetic" id="7xRPKP]pfG68Mjc^z_td"> <field name="OP">MINUS</field> <value name="A"> <shadow type="math_number"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="$`H~WP,@ptOJR3dgpJ$#"> <field name="VAR" id="!WZBe;{`hZ_A:/_%1~.K">Var_PV_addiere_Watt_Master_und_Watt_Slave</field> </block> </value> <value name="B"> <shadow type="math_number" id="@8uR6C(!}Cdxgd[X5:BQ"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="9oc]w^EclbxJWjyjmr-i"> <field name="VAR" id="ddq^0tp(GPEs4g+1BS5w">Var_WirkleistungSmartMeterEinspeisung-VERKAUF</field> </block> </value> </block> </value> </block> </statement> <next> <block type="comment" id="B-BgIgiV3fL6:my};bcN"> <field name="COMMENT">Wert von Smartmeter zu S7 schicken</field> <next> <block type="control" id=":Q@wY8XR6#uF=@.y3UG9"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">s7.0.DBs.DB30.PV_Smartmeter_Wirkleistung_verkaufen</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="variables_get" id="gOkcNj..V_X{WMO!QLM!"> <field name="VAR" id="ddq^0tp(GPEs4g+1BS5w">Var_WirkleistungSmartMeterEinspeisung-VERKAUF</field> </block> </value> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> </block> </xml>