Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Funktion zum Seitenabruf per Get funktioniert nicht mehr

    NEWS

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    Funktion zum Seitenabruf per Get funktioniert nicht mehr

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

      Hallo,
      hatte hier im Forum mal eine Methode gefunden, mit der man Längen-/Breitengrade in eine "Klartext"-Adresse umwandeln konnte. Dies hat auch zuverlässig funktioniert. Nun bekomme ich folgenden Fehler:

      script.js.common.VIS.Auto.VWeGolfAdresseAusGPSKoordinaten: ReferenceError: request is not defined at script.js.common.VIS.Auto.VWeGolfAdresseAusGPSKoordinaten:2491:13 at new Promise (<anonymous>) at reqAsync (script.js.common.VIS.Auto.VWeGolfAdresseAusGPSKoordinaten:2481:16) at OSM_Reverse (script.js.common.VIS.Auto.VWeGolfAdresseAusGPSKoordinaten:2501:24) at script.js.common.VIS.Auto.VWeGolfAdresseAusGPSKoordinaten:2527:16 at script.js.common.VIS.Auto.VWeGolfAdresseAusGPSKoordinaten:2549:3 at Script.runInContext (node:vm:148:12) at Script.runInNewContext (node:vm:153:17) at execute (/opt/iobroker/node_modules/iobroker.javascript/main.js:1979:23) at prepareScript (/opt/iobroker/node_modules/iobroker.javascript/main.js:2228:13)
      

      Ich habe ein NPM Update durchgeführt - kann es daran liegen? Das Blockly dazu sieht so aus:

      <block xmlns="https://developers.google.com/blockly/xml" type="variables_set" id="wR~~7^?!0{b~ZWJW2z2Y" x="57" y="17">
        <field name="VAR" id="2]3hGy$Na|L2qX#+=;E8">lat</field>
        <value name="VALUE">
          <block type="convert_tonumber" id="hWzOOf8;.`B+Z9M:!wuy">
            <value name="VALUE">
              <block type="text_replace" id="iq$PAJMO5dQeXWkN:]f1">
                <value name="FROM">
                  <shadow type="text" id="skgW?L6sL,jkQD*MQ^=,">
                    <field name="TEXT">,</field>
                  </shadow>
                </value>
                <value name="TO">
                  <shadow type="text" id="f|IG4zBx+b#B_Hl,BmB~">
                    <field name="TEXT">.</field>
                  </shadow>
                </value>
                <value name="TEXT">
                  <shadow type="text" id="LK6OfG42WP@L^,K!cJlO">
                    <field name="TEXT">text</field>
                  </shadow>
                  <block type="convert_tostring" id="O$]q.ry,tjC;).lNA.Zc">
                    <value name="VALUE">
                      <block type="get_value" id="(^S9Up?34JmWvIN[g:zP">
                        <field name="ATTR">val</field>
                        <field name="OID">alias.0.Fahrzeuge.VW_eGolf_MP96E.POSITION_BREITENGRAD</field>
                      </block>
                    </value>
                  </block>
                </value>
              </block>
            </value>
          </block>
        </value>
        <next>
          <block type="debug" id="Mj})kCg^fazvUa.?[@N!">
            <field name="Severity">info</field>
            <value name="TEXT">
              <shadow type="text" id="%VvnK$gGYiUTOds]h/KE">
                <field name="TEXT">test</field>
              </shadow>
              <block type="variables_get" id="5}*nVoDiWWaX^^e,vd,E">
                <field name="VAR" id="2]3hGy$Na|L2qX#+=;E8">lat</field>
              </block>
            </value>
            <next>
              <block type="variables_set" id="|i,e7-xsVZtwL,YE9Pns">
                <field name="VAR" id=".hv$JjjT(QY(0c2!/tuc">lon</field>
                <value name="VALUE">
                  <block type="convert_tonumber" id="zdJ=q9d8[uma}!QaRdR`">
                    <value name="VALUE">
                      <block type="text_replace" id="1r;?,i(:@$$@}X:Dv,$j">
                        <value name="FROM">
                          <shadow type="text" id=",33EQg[hFkLIGnA5BkCi">
                            <field name="TEXT">,</field>
                          </shadow>
                        </value>
                        <value name="TO">
                          <shadow type="text" id="?JpAIBzxRE{og!G7%t6s">
                            <field name="TEXT">.</field>
                          </shadow>
                        </value>
                        <value name="TEXT">
                          <shadow type="text" id="LK6OfG42WP@L^,K!cJlO">
                            <field name="TEXT">text</field>
                          </shadow>
                          <block type="convert_tostring" id="srs+,w3bMkJO$su2JuSd">
                            <value name="VALUE">
                              <block type="get_value" id="SV4g.3=xJ~~crtmE9*=4">
                                <field name="ATTR">val</field>
                                <field name="OID">alias.0.Fahrzeuge.VW_eGolf_MP96E.POSITION_LAENGENGRAD</field>
                              </block>
                            </value>
                          </block>
                        </value>
                      </block>
                    </value>
                  </block>
                </value>
                <next>
                  <block type="debug" id="CO,[BAbspFgPnMa37]c^">
                    <field name="Severity">info</field>
                    <value name="TEXT">
                      <shadow type="text" id="%VvnK$gGYiUTOds]h/KE">
                        <field name="TEXT">test</field>
                      </shadow>
                      <block type="variables_get" id="f*X{XjU:U3=yy5[8bVl1">
                        <field name="VAR" id=".hv$JjjT(QY(0c2!/tuc">lon</field>
                      </block>
                    </value>
                    <next>
                      <block type="variables_set" id="gV3k#TgOw[TwD3PggX_z">
                        <field name="VAR" id="J3x^9.8?y5q~@YX!.0vq">zoom</field>
                        <value name="VALUE">
                          <block type="math_number" id="RiaGr]H5DPjOiCLI$~+H">
                            <field name="NUM">18</field>
                          </block>
                        </value>
                        <next>
                          <block type="variables_set" id="_]-UxYH%D~}#l6DWPyqA">
                            <field name="VAR" id="InM51wH+hhRZ1K}Uo6R:">result</field>
                            <value name="VALUE">
                              <block type="procedures_callcustomreturn" id="E6q6k3RA-DSW4n:wbmt5" inline="true">
                                <mutation name="OSM_Reverse">
                                  <arg name="lat"></arg>
                                  <arg name="lon"></arg>
                                  <arg name="zoom"></arg>
                                </mutation>
                                <value name="ARG0">
                                  <block type="variables_get" id="O~3vjlaQApGabQ#KZ_Np">
                                    <field name="VAR" id="2]3hGy$Na|L2qX#+=;E8">lat</field>
                                  </block>
                                </value>
                                <value name="ARG1">
                                  <block type="variables_get" id=";6In%LVgU8c~ZW=V^#!+">
                                    <field name="VAR" id=".hv$JjjT(QY(0c2!/tuc">lon</field>
                                  </block>
                                </value>
                                <value name="ARG2">
                                  <block type="variables_get" id="!Lp;DYb2Cg#%7WJ[ixj:">
                                    <field name="VAR" id="J3x^9.8?y5q~@YX!.0vq">zoom</field>
                                  </block>
                                </value>
                              </block>
                            </value>
                            <next>
                              <block type="debug" id="=kG9Q3BHtv,N12i)o/cd" inline="true">
                                <field name="Severity">debug</field>
                                <value name="TEXT">
                                  <shadow type="text" id="ik1UI0{#imdw4QxI,wuq">
                                    <field name="TEXT">test</field>
                                  </shadow>
                                  <block type="variables_get" id="ZJbVSK}WTjai..N)v+^}">
                                    <field name="VAR" id="InM51wH+hhRZ1K}Uo6R:">result</field>
                                  </block>
                                </value>
                                <next>
                                  <block type="variables_set" id="O{z96Lp@j3i8Slita#*W">
                                    <field name="VAR" id=";SRb,$QZLlU?vOmiT~JX">Strasse</field>
                                    <value name="VALUE">
                                      <block type="text" id=".F~*Z,w04}/`Zb~EHIO6">
                                        <field name="TEXT"></field>
                                      </block>
                                    </value>
                                    <next>
                                      <block type="variables_set" id="39@-t*shJUx-}=TcBs72">
                                        <field name="VAR" id="~jZ,3*n[d]KZ1(ana89o">Hausnummer</field>
                                        <value name="VALUE">
                                          <block type="text" id="lCo5cXfY=#t]_-9??cvm">
                                            <field name="TEXT"></field>
                                          </block>
                                        </value>
                                        <next>
                                          <block type="variables_set" id="Wa.e4=|kzt(4dQ2EsnIo">
                                            <field name="VAR" id="Q7gDYvdg}{GBIzzh?9vc">PLZ</field>
                                            <value name="VALUE">
                                              <block type="text" id="0X6gVH,Zq7X)L$UxO`bK">
                                                <field name="TEXT"></field>
                                              </block>
                                            </value>
                                            <next>
                                              <block type="variables_set" id="$a!IHGzO]*0gQ)FyRs1v">
                                                <field name="VAR" id="v]lk,gotsm)bM3Q2w9X:">Stadt</field>
                                                <value name="VALUE">
                                                  <block type="text" id="n6Q~K{?kb[4BO6$(X6rV">
                                                    <field name="TEXT"></field>
                                                  </block>
                                                </value>
                                                <next>
                                                  <block type="variables_set" id="z,*?N4M~aXp+cs$;LjM/">
                                                    <field name="VAR" id="-QG.FU1X4c1lz=sfcH?*">Ortsteil</field>
                                                    <value name="VALUE">
                                                      <block type="text" id="(-u~=9GnJ#Sr=cgq;l@*">
                                                        <field name="TEXT"></field>
                                                      </block>
                                                    </value>
                                                    <next>
                                                      <block type="variables_set" id=";l(%na=dPiyRgvjT`p7J">
                                                        <field name="VAR" id=";SRb,$QZLlU?vOmiT~JX">Strasse</field>
                                                        <value name="VALUE">
                                                          <block type="get_attr" id="4BRp8)RL(Z,ya1V7L%,k">
                                                            <value name="PATH">
                                                              <shadow type="text" id="@+Kn.LF%vkB35cm%To%G">
                                                                <field name="TEXT">address.road</field>
                                                              </shadow>
                                                            </value>
                                                            <value name="OBJECT">
                                                              <block type="variables_get" id="/rsi@S]q*[hct$N@3[U^">
                                                                <field name="VAR" id="InM51wH+hhRZ1K}Uo6R:">result</field>
                                                              </block>
                                                            </value>
                                                          </block>
                                                        </value>
                                                        <next>
                                                          <block type="variables_set" id="GF]n^bp:KR6CAP@XO@m~">
                                                            <field name="VAR" id="~jZ,3*n[d]KZ1(ana89o">Hausnummer</field>
                                                            <value name="VALUE">
                                                              <block type="get_attr" id="poO,V);aHMLGORNJUv:/">
                                                                <value name="PATH">
                                                                  <shadow type="text" id="LOCBUCh^8H,AcN*N5f,)">
                                                                    <field name="TEXT">address.house_number</field>
                                                                  </shadow>
                                                                </value>
                                                                <value name="OBJECT">
                                                                  <block type="variables_get" id="sIO)[*}W,ats$rr:v~:X">
                                                                    <field name="VAR" id="InM51wH+hhRZ1K}Uo6R:">result</field>
                                                                  </block>
                                                                </value>
                                                              </block>
                                                            </value>
                                                            <next>
                                                              <block type="variables_set" id="+|Z)LBF*uHLG_;s%`TMl">
                                                                <field name="VAR" id="Q7gDYvdg}{GBIzzh?9vc">PLZ</field>
                                                                <value name="VALUE">
                                                                  <block type="get_attr" id="Pq^Bjecjs`n?o,y?!}!c">
                                                                    <value name="PATH">
                                                                      <shadow type="text" id="[6i]bv|+F1;gx@d8c.)e">
                                                                        <field name="TEXT">address.postcode</field>
                                                                      </shadow>
                                                                    </value>
                                                                    <value name="OBJECT">
                                                                      <block type="variables_get" id="jEFim1`IaNOjxazQ;n8K">
                                                                        <field name="VAR" id="InM51wH+hhRZ1K}Uo6R:">result</field>
                                                                      </block>
                                                                    </value>
                                                                  </block>
                                                                </value>
                                                                <next>
                                                                  <block type="variables_set" id="$L;=BwnWkcz*c:Ja,v9A">
                                                                    <field name="VAR" id="v]lk,gotsm)bM3Q2w9X:">Stadt</field>
                                                                    <value name="VALUE">
                                                                      <block type="get_attr" id="bC`Q5Rr[PnjW}wgHvEBF">
                                                                        <value name="PATH">
                                                                          <shadow type="text" id="kTR_D-FK^72QX-fON74F">
                                                                            <field name="TEXT">address.town</field>
                                                                          </shadow>
                                                                        </value>
                                                                        <value name="OBJECT">
                                                                          <block type="variables_get" id="1FA1W?drJ[PO[.tc~HO)">
                                                                            <field name="VAR" id="InM51wH+hhRZ1K}Uo6R:">result</field>
                                                                          </block>
                                                                        </value>
                                                                      </block>
                                                                    </value>
                                                                    <next>
                                                                      <block type="variables_set" id="-%#I%)w((I9lwE;_)A#%">
                                                                        <field name="VAR" id="-QG.FU1X4c1lz=sfcH?*">Ortsteil</field>
                                                                        <value name="VALUE">
                                                                          <block type="text_join" id="RpLuH!Uf-MaFF~mb6h4p">
                                                                            <mutation items="2"></mutation>
                                                                            <value name="ADD0">
                                                                              <block type="text" id="}yk,46V7;kFJRO-Ip-O-">
                                                                                <field name="TEXT">-</field>
                                                                              </block>
                                                                            </value>
                                                                            <value name="ADD1">
                                                                              <block type="get_attr" id="Jhz8iS@D@-H8jo)JVk([">
                                                                                <value name="PATH">
                                                                                  <shadow type="text" id="iE;/).FovyaCD.wgvjTq">
                                                                                    <field name="TEXT">address.village</field>
                                                                                  </shadow>
                                                                                </value>
                                                                                <value name="OBJECT">
                                                                                  <block type="variables_get" id="OZmIZS]J_Gt347jYw7dB">
                                                                                    <field name="VAR" id="InM51wH+hhRZ1K}Uo6R:">result</field>
                                                                                  </block>
                                                                                </value>
                                                                              </block>
                                                                            </value>
                                                                          </block>
                                                                        </value>
                                                                        <next>
                                                                          <block type="update" id="k[sWzO09~=r|YgT[3,rV">
                                                                            <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                                                            <field name="OID">0_userdata.0.VIS.Auto.VWeGolfAktuelleAdresse</field>
                                                                            <field name="WITH_DELAY">FALSE</field>
                                                                            <value name="VALUE">
                                                                              <block type="text_join" id=",m%e).l|wRoGRhe[;8zz">
                                                                                <mutation items="8"></mutation>
                                                                                <value name="ADD0">
                                                                                  <block type="variables_get" id="5PrA%5d|f,*|,B|2@5gs">
                                                                                    <field name="VAR" id=";SRb,$QZLlU?vOmiT~JX">Strasse</field>
                                                                                  </block>
                                                                                </value>
                                                                                <value name="ADD1">
                                                                                  <block type="text" id="/q[J]i}y=7pbi!,x]XXg">
                                                                                    <field name="TEXT"> </field>
                                                                                  </block>
                                                                                </value>
                                                                                <value name="ADD2">
                                                                                  <block type="variables_get" id="4TMsfq5B00y%a5X66M(y">
                                                                                    <field name="VAR" id="~jZ,3*n[d]KZ1(ana89o">Hausnummer</field>
                                                                                  </block>
                                                                                </value>
                                                                                <value name="ADD3">
                                                                                  <block type="text_newline" id="FSC3E3feS]Fz!Kl(-)8h">
                                                                                    <field name="Type">\n</field>
                                                                                  </block>
                                                                                </value>
                                                                                <value name="ADD4">
                                                                                  <block type="variables_get" id="ULW5Y`|bkW*t}gR#Y1YJ">
                                                                                    <field name="VAR" id="Q7gDYvdg}{GBIzzh?9vc">PLZ</field>
                                                                                  </block>
                                                                                </value>
                                                                                <value name="ADD5">
                                                                                  <block type="text" id="t}me`s,puqFxmOti@,|^">
                                                                                    <field name="TEXT"> </field>
                                                                                  </block>
                                                                                </value>
                                                                                <value name="ADD6">
                                                                                  <block type="variables_get" id="l6XADM$`Pm6.lF,D{P{7">
                                                                                    <field name="VAR" id="v]lk,gotsm)bM3Q2w9X:">Stadt</field>
                                                                                  </block>
                                                                                </value>
                                                                                <value name="ADD7">
                                                                                  <block type="variables_get" id="*?:kFXJb-C`f@(1iT8HY">
                                                                                    <field name="VAR" id="-QG.FU1X4c1lz=sfcH?*">Ortsteil</field>
                                                                                  </block>
                                                                                </value>
                                                                              </block>
                                                                            </value>
                                                                            <next>
                                                                              <block type="update" id="VUUXD?6)(@jFTD8#RGH)">
                                                                                <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                                                                <field name="OID">0_userdata.0.VIS.Auto.VWeGolfAktuelleAdresseStrasse</field>
                                                                                <field name="WITH_DELAY">FALSE</field>
                                                                                <value name="VALUE">
                                                                                  <block type="text_join" id="tSVh73})0[7gg84@K8nc">
                                                                                    <mutation items="3"></mutation>
                                                                                    <value name="ADD0">
                                                                                      <block type="variables_get" id="9]%z5BFP7t:.,jLDj}N)">
                                                                                        <field name="VAR" id=";SRb,$QZLlU?vOmiT~JX">Strasse</field>
                                                                                      </block>
                                                                                    </value>
                                                                                    <value name="ADD1">
                                                                                      <block type="text" id="*ko{:x9|_FBXwExl5M.M">
                                                                                        <field name="TEXT"> </field>
                                                                                      </block>
                                                                                    </value>
                                                                                    <value name="ADD2">
                                                                                      <block type="variables_get" id="va3.aM*gLU?5$*xh:{!@">
                                                                                        <field name="VAR" id="~jZ,3*n[d]KZ1(ana89o">Hausnummer</field>
                                                                                      </block>
                                                                                    </value>
                                                                                  </block>
                                                                                </value>
                                                                                <next>
                                                                                  <block type="update" id="k~(_C]sBA}gRpOnM)`ir">
                                                                                    <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                                                                    <field name="OID">0_userdata.0.VIS.Auto.VWeGolfAktuelleAdresseOrt</field>
                                                                                    <field name="WITH_DELAY">FALSE</field>
                                                                                    <value name="VALUE">
                                                                                      <block type="text_join" id="Ygp#T[/r|WLC+3GaHw_J">
                                                                                        <mutation items="4"></mutation>
                                                                                        <value name="ADD0">
                                                                                          <block type="variables_get" id="6;Gl%};w+YmZ!eF=#/n*">
                                                                                            <field name="VAR" id="Q7gDYvdg}{GBIzzh?9vc">PLZ</field>
                                                                                          </block>
                                                                                        </value>
                                                                                        <value name="ADD1">
                                                                                          <block type="text" id="*138?,sa=O9r}Nc0)K:z">
                                                                                            <field name="TEXT"> </field>
                                                                                          </block>
                                                                                        </value>
                                                                                        <value name="ADD2">
                                                                                          <block type="variables_get" id="A*;egBI0mMMO?Os!Z.p|">
                                                                                            <field name="VAR" id="v]lk,gotsm)bM3Q2w9X:">Stadt</field>
                                                                                          </block>
                                                                                        </value>
                                                                                        <value name="ADD3">
                                                                                          <block type="variables_get" id="n}hcIN-H_l47mmj0kZg}">
                                                                                            <field name="VAR" id="-QG.FU1X4c1lz=sfcH?*">Ortsteil</field>
                                                                                          </block>
                                                                                        </value>
                                                                                      </block>
                                                                                    </value>
                                                                                    <next>
                                                                                      <block type="update" id="$Bvh[[ajBZW)=_VK-^_,">
                                                                                        <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                                                                                        <field name="OID">0_userdata.0.VIS.Auto.VWeGolfAktuelleAdresseAktualisierungszeit</field>
                                                                                        <field name="WITH_DELAY">FALSE</field>
                                                                                        <value name="VALUE">
                                                                                          <block type="time_get" id=".)CEL*sN#UjZTi]hDA?P">
                                                                                            <mutation xmlns="http://www.w3.org/1999/xhtml" format="true" language="false"></mutation>
                                                                                            <field name="OPTION">custom</field>
                                                                                            <field name="FORMAT">TT.MM.JJJJ SS:mm:ss</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>
                                        </next>
                                      </block>
                                    </next>
                                  </block>
                                </next>
                              </block>
                            </next>
                          </block>
                        </next>
                      </block>
                    </next>
                  </block>
                </next>
              </block>
            </next>
          </block>
        </next>
      </block>
      

      Die JS-Funktion, die den Fehler wohl verursacht, so:

      let result;
      function reqAsync() {
          return new Promise(function(resolve, reject){
              const options = {
                  url: 'https://nominatim.openstreetmap.org/reverse.php?format=json&lat=' + lat + '&lon=' + lon + '&zoom=' + zoom,
                  method: 'GET',
                  headers: {
                      'Accept': 'application/json',
                      'Accept-Charset': 'utf-8',
                      'User-Agent': 'iobroker script'
                  }
              }
              request(options, function(err,response,body){
                  if(response.statusCode != 200) {
                      reject();
                  }
                  resolve(JSON.parse(body));
              })
          })
      }
      
      try {
          result = await reqAsync();
      } catch(e) {
          log(e);
          result = e;
      }
      return result;
      
      
      haus-automatisierung Codierknecht 2 Replies Last reply Reply Quote 0
      • haus-automatisierung
        haus-automatisierung Developer Most Active @MP_Trixi last edited by

        @mp_trixi https://github.com/ioBroker/ioBroker.javascript/blob/master/docs/en/upgrade-guide.md#request-to-httpget

        1 Reply Last reply Reply Quote 3
        • Jey Cee
          Jey Cee Developer last edited by Jey Cee

          @mp_trixi das modul request ist veraltet und wurde aus dem Javascript Adapter entfernt.

          Hier geht es darum request durch die neue Methode httpGet zu ersetzen: https://forum.iobroker.net/topic/74885/hilfe-bei-skripte-von-request-auf-httpget-umbauen

          @haus-automatisierung wusste nicht das du eine Anleitung dazu geschrieben hast. Sehr cool.

          M 1 Reply Last reply Reply Quote 0
          • M
            MP_Trixi @Jey Cee last edited by

            @jey-cee
            @haus-automatisierung

            Ein Wahnsinn wie schnell das hier geht. Danke Euch!!! Ich schau mir das mal an ob ich mit meinen limitierten Mitteln das hinbekomme.

            1 Reply Last reply Reply Quote 0
            • Codierknecht
              Codierknecht Developer Most Active @MP_Trixi last edited by

              @mp_trixi
              Wenn JS eine Alternative wäre:

              const axios = require('axios');
              
              // Reverse-Geocoding anhand der aktuellen Koordinaten
              async function updateLocation(latitude, longitude) {
                  const url = `https://nominatim.openstreetmap.org/reverse?lat=${latitude}&lon=${longitude}&format=json`;
                  const response = await axios.get(url);
                  if (response && response.data.display_name) {
                    log('Standort: ' + response.data.display_name);
                    setState('0_userdata.0.standort', response.data.display_name, true);
                  }
              }
              
              
              haus-automatisierung 1 Reply Last reply Reply Quote 0
              • haus-automatisierung
                haus-automatisierung Developer Most Active @Codierknecht last edited by

                @codierknecht Wo siehst Du den Vorteil von axios gegenüber den internen httpGet Methoden?

                Codierknecht jolic 2 Replies Last reply Reply Quote 0
                • Codierknecht
                  Codierknecht Developer Most Active @haus-automatisierung last edited by

                  @haus-automatisierung
                  Gar keinen.
                  Ich nutze halt überall axios. Also bleibe ich dabei 😉

                  1 Reply Last reply Reply Quote 0
                  • jolic
                    jolic @haus-automatisierung last edited by jolic

                    @haus-automatisierung said in Funktion zum Seitenabruf per Get funktioniert nicht mehr:

                    Wo siehst Du den Vorteil von axios gegenüber den internen httpGet Methoden?

                    Hi, rein interessehalber, weil ich auch gerne axios verwende: Die internen httpGet-Methoden in ioBroker nutzen (meines Wissens) keine Promises, sondern basieren auf Callback-Funktionen. Axios verwendet Promises, was den Umgang mit asynchronen Operationen vereinfacht.

                    Für einfache Anfragen sind die internen httpGet-Methoden ausreichend. Für komplexere Anfragen, bessere Fehlerbehandlung und saubereren Code finde ich Axios oft besser geeignet (meine Meinung).

                    haus-automatisierung 1 Reply Last reply Reply Quote 0
                    • haus-automatisierung
                      haus-automatisierung Developer Most Active @jolic last edited by

                      @jolic Dann schau gerne mal in die Doku und verwende die asynchronen Funktionen httpGetAsynx und httpPostAsync. Dann haste auch ein Promise.

                      jolic 1 Reply Last reply Reply Quote 1
                      • jolic
                        jolic @haus-automatisierung last edited by

                        @haus-automatisierung said in Funktion zum Seitenabruf per Get funktioniert nicht mehr:

                        @jolic Dann schau gerne mal in die Doku und verwende die asynchronen Funktionen httpGetAsynx und httpPostAsync. Dann haste auch ein Promise.

                        Danke dir, das ist gut zu wissen!

                        Da der interne httpGet-Befehl in ioBroker nativ verfügbar ist, werde ich mir diesen bei meinem nächsten Projekt genauer anschauen.

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

                        Support us

                        ioBroker
                        Community Adapters
                        Donate

                        1.1k
                        Online

                        31.7k
                        Users

                        79.7k
                        Topics

                        1.3m
                        Posts

                        5
                        10
                        406
                        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