Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. Luft-Messdaten von OpenSenseMap auslesen

    NEWS

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    Luft-Messdaten von OpenSenseMap auslesen

    This topic has been deleted. Only users with topic management privileges can see it.
    • paul53
      paul53 @Homoran last edited by paul53

      @Homoran sagte:

      Und dummy kommt dann in den Pfad bei den Sensor-States statt Station?

      Nein, dummy ist das, was der Bezeichner sagt. Die Variable wird nur benötigt, weil die Funktion einen Wert zurück gibt, der an dieser Stelle nicht benötigt wird.

      1 Reply Last reply Reply Quote 1
      • paul53
        paul53 @Homoran last edited by

        @Homoran sagte:

        aus "Strukturgründen" deshalb ja lieber als channel gehabt.

        Dann musst Du einen Javascript-Funktion mit setObject() verwenden.

        Homoran 1 Reply Last reply Reply Quote 0
        • Homoran
          Homoran Global Moderator Administrators @paul53 last edited by

          @paul53 sagte in Luft-Messdaten von OpenSenseMap auslesen:

          @Homoran sagte:

          aus "Strukturgründen" deshalb ja lieber als channel gehabt.

          Dann musst Du einen Javascript-Funktion mit setObject() verwenden.

          Das lasse ich lieber wenn das so gefährlich ist.

          Du überraschst mich immer wieder.

          @paul53 sagte in Luft-Messdaten von OpenSenseMap auslesen:

          Die Variable wird nur benötigt, weil die Funktion einen Wert zurück gibt,

          Das ist doch Hokuspokus 😉
          Bin mal gespannt

          1 Reply Last reply Reply Quote 0
          • Homoran
            Homoran Global Moderator Administrators last edited by

            Natürlich hat es geklappt.
            Danke @paul53
            Aber bis ich das verdaut habe wird es noch etwas dauern

            @paul53 sagte in Luft-Messdaten von OpenSenseMap auslesen:

            Dann musst Du einen Javascript-Funktion mit setObject() verwenden.

            Wenn ich ganz mutig bin verwende ich meine alte StationDP-Anlegen funktion und tausche nur setState gegen setObject aus.

            paul53 1 Reply Last reply Reply Quote 0
            • paul53
              paul53 @Homoran last edited by paul53

              @Homoran sagte:

              tausche nur setState gegen setObject aus.

              Genau das ist die Gefahr !!
              Die Funktion erzeugeChannel(id, Name) müsste etwa so aussehen:

              id = 'javascript.' + instance + '.' + id;
              if(!existsObject(id)) {
                 let obj = {};
                 obj.type = 'channel';
                 obj.common = {};
                 obj.common.name = Name;
                 setObject(id, obj);
              }
              
              Homoran 1 Reply Last reply Reply Quote 0
              • Homoran
                Homoran Global Moderator Administrators @paul53 last edited by Homoran

                Sorry @paul53

                ich kapiere das nicht ganz.

                Du prüfst ob die Id bereits existiert. Wenn nicht, legt er los - klar soweit!
                Die ID wäre ja die Stationsnummer
                Muss ich da vorher eine ID übergeben = Station? - klappt nicht

                Den "Pfad" baust du ja im letzten Schritt komplett auf.
                Name ist doch bereits die vorhandene Variable - muss ich da auch noch was übergeben?

                Ich habe alle(?) Versionen mit und ohne Übergabe versucht, auch mit Text aus "Luftdaten."+Station

                bekomme immer javascript.0 2020-01-02 16:53:29.576 error (4615) setForeignObject: try to set null object for [object Object]

                paul53 1 Reply Last reply Reply Quote 0
                • paul53
                  paul53 @Homoran last edited by

                  @Homoran
                  Sorry, es wird eine falsche ID geprüft. Habe es oben korrigiert.

                  An die Funktion muss die Teil-ID und der Name übergeben werden.

                  Blockly_temp.JPG

                  Homoran 1 Reply Last reply Reply Quote 0
                  • Homoran
                    Homoran Global Moderator Administrators @paul53 last edited by

                    @paul53 sagte in Luft-Messdaten von OpenSenseMap auslesen:

                    Sorry, es wird eine falsche ID geprüft.

                    kein Problem - das lernt 😉

                    @paul53 sagte in Luft-Messdaten von OpenSenseMap auslesen:

                    An die Funktion muss die Teil-ID und der Name übergeben werden.

                    Hatte ich fast so, ich hatte lediglich statt Attribut name... einfach Name genommen.
                    Da war doch was mit global und local :oops:

                    paul53 1 Reply Last reply Reply Quote 0
                    • paul53
                      paul53 @Homoran last edited by paul53

                      @Homoran sagte:

                      das lernt

                      Ja, woran man sieht, dass der Umgang mit setObject() nicht trivial ist.

                      @Homoran sagte in Luft-Messdaten von OpenSenseMap auslesen:

                      Da war doch was mit global und local :oops:

                      Die Funktionsparameter id und Name und die intern deklarierte Variable obj sind lokal (nur innerhalb der Funktion gültig).

                      1 Reply Last reply Reply Quote 0
                      • Homoran
                        Homoran Global Moderator Administrators last edited by

                        Nachdem @paul53 wie befürchtet das Skript komlett zerlegt und neu zusammengesetzt hat hier jetzt die aktuelle Version.

                        Vielen Dank nochmals an @paul53 - ich habe viel gelernt! (Hoffentlich behalte ich das auch).

                        <xml xmlns="http://www.w3.org/1999/xhtml">
                         <variables>
                           <variable type="" id="(OS6)At}0sRw3rBe4]ua">sensor</variable>
                           <variable type="" id="F8FJH2:MYg!TEng|{`cX">id</variable>
                           <variable type="" id="kNmwW)zuGsFpRPSr%tI4">Name</variable>
                           <variable type="" id="=:T.5x=N7D*5*g`@lmVQ">str</variable>
                           <variable type="" id="/Ob+6.k{E5c@No}z%#Fu">unit</variable>
                           <variable type="" id="I@-[Cj^I1}(-7m+VQ8Dj">idSensor</variable>
                           <variable type="" id="P}P_1?s%S89=9|ppf`Nx">Station</variable>
                           <variable type="" id="Z{~*0luN#Qp/IUr;|BmX">Unterverzeichnis</variable>
                           <variable type="" id="%arR9:8r$Bg^H++?QiSv">URL</variable>
                           <variable type="" id="9k8j[#@42,2VE~mdj%7,">obj</variable>
                           <variable type="" id="mfFi6HkOgN+sro=x^sXu">result</variable>
                           <variable type="" id="%VO!Ye}Fho*S1ssX{uog">sensors</variable>
                           <variable type="undefined" id="timeout">timeout</variable>
                           <variable type="" id="rn64I/AwPbPo#;6x;zx$">i</variable>
                         </variables>
                         <block type="comment" id="rRh=WVq[e{*QAmGaL_{b" x="-687" y="-537">
                           <field name="COMMENT">Skript zum Auslesen von Messstationen bei opensensemap.info</field>
                           <next>
                             <block type="comment" id="O,?[OJ_U*rX)*]R}`4LR">
                               <field name="COMMENT">von Homoran mit ganz viel Hilfe von paul53</field>
                               <next>
                                 <block type="comment" id="j,L%{C[e.u@`d)6[f(r=">
                                   <field name="COMMENT">Version 0.3.1</field>
                                 </block>
                               </next>
                             </block>
                           </next>
                         </block>
                         <block type="procedures_defnoreturn" id="=x|n[F+0Ffd=3R25^)BO" x="-63" y="-538">
                           <mutation>
                             <arg name="sensor" varid="(OS6)At}0sRw3rBe4]ua"></arg>
                           </mutation>
                           <field name="NAME">Sensorwerte_auslesen</field>
                           <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
                           <statement name="STACK">
                             <block type="variables_set" id="u*oWBI50DRa@5Jq2ix11">
                               <field name="VAR" id="I@-[Cj^I1}(-7m+VQ8Dj" variabletype="">idSensor</field>
                               <value name="VALUE">
                                 <block type="text_join" id="xT@ken$pI)`7jm?z}3{W">
                                   <mutation items="6"></mutation>
                                   <value name="ADD0">
                                     <block type="variables_get" id="]b;M+`Nh`:~xD,EO{c)u">
                                       <field name="VAR" id="Z{~*0luN#Qp/IUr;|BmX" variabletype="">Unterverzeichnis</field>
                                     </block>
                                   </value>
                                   <value name="ADD1">
                                     <block type="variables_get" id="-hrKM3^f7j|T9rpuV4G#">
                                       <field name="VAR" id="P}P_1?s%S89=9|ppf`Nx" variabletype="">Station</field>
                                     </block>
                                   </value>
                                   <value name="ADD2">
                                     <block type="text" id="1LTqt!PGPEJAiFGPPP?r">
                                       <field name="TEXT">.</field>
                                     </block>
                                   </value>
                                   <value name="ADD3">
                                     <block type="procedures_callcustomreturn" id="M!nMAe^g4b,?)$@!fwkE">
                                       <mutation name="Punktkiller">
                                         <arg name="str"></arg>
                                       </mutation>
                                       <value name="ARG0">
                                         <block type="get_attr" id="5}0nqRuX`7R08eW*^IBN">
                                           <value name="PATH">
                                             <shadow type="text" id="7G2x!o3c5)f=1eEWV(xI">
                                               <field name="TEXT">sensorType</field>
                                             </shadow>
                                           </value>
                                           <value name="OBJECT">
                                             <block type="variables_get" id="#%QmzLw(G1)rCN1RW`na">
                                               <field name="VAR" id="(OS6)At}0sRw3rBe4]ua" variabletype="">sensor</field>
                                             </block>
                                           </value>
                                         </block>
                                       </value>
                                     </block>
                                   </value>
                                   <value name="ADD4">
                                     <block type="text" id="aCH6aN^+-()+-Z,9P1qc">
                                       <field name="TEXT">.</field>
                                     </block>
                                   </value>
                                   <value name="ADD5">
                                     <block type="procedures_callcustomreturn" id="]h^ME#v5[vEHu6BDWAw-">
                                       <mutation name="Punktkiller">
                                         <arg name="str"></arg>
                                       </mutation>
                                       <value name="ARG0">
                                         <block type="get_attr" id="{~=Y.%P~2,|4*2^JbZ*p">
                                           <value name="PATH">
                                             <shadow type="text" id="t7FkP$/$emT%_4N_S_5Q">
                                               <field name="TEXT">title</field>
                                             </shadow>
                                           </value>
                                           <value name="OBJECT">
                                             <block type="variables_get" id="CsZwX)34~VBzZfFKp=We">
                                               <field name="VAR" id="(OS6)At}0sRw3rBe4]ua" variabletype="">sensor</field>
                                             </block>
                                           </value>
                                         </block>
                                       </value>
                                     </block>
                                   </value>
                                 </block>
                               </value>
                               <next>
                                 <block type="controls_if" id="s$NJk]uP]Y5yAOT8A=H1">
                                   <value name="IF0">
                                     <block type="procedures_callcustomreturn" id="72HYING-9uU7xm`yh[XK">
                                       <mutation name="erzeugeZahlDP">
                                         <arg name="id"></arg>
                                         <arg name="Name"></arg>
                                         <arg name="unit"></arg>
                                       </mutation>
                                       <value name="ARG0">
                                         <block type="variables_get" id="OOs?a?hS^FnAI.$Qb?dU">
                                           <field name="VAR" id="I@-[Cj^I1}(-7m+VQ8Dj" variabletype="">idSensor</field>
                                         </block>
                                       </value>
                                       <value name="ARG1">
                                         <block type="get_attr" id="IER[s^cq8PlHqpH):2;$">
                                           <value name="PATH">
                                             <shadow type="text" id="RE!1h_[z_~VP(`#c2G0=">
                                               <field name="TEXT">title</field>
                                             </shadow>
                                           </value>
                                           <value name="OBJECT">
                                             <block type="variables_get" id="hosnIqKj=x~_(RraXuHa">
                                               <field name="VAR" id="(OS6)At}0sRw3rBe4]ua" variabletype="">sensor</field>
                                             </block>
                                           </value>
                                         </block>
                                       </value>
                                       <value name="ARG2">
                                         <block type="get_attr" id="OM-QpftsmZS_/O|A$nu!">
                                           <value name="PATH">
                                             <shadow type="text" id="Jm=2!V|Nemik!@?A[t:D">
                                               <field name="TEXT">unit</field>
                                             </shadow>
                                           </value>
                                           <value name="OBJECT">
                                             <block type="variables_get" id="80=z_{+i(*_-3LzR_gK;">
                                               <field name="VAR" id="(OS6)At}0sRw3rBe4]ua" variabletype="">sensor</field>
                                             </block>
                                           </value>
                                         </block>
                                       </value>
                                     </block>
                                   </value>
                                   <statement name="DO0">
                                     <block type="control_ex" id="ND8z?hF|iwiOE9Z$|eE`">
                                       <field name="TYPE">true</field>
                                       <field name="CLEAR_RUNNING">FALSE</field>
                                       <value name="OID">
                                         <shadow type="field_oid" id="v(.[s!{pa`7H$cGZ;#p|">
                                           <field name="oid">Object ID</field>
                                         </shadow>
                                         <block type="variables_get" id="BrQ|?@hXv_fV)?E?hOgM">
                                           <field name="VAR" id="I@-[Cj^I1}(-7m+VQ8Dj" variabletype="">idSensor</field>
                                         </block>
                                       </value>
                                       <value name="VALUE">
                                         <shadow type="logic_boolean" id="|a{Y{[:aCSj^Q?yicY#*">
                                           <field name="BOOL">TRUE</field>
                                         </shadow>
                                         <block type="math_rndfixed" id="hswSQt.b2yKyiK]=+j(`">
                                           <field name="n">1</field>
                                           <value name="x">
                                             <shadow type="math_number" id="1n/)#-Ii;1^OUCbmzISG">
                                               <field name="NUM">3.1234</field>
                                             </shadow>
                                             <block type="convert_tonumber" id="kg4Y~4dFGeTf1^5/f?V5">
                                               <value name="VALUE">
                                                 <block type="get_attr" id="/`rJ(E(8YdbX(f{g%4Wk" inline="false">
                                                   <value name="PATH">
                                                     <shadow type="text" id="CSi;C,!]C$km?/7YNito">
                                                       <field name="TEXT">lastMeasurement.value</field>
                                                     </shadow>
                                                   </value>
                                                   <value name="OBJECT">
                                                     <block type="variables_get" id="B~!k(q6k($rnISKRID@7">
                                                       <field name="VAR" id="(OS6)At}0sRw3rBe4]ua" variabletype="">sensor</field>
                                                     </block>
                                                   </value>
                                                 </block>
                                               </value>
                                             </block>
                                           </value>
                                         </block>
                                       </value>
                                       <value name="DELAY_MS">
                                         <shadow type="math_number" id="NXOOrA8-^iM:{:I/L?|-">
                                           <field name="NUM">0</field>
                                         </shadow>
                                       </value>
                                     </block>
                                   </statement>
                                 </block>
                               </next>
                             </block>
                           </statement>
                         </block>
                         <block type="procedures_defcustomnoreturn" id="%Ym[H;wPCw14-F~+qd!a" x="-688" y="-438">
                           <mutation statements="false">
                             <arg name="id" varid="F8FJH2:MYg!TEng|{`cX"></arg>
                             <arg name="Name" varid="kNmwW)zuGsFpRPSr%tI4"></arg>
                           </mutation>
                           <field name="NAME">Stations-Channel anlegen</field>
                           <field name="SCRIPT">aWQgPSAnamF2YXNjcmlwdC4nICsgaW5zdGFuY2UgKyAnLicgKyBpZDsKaWYoIWV4aXN0c09iamVjdChpZCkpIHsKICAgdmFyIG9iaiA9IHt9OwogICBvYmoudHlwZSA9ICdjaGFubmVsJzsKICAgb2JqLmNvbW1vbiA9IHt9OwogICBvYmouY29tbW9uLm5hbWUgPSBOYW1lOwogICBzZXRPYmplY3QoaWQsIG9iaik7Cn0=</field>
                           <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
                         </block>
                         <block type="procedures_defcustomreturn" id="|@dUe3W|[VZ`uP~L8^L." x="-687" y="-413">
                           <mutation statements="false">
                             <arg name="str" varid="=:T.5x=N7D*5*g`@lmVQ"></arg>
                           </mutation>
                           <field name="NAME">Punktkiller</field>
                           <field name="SCRIPT">cmV0dXJuIHN0ci5yZXBsYWNlKC9bXC5cc1wtXS9nLCAiXyIp</field>
                           <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
                         </block>
                         <block type="procedures_defcustomreturn" id="[a^U9+`y_=]GesO0(kJv" x="-688" y="-387">
                           <mutation statements="false">
                             <arg name="id" varid="F8FJH2:MYg!TEng|{`cX"></arg>
                             <arg name="Name" varid="kNmwW)zuGsFpRPSr%tI4"></arg>
                             <arg name="unit" varid="/Ob+6.k{E5c@No}z%#Fu"></arg>
                           </mutation>
                           <field name="NAME">erzeugeZahlDP</field>
                           <field name="SCRIPT">aWYoZXhpc3RzU3RhdGUoaWQpKSByZXR1cm4gdHJ1ZTsNCmNyZWF0ZVN0YXRlKGlkLCAwLCB7dHlwZTonbnVtYmVyJywgbmFtZTogTmFtZSwgdW5pdDp1bml0LCByZWFkOnRydWUsIHdyaXRlOmZhbHNlLCByb2xlOid2YWx1ZSd9KTs=</field>
                           <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
                         </block>
                         <block type="comment" id="r,^tOsf=lIoMh,tZCb+t" x="-687" y="-337">
                           <field name="COMMENT">Hier die Stations-Id eingeben</field>
                           <next>
                             <block type="variables_set" id="{Z@]+Tsgj`9a~63Nx/9t">
                               <field name="VAR" id="P}P_1?s%S89=9|ppf`Nx" variabletype="">Station</field>
                               <value name="VALUE">
                                 <block type="text" id="IjLVT[-@mv7%lCJ-(38r">
                                   <field name="TEXT">5dd2e6674ec04e001aa48f9e</field>
                                 </block>
                               </value>
                               <next>
                                 <block type="comment" id="lLJ!@]nJgIF8`2n{ptBs">
                                   <field name="COMMENT">Hier Unterverzeichnis im js-Verzeichnis eingeben</field>
                                   <next>
                                     <block type="comment" id="aluc5:I^O*I~:1N,i$9{">
                                       <field name="COMMENT">Punkt am Ende als Datensatztrenner nicht vergessen</field>
                                       <next>
                                         <block type="variables_set" id="4*=Fh?9d0ZF{Azz$i~o;">
                                           <field name="VAR" id="Z{~*0luN#Qp/IUr;|BmX" variabletype="">Unterverzeichnis</field>
                                           <value name="VALUE">
                                             <block type="text" id="b37|)*c1@OiX,,:!b^V@">
                                               <field name="TEXT">Luftdaten.</field>
                                             </block>
                                           </value>
                                           <next>
                                             <block type="variables_set" id=".Id#{.SiATpaCI[t9/Pb">
                                               <field name="VAR" id="%arR9:8r$Bg^H++?QiSv" variabletype="">URL</field>
                                               <value name="VALUE">
                                                 <block type="text_join" id="3,2Nmjr=CqF+.8mgNjMu">
                                                   <mutation items="2"></mutation>
                                                   <value name="ADD0">
                                                     <block type="text" id="W:|(T7`gJv3jBjE[W=a~">
                                                       <field name="TEXT">https://api.opensensemap.org/boxes/</field>
                                                     </block>
                                                   </value>
                                                   <value name="ADD1">
                                                     <block type="variables_get" id="$7jo45G0xdQ!;81^B|?t">
                                                       <field name="VAR" id="P}P_1?s%S89=9|ppf`Nx" variabletype="">Station</field>
                                                     </block>
                                                   </value>
                                                 </block>
                                               </value>
                                               <next>
                                                 <block type="schedule" id="~)SXp/emf@Z[*]}h(P*3">
                                                   <field name="SCHEDULE">*/10 * * * *</field>
                                                   <statement name="STATEMENT">
                                                     <block type="request" id="JYZ7{U|l##aK4-YGHzlF">
                                                       <mutation with_statement="true"></mutation>
                                                       <field name="WITH_STATEMENT">TRUE</field>
                                                       <field name="LOG"></field>
                                                       <value name="URL">
                                                         <shadow type="text" id="}Zb=fi2klg+*{JjH1}Da">
                                                           <field name="TEXT">text</field>
                                                         </shadow>
                                                         <block type="variables_get" id="eOg]UB./1-Xdqt!9xGJh">
                                                           <field name="VAR" id="%arR9:8r$Bg^H++?QiSv" variabletype="">URL</field>
                                                         </block>
                                                       </value>
                                                       <statement name="STATEMENT">
                                                         <block type="variables_set" id="[!uzwo(w1oVkQ~F(?A)m">
                                                           <field name="VAR" id="9k8j[#@42,2VE~mdj%7," variabletype="">obj</field>
                                                           <value name="VALUE">
                                                             <block type="convert_json2object" id="!/v!.Gs6SM-([dBZeGkv">
                                                               <value name="VALUE">
                                                                 <block type="variables_get" id="!]zXu89Uby~HDzHiuIPK">
                                                                   <field name="VAR" id="mfFi6HkOgN+sro=x^sXu" variabletype="">result</field>
                                                                 </block>
                                                               </value>
                                                             </block>
                                                           </value>
                                                           <next>
                                                             <block type="procedures_callcustomnoreturn" id="-Q=6Xhv-^1EO,@~X-Kpi">
                                                               <mutation name="Stations-Channel anlegen">
                                                                 <arg name="id"></arg>
                                                                 <arg name="Name"></arg>
                                                               </mutation>
                                                               <value name="ARG0">
                                                                 <block type="text_join" id="/]nFjJ*V?,1L}+ikLidn">
                                                                   <mutation items="2"></mutation>
                                                                   <value name="ADD0">
                                                                     <block type="variables_get" id="DVQ(]$VQWMa3!,ctO|@F">
                                                                       <field name="VAR" id="Z{~*0luN#Qp/IUr;|BmX" variabletype="">Unterverzeichnis</field>
                                                                     </block>
                                                                   </value>
                                                                   <value name="ADD1">
                                                                     <block type="variables_get" id="PKi7wPxc{rqKb6TPkp]T">
                                                                       <field name="VAR" id="P}P_1?s%S89=9|ppf`Nx" variabletype="">Station</field>
                                                                     </block>
                                                                   </value>
                                                                 </block>
                                                               </value>
                                                               <value name="ARG1">
                                                                 <block type="get_attr" id="[~%j%o--Nt|NFV@qEKqh">
                                                                   <value name="PATH">
                                                                     <shadow type="text" id="jxgr+n+8z3FUw)#lEB]V">
                                                                       <field name="TEXT">name</field>
                                                                     </shadow>
                                                                   </value>
                                                                   <value name="OBJECT">
                                                                     <block type="variables_get" id="^0*;qw)@bh9Y1A9p$?:*">
                                                                       <field name="VAR" id="9k8j[#@42,2VE~mdj%7," variabletype="">obj</field>
                                                                     </block>
                                                                   </value>
                                                                 </block>
                                                               </value>
                                                               <next>
                                                                 <block type="variables_set" id="UqPDAi3CC{PQ+5oJiX7F">
                                                                   <field name="VAR" id="%VO!Ye}Fho*S1ssX{uog" variabletype="">sensors</field>
                                                                   <value name="VALUE">
                                                                     <block type="get_attr" id="k.R(q@m(G%T3m]:3/-$%">
                                                                       <value name="PATH">
                                                                         <shadow type="text" id="v3C!U:sJgWJC.%RK*ubN">
                                                                           <field name="TEXT">sensors</field>
                                                                         </shadow>
                                                                       </value>
                                                                       <value name="OBJECT">
                                                                         <block type="variables_get" id="2b4dq3po@?YS8+M=)*Y,">
                                                                           <field name="VAR" id="9k8j[#@42,2VE~mdj%7," variabletype="">obj</field>
                                                                         </block>
                                                                       </value>
                                                                     </block>
                                                                   </value>
                                                                   <next>
                                                                     <block type="variables_set" id="S)/owQyx658G_[Zbkia#">
                                                                       <field name="VAR" id="kNmwW)zuGsFpRPSr%tI4" variabletype="">Name</field>
                                                                       <value name="VALUE">
                                                                         <block type="get_attr" id="Lp1;+kE.5QiwL}=2gXHU">
                                                                           <value name="PATH">
                                                                             <shadow type="text" id="U:dL(te!qtMXlRvM*U}$">
                                                                               <field name="TEXT">name</field>
                                                                             </shadow>
                                                                           </value>
                                                                           <value name="OBJECT">
                                                                             <block type="variables_get" id=".d+P-Ka+./|p2E1M!jh,">
                                                                               <field name="VAR" id="9k8j[#@42,2VE~mdj%7," variabletype="">obj</field>
                                                                             </block>
                                                                           </value>
                                                                         </block>
                                                                       </value>
                                                                       <next>
                                                                         <block type="timeouts_settimeout" id="3NS1-CM^#*QWXC+vVM[T">
                                                                           <field name="NAME">timeout</field>
                                                                           <field name="DELAY">500</field>
                                                                           <field name="UNIT">ms</field>
                                                                           <statement name="STATEMENT">
                                                                             <block type="controls_for" id="tj[*c^1-8U9Q:GJ?ErBG">
                                                                               <field name="VAR" id="rn64I/AwPbPo#;6x;zx$" variabletype="">i</field>
                                                                               <value name="FROM">
                                                                                 <shadow type="math_number" id="gf_Y7J$2ww(]9~i4BD|I">
                                                                                   <field name="NUM">1</field>
                                                                                 </shadow>
                                                                               </value>
                                                                               <value name="TO">
                                                                                 <shadow type="math_number" id="(M`)O/FN7c2d_#=ba0@l">
                                                                                   <field name="NUM">10</field>
                                                                                 </shadow>
                                                                                 <block type="lists_length" id="/AY%TvY!+^95Nnz)9uUS">
                                                                                   <value name="VALUE">
                                                                                     <block type="variables_get" id="ynt:^S)7},aLfA}tLrz5">
                                                                                       <field name="VAR" id="%VO!Ye}Fho*S1ssX{uog" variabletype="">sensors</field>
                                                                                     </block>
                                                                                   </value>
                                                                                 </block>
                                                                               </value>
                                                                               <value name="BY">
                                                                                 <shadow type="math_number" id="MUBmM!QpFpwUSOLGoIWX">
                                                                                   <field name="NUM">1</field>
                                                                                 </shadow>
                                                                               </value>
                                                                               <statement name="DO">
                                                                                 <block type="procedures_callnoreturn" id="v!l/^Y~lO,1U}^]L8lce">
                                                                                   <mutation name="Sensorwerte_auslesen">
                                                                                     <arg name="sensor"></arg>
                                                                                   </mutation>
                                                                                   <value name="ARG0">
                                                                                     <block type="lists_getIndex" id="C2FF;yAA@6_C1S76U7C^">
                                                                                       <mutation statement="false" at="true"></mutation>
                                                                                       <field name="MODE">GET</field>
                                                                                       <field name="WHERE">FROM_START</field>
                                                                                       <value name="VALUE">
                                                                                         <block type="variables_get" id="p8m7.WuO[PRw@XT$eFoO">
                                                                                           <field name="VAR" id="%VO!Ye}Fho*S1ssX{uog" variabletype="">sensors</field>
                                                                                         </block>
                                                                                       </value>
                                                                                       <value name="AT">
                                                                                         <block type="variables_get" id="U!)nYCJ71|QZKK_18r_`">
                                                                                           <field name="VAR" id="rn64I/AwPbPo#;6x;zx$" variabletype="">i</field>
                                                                                         </block>
                                                                                       </value>
                                                                                     </block>
                                                                                   </value>
                                                                                 </block>
                                                                               </statement>
                                                                             </block>
                                                                           </statement>
                                                                         </block>
                                                                       </next>
                                                                     </block>
                                                                   </next>
                                                                 </block>
                                                               </next>
                                                             </block>
                                                           </next>
                                                         </block>
                                                       </statement>
                                                     </block>
                                                   </statement>
                                                 </block>
                                               </next>
                                             </block>
                                           </next>
                                         </block>
                                       </next>
                                     </block>
                                   </next>
                                 </block>
                               </next>
                             </block>
                           </next>
                         </block>
                        </xml>
                        

                        Änderungen in v0.3.1:

                        • auslesen der Daten auf JSON-Attribute umgestellt
                        • Station erhält neben der ID auch den Klarnamen
                          • dieser Klarname kann editiert werden
                        • Auswertung erfolgt exakt nach Anzahl Sensoren
                          • keine Fehlermeldungen wegen "Leerlauf" der Parserroutine mehr
                        paul53 1 Reply Last reply Reply Quote 0
                        • paul53
                          paul53 @Homoran last edited by

                          @Homoran
                          setze Name auf Attribut "name" von obj
                          ist überflüssig, da die globale Variable Name nirgends verwendet wird.

                          Homoran 1 Reply Last reply Reply Quote 0
                          • Homoran
                            Homoran Global Moderator Administrators @paul53 last edited by Homoran

                            @paul53
                            Danke - ich muss da eh nochmal ran, weil der BME280 jetzt wieder den Luftdruck in Pa angibt

                            Das stammt noch aus meine Versuchen mit dem setObject - da hatte ich es verwendet

                            Homoran 1 Reply Last reply Reply Quote 0
                            • Homoran
                              Homoran Global Moderator Administrators @Homoran last edited by Homoran

                              @Homoran sagte in Luft-Messdaten von OpenSenseMap auslesen:

                              ich muss da eh nochmal ran, weil der BME280 jetzt wieder den Luftdruck in Pa angibt

                              @paul53

                              Wollte wieder eine Ersetzung einfügen, aber jetzt direkt meine json-"Kenntnisse" umsetzen.
                              Direkt bei der zweiten Zeile bin ich ins Schleudern gekommen.

                              Umstellung auf json.png

                              Ich fürchte ich kann hier nicht direkt mit den JSON-Daten arbeiten und muss doch auf Variable ausweichen.

                              Das sähe dann (wenn ich da jetzt keine Fehler reingebracht habe) so aus:
                              json_mit_Variablen.png

                              Oder gibt's da doch eine Möglichkeit JSON-Inhalte zu manipulieren

                              paul53 1 Reply Last reply Reply Quote 0
                              • paul53
                                paul53 @Homoran last edited by paul53

                                @Homoran
                                Vorschlag:

                                Blockly_temp.JPG

                                Homoran 1 Reply Last reply Reply Quote 0
                                • Homoran
                                  Homoran Global Moderator Administrators @paul53 last edited by

                                  @paul53 Wo zauberst du immer nur die Lösungen her, auf die kein "normaler" Mensch kommt.

                                  Meine Version funktioniert jetzt und ich habe sogar nicht auf title=Luftdruck sondern auf unit=Pa geprüft.
                                  Denke das ist sauberer.

                                  Werde deine Vorschlag trotzdem umsetzen, sieht einfach "runder" aus.

                                  paul53 1 Reply Last reply Reply Quote 0
                                  • paul53
                                    paul53 @Homoran last edited by

                                    @Homoran sagte:

                                    sondern auf unit=Pa geprüft.

                                    Ja, das ist besser.

                                    Homoran 1 Reply Last reply Reply Quote 0
                                    • Homoran
                                      Homoran Global Moderator Administrators @paul53 last edited by

                                      @paul53
                                      Aber mit dem prüfe-Baustein gibt es nicht die Möglichkeit noch weitere Fälle abzufangen wie mit falls...sonstfalls...

                                      Oder habe ich da wieder etwas übersehen?

                                      paul53 1 Reply Last reply Reply Quote 0
                                      • paul53
                                        paul53 @Homoran last edited by

                                        @Homoran sagte:

                                        mit dem prüfe-Baustein gibt es nicht die Möglichkeit noch weitere Fälle abzufangen wie mit falls...sonstfalls...

                                        Man kann schachteln.
                                        falls falsch prüfe ...

                                        Homoran 1 Reply Last reply Reply Quote 0
                                        • Homoran
                                          Homoran Global Moderator Administrators @paul53 last edited by

                                          @paul53 Danke - muss man nur aufpassen dass man nicht falsch abfragt sonst macht er aus allen anderen Einheiten [°C, ppm usw.] immer hPa 😂

                                          1 Reply Last reply Reply Quote 0
                                          • Homoran
                                            Homoran Global Moderator Administrators last edited by

                                            @paul53

                                            Das Skript läuft soweit ganz gut - nochmals Danke für die Weiterbildung!

                                            leider werden die Datenpunkte bei einer neuen Station (Skript kopiert und Station-ID geändert) bis auf Station-ID und Name der Station nicht beim ersten Durchlauf gefüllt.

                                            Ich denke das liegt nach wie vor an der asynchronen Abarbeitung, auch wenn es jetzt keine Errors mehr gibt.

                                            Bei dem Anlegen des Channel-DP habe ich anschließend einen Timeout, damit die weiteren DPs den fertigen Channel vorfinden.

                                            setObject_Verzoegerung.png

                                            Die Sensor DPs werden abr mit Wert 0 angelegt, was IMHO durch die Funktion bedingt ist.

                                            function ( id, Name, unit )

                                            if(existsState(id)) return true;
                                            createState(id, 0, {type:'number', name: Name, unit:unit, read:true, write:false, role:'value'});
                                            

                                            Kann/darf man hier den default-Wert (=0) durch eine weitere Variable ersetzen, die direkt den Wert enthält?

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

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            535
                                            Online

                                            31.6k
                                            Users

                                            79.5k
                                            Topics

                                            1.3m
                                            Posts

                                            blockly climate monitoring
                                            4
                                            59
                                            3144
                                            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