Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. Callback vom SendTo-Block

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    Callback vom SendTo-Block

    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      DoubleD last edited by

      Hallo zusammen,

      ich bin jetzt schon öfter über folgendes Problem gestolpert. Ich konnte es immer irgendwie umschiffen aber ich möchte gerne lernen wie es richtig geht.

      Der Inhalt der Funktion ist nicht das Problem das macht was es soll. Nur kann ich den berechneten Mittelwert nicht zurück geben. Hier kommt "undefined"

      Das Blockly funktioniert nicht, weil ich außerhalb des SendTo nicht auf an die Variable mittelwert komme.
      Soviel ist mir klar!
      Aber wie muss ich das Blockly umbauen damit die Funktion funktioniert?

      126e5236-361f-4c9b-b388-9a4b6f8d13e8-image.png


      <xml xmlns="https://developers.google.com/blockly/xml">
      <variables>
      <variable id="6,dzsOwn?qy)+hkc8:.">Zeitraum</variable>
      <variable id="Z:imPp:;-QS4,%xz+:#4">zeitraumInMinuten</variable>
      <variable id="t}GQ[7]K
      kwr%A6?RmrS">mittelwert</variable>
      <variable id="=#r+Qy_z!CXF4u:~y{@D">end</variable>
      <variable id="RqgWrwng/Wn9RV5]mb5I">start</variable>
      <variable id="}7IZ.U!2+ZQn+xxt5xlU">result</variable>
      <variable id="cJb}D6UrSe;P(Ak5nC9a">liste</variable>
      <variable id="Sg1Jh.G[i/A}y;PMthl4">summeWerte</variable>
      <variable id="VOx3S$l5^}=n%?{rtdx">anzahlWerte</variable>
      <variable id=":5D~d%q3lW{.N4TEYS:{">j</variable>
      <variable id="O*=(,bL3}oqZ)BB{UZG7">wert</variable>
      <variable id="r.9Jk,5sPzYwBO]+P]K+">Zeit</variable>
      </variables>
      <block type="procedures_defreturn" id=")6::^PkOx|g*,R(48%M" x="-62" y="-462"> <mutation> <arg name="Zeitraum" varid="6,dzsOw*n?qy)+hkc8:."></arg> </mutation> <field name="NAME">DurchschnittBerechnenMitRueckgabe</field> <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment> <statement name="STACK"> <block type="variables_set" id="[R^c@(Kj5$v,Km[N+h+q"> <field name="VAR" id="Z:imPp:;-QS4,%xz+:#4">zeitraumInMinuten</field> <value name="VALUE"> <block type="variables_get" id="{nDCebW=]DS[c1pU.AMB"> <field name="VAR" id="6,dzsOw*n?qy)+hkc8:.">Zeitraum</field> </block> </value> <next> <block type="variables_set" id="W()[YR@B-dZNdJ0^i4yJ"> <field name="VAR" id="=#r+Qy_z!CXF4u:~y{@D">end</field> <value name="VALUE"> <block type="time_get" id="WjQH,Aq;E)HRq!vFbB6p"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">object</field> </block> </value> <next> <block type="variables_set" id="=davNDt=:Bf[(:nEk/]1"> <field name="VAR" id="RqgWrwng/Wn9RV5]mb5I">start</field> <value name="VALUE"> <block type="math_arithmetic" id="?6m?ZRV%|tJ!^mPO:(=F"> <field name="OP">MINUS</field> <value name="A"> <shadow type="math_number"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="@{JgX#+:m#;)xwtco6H9"> <field name="VAR" id="=#r+Qy_z!CXF4u:~y{@D">end</field> </block> </value> <value name="B"> <shadow type="math_number"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id="pB=!V?.q{]()NdT+(;%/"> <field name="OP">MULTIPLY</field> <value name="A"> <shadow type="math_number"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="Cg).(ec@;$no+0,7n@Rs"> <field name="VAR" id="Z:imPp:;-QS4,%xz+:#4">zeitraumInMinuten</field> </block> </value> <value name="B"> <shadow type="math_number" id="e}7pvq[6V5PI2Ipd?OtV"> <field name="NUM">60000</field> </shadow> </value> </block> </value> </block> </value> <next> <block type="sendto_custom" id="4zGb/s=a~|Up(0*@}0rY"> <mutation xmlns="http://www.w3.org/1999/xhtml" items="id,options" with_statement="true"></mutation> <field name="INSTANCE">influxdb.0</field> <field name="COMMAND">getHistory</field> <field name="LOG"></field> <field name="WITH_STATEMENT">TRUE</field> <value name="ARG0"> <shadow type="text"> <field name="TEXT"></field> </shadow> <block type="field_oid" id="wAuIv47YTi%ACdW#Db-">
      <field name="oid">mqtt.0.SmartHome.Aussen.Wetterstation.get.wind_kmh</field>
      </block>
      </value>
      <value name="ARG1">
      <shadow type="text">
      <field name="TEXT">{start: start, step: 3600000, aggregate: "total"}</field>
      </shadow>
      <block type="text" id="o.xW6czkZl-2R4RGnBJW">
      <field name="TEXT">{start: start, end: end, aggregate: "none"}</field>
      </block>
      </value>
      <statement name="STATEMENT">
      <block type="debug" id="b;W~Q|H9[/uw@rdGek[k" disabled="true">
      <field name="Severity">log</field>
      <value name="TEXT">
      <shadow type="text">
      <field name="TEXT">test</field>
      </shadow>
      <block type="variables_get" id="lsfEwqPj+9J;eVcb).w"> <field name="VAR" id="}7IZ.U!2+ZQn+xxt5xlU">result</field> </block> </value> <next> <block type="variables_set" id="6J_qK,wyCt_{b+qCpt02"> <field name="VAR" id="cJb}D6UrSe;P(Ak5nC9a">liste</field> <value name="VALUE"> <block type="lists_create_with" id="iT%OsXU_1H-yfF)Av.2a"> <mutation items="0"></mutation> </block> </value> <next> <block type="variables_set" id="^%ZUzjixF3YN{:9%XYf">
      <field name="VAR" id="cJb}D6UrSe;P(Ak5nC9a">liste</field>
      <value name="VALUE">
      <block type="convert_jsonata" id="O:^6e5y:++ojE:K3oIoi">
      <value name="EXPRESSION">
      <shadow type="text" id="iGaKAmM|jJ26]3wm7PG}">
      <field name="TEXT">result</field>
      </shadow>
      </value>
      <value name="TARGET">
      <block type="variables_get" id="HXX#Nq(3.y1~6{r2k03"> <field name="VAR" id="}7IZ.U!2+ZQn+xxt5xlU">result</field> </block> </value> </block> </value> <next> <block type="controls_if" id="_FB}~/B6;tqmB+Kp.I#r"> <mutation else="1"></mutation> <value name="IF0"> <block type="logic_compare" id="ymt4SZk]K!=LL};lO+xl"> <field name="OP">NEQ</field> <value name="A"> <block type="convert_jsonata" id="o1/Ch58*dpEycr}#r%l0"> <value name="EXPRESSION"> <shadow type="text" id="JvC9EQ;sTJ)daD-w#{{Y"> <field name="TEXT">error</field> </shadow> </value> <value name="TARGET"> <block type="variables_get" id="IVJm.wYK*~fn@#1HuH(*"> <field name="VAR" id="}7IZ.U!2+ZQn+xxt5xlU">result</field> </block> </value> </block> </value> <value name="B"> <block type="logic_null" id="M?$vd7meLzP#iF}6-8M0"></block> </value> </block> </value> <statement name="DO0"> <block type="debug" id="au76518S:0PuZ4)x-b"> <field name="Severity">warn</field> <value name="TEXT"> <shadow type="text" id="tZ6e]MNl0.MU0~N8+ob."> <field name="TEXT">!!! FEHLER !!!</field> </shadow> </value> </block> </statement> <statement name="ELSE"> <block type="variables_set" id=")bDfQ.6C45|Vfy*@Pw7^"> <field name="VAR" id="Sg1Jh.G[i/A}y;PMthl4">summeWerte</field> <value name="VALUE"> <block type="math_number" id=",~/[-UylljV;Px)#,80">
      <field name="NUM">0</field>
      </block>
      </value>
      <next>
      <block type="math_change" id="j-21h3Ky4A5JNB2b6f~">
      <field name="VAR" id="VOx3S$l5^}=n%
      ?{rtdx">anzahlWerte</field>
      <value name="DELTA">
      <shadow type="math_number">
      <field name="NUM">1</field>
      </shadow>
      <block type="math_number" id="5)QYeE)80T)fsde7q:D@">
      <field name="NUM">0</field>
      </block>
      </value>
      <next>
      <block type="controls_forEach" id="u-9B-tLLU;PWVWYNj5at">
      <field name="VAR" id=":5D~d%q3lW{.N4TEYS:{">j</field>
      <value name="LIST">
      <block type="variables_get" id="Y5fDnm31=T/l6%$RIs3Z">
      <field name="VAR" id="cJb}D6UrSe;P(Ak5nC9a">liste</field>
      </block>
      </value>
      <statement name="DO">
      <block type="math_change" id="/RjhV.:sx[A1sUnr]m:"> <field name="VAR" id="VOx3S$l5^}=n%_?{rtdx">anzahlWerte</field> <value name="DELTA"> <shadow type="math_number" id="P6vRh|kye8B9:ap$/2Fu"> <field name="NUM">1</field> </shadow> </value> <next> <block type="variables_set" id=".^V*WKvedE6qz*?HNMJ?"> <field name="VAR" id="O*=(,bL3}oqZ)BB{UZG7">wert</field> <value name="VALUE"> <block type="convert_jsonata" id="nt(WnWakCY{!SUqU00*f"> <value name="EXPRESSION"> <shadow type="text" id="D{8QVaov,P$6zeT:!%XK"> <field name="TEXT">val</field> </shadow> </value> <value name="TARGET"> <block type="variables_get" id="ND^dQg%44TikVHE/7JO0"> <field name="VAR" id=":5D~d%q3lW{.N4TEYS:{">j</field> </block> </value> </block> </value> <next> <block type="variables_set" id="J~#uyBu:9D@z9@?q6%1I"> <field name="VAR" id="r.9Jk,5sPzYwBO]+P]K+">Zeit</field> <value name="VALUE"> <block type="convert_jsonata" id="Q/8?IQ?(Y,qzU,3DC.tW"> <value name="EXPRESSION"> <shadow type="text" id="QAt~mj$H(FwP-qlmJ=.I"> <field name="TEXT">ts</field> </shadow> </value> <value name="TARGET"> <block type="variables_get" id="e)bLa%6!QSJXHlE@cb:="> <field name="VAR" id=":5D~d%q3lW{.N4TEYS:{">j</field> </block> </value> </block> </value> <next> <block type="math_change" id="jl{NJZ}n]*+:CiZU!j~8"> <field name="VAR" id="Sg1Jh.G[i/A}y;PMthl4">summeWerte</field> <value name="DELTA"> <shadow type="math_number"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="k23iNRKXYGn^.0,e@$l="> <field name="VAR" id="O*=(,bL3}oqZ)BB{UZG7">wert</field> </block> </value> </block> </next> </block> </next> </block> </next> </block> </statement> <next> <block type="variables_set" id="CqMhQXgeX4F?)H}lPGy">
      <field name="VAR" id="t}GQ[7]K*kwr%A6?RmrS">mittelwert</field>
      <value name="VALUE">
      <block type="math_rndfixed" id="3,I^l,TYPX!nP/g;:]bp">
      <field name="n">2</field>
      <value name="x">
      <shadow type="math_number">
      <field name="NUM">3.1234</field>
      </shadow>
      <block type="math_arithmetic" id="A_NIDa6~bOTz{y:SR}n2">
      <field name="OP">DIVIDE</field>
      <value name="A">
      <shadow type="math_number">
      <field name="NUM">1</field>
      </shadow>
      <block type="variables_get" id="JCp9c[ohM|i
      )BXhG_(r">
      <field name="VAR" id="Sg1Jh.G[i/A}y;PMthl4">summeWerte</field>
      </block>
      </value>
      <value name="B">
      <shadow type="math_number">
      <field name="NUM">1</field>
      </shadow>
      <block type="variables_get" id="%a)f]^cq,sZgQ6x6X;3"> <field name="VAR" id="VOx3S$l5^}=n%_?{rtdx">anzahlWerte</field> </block> </value> </block> </value> </block> </value> </block> </next> </block> </next> </block> </next> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </statement> <value name="RETURN"> <block type="variables_get" id="!GuWEkcpBG4MU$|gM(t">
      <field name="VAR" id="t}GQ[7]Kkwr%A6?RmrS">mittelwert</field>
      </block>
      </value>
      </block>
      <block type="schedule" id="=XV_KLGRd/i,Zf/pOAQN" x="-63" y="412">
      <field name="SCHEDULE">
      * * * *</field>
      <statement name="STATEMENT">
      <block type="debug" id="RhlI:msE4/oe[lZ3M#z?">
      <field name="Severity">log</field>
      <value name="TEXT">
      <shadow type="text" id="8Zt6~=b9)@y#{p|OEM!"> <field name="TEXT">test</field> </shadow> <block type="procedures_callreturn" id="sx=ks{VMv5t?q7{7Bhc">
      <mutation name="DurchschnittBerechnenMitRueckgabe">
      <arg name="Zeitraum"></arg>
      </mutation>
      <value name="ARG0">
      <block type="math_number" id="PWynn}$nn?#UZfMk}435">
      <field name="NUM">5</field>
      </block>
      </value>
      </block>
      </value>
      </block>
      </statement>
      </block>
      </xml>

      Ich hoffe Ich konnte mein Problem gut beschreiben und Ihr könnt mir helfen!

      Danke & Gruß
      Daniel

      1 Reply Last reply Reply Quote 0
      • First post
        Last post

      Support us

      ioBroker
      Community Adapters
      Donate

      815
      Online

      31.9k
      Users

      80.1k
      Topics

      1.3m
      Posts

      1
      1
      165
      Loading More Posts
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes
      Reply
      • Reply as topic
      Log in to reply
      Community
      Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
      The ioBroker Community 2014-2023
      logo