Skip to content
  • Home
  • Recent
  • Tags
  • 0 Unread 0
  • Categories
  • Unreplied
  • Popular
  • GitHub
  • Docu
  • Hilfe
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
ioBroker Logo

Community Forum

donate donate
  1. ioBroker Community Home
  2. Deutsch
  3. Skripten / Logik
  4. JavaScript
  5. [gel.] Script: Adresse ermitteln -> axios ändern in httpget

NEWS

  • Monatsrückblick Januar/Februar 2026 ist online!
    BluefoxB
    Bluefox
    16
    1
    355

  • Jahresrückblick 2025 – unser neuer Blogbeitrag ist online! ✨
    BluefoxB
    Bluefox
    17
    1
    4.8k

  • Neuer Blogbeitrag: Monatsrückblick - Dezember 2025 🎄
    BluefoxB
    Bluefox
    13
    1
    1.3k

[gel.] Script: Adresse ermitteln -> axios ändern in httpget

Scheduled Pinned Locked Moved JavaScript
33 Posts 7 Posters 3.2k Views 5 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • bahnuhrB Online
    bahnuhrB Online
    bahnuhr
    Forum Testing Most Active
    wrote on last edited by bahnuhr
    #1

    Hallo,
    habe folgendes Script mit axios:

    var latitude = 48.46567;
    var longitude = 9.7107;
    const axios = require('axios');
    
    updateLocation(latitude, longitude);
    
    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 (response.data)
          log (response.data.display_name);
          return(response.data.display_name);
        }
    }
    

    Dies funktioniert auch einwandfrei. Nun möchte ich dieses umbauen um den httpget zu nutzen.
    Bekomme dies aber nicht hin. Ob async, await notwendig ist, weiß ich auch nicht genau.

    Meine Versuche endeten in Fehlermeldung, ala:

    script.js.Scripte.System.Adresse: { statusCode: 403, data: '<html>\n' + '<head>\n' + '<title>Access blocked</title>\n' + '</head>\n' + '<body>\n' + '<h1>Access blocked</h1>\n' + '\n' + '<p>You have been blocked because you have violated the\n' + '<a href="https://operations.osmfoundation.org/policies/nominatim/">usage policy</a>\n' + "of OSM's Nominatim geocoding service. Please be aware that OSM's resources are\n" + 'limited and shared between many users. The usage policy is there to ensure that\n' + 'the service remains usable for everybody.</p>\n' + '\n' + '<p>Please review the terms and make sure that your\n' + 'software adheres to the terms. You should in particular verify that you have set a\n' + '<b>custom HTTP referrer or HTTP user agent</b> that identifies your application, and\n' + 'that you are not overusing the service with massive bulk requests.</p>\n' + '\n' + '<p>If you feel that this block is unjustified or remains after you have adopted\n' + 'your usage, you may contact the Nominatim system administrator at\n' + 'nominatim@openstreetmap.org to have this block lifted.</p>\n' + '</body>\n' + '</head>\n', headers: Object [AxiosHeaders] { server: 'nginx', date: 'Wed, 04 Sep 2024 12:58:37 GMT', 'content-type': 'text/html', 'content-length': '941', connection: 'keep-alive', 'keep-alive': 'timeout=20', etag: '"64c63660-3ad"' }, responseTime: 147 }
    

    Bitte mir mal auf die Sprünge helfen.
    Danke.


    Wenn ich helfen konnte, dann Daumen hoch (Pfeil nach oben)!
    Danke.
    gute Forenbeiträge: https://forum.iobroker.net/topic/51555/hinweise-f%C3%BCr-gute-forenbeitr%C3%A4ge
    ScreenToGif :https://www.screentogif.com/downloads.html

    HomoranH 3 Replies Last reply
    0
    • bahnuhrB bahnuhr

      Hallo,
      habe folgendes Script mit axios:

      var latitude = 48.46567;
      var longitude = 9.7107;
      const axios = require('axios');
      
      updateLocation(latitude, longitude);
      
      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 (response.data)
            log (response.data.display_name);
            return(response.data.display_name);
          }
      }
      

      Dies funktioniert auch einwandfrei. Nun möchte ich dieses umbauen um den httpget zu nutzen.
      Bekomme dies aber nicht hin. Ob async, await notwendig ist, weiß ich auch nicht genau.

      Meine Versuche endeten in Fehlermeldung, ala:

      script.js.Scripte.System.Adresse: { statusCode: 403, data: '<html>\n' + '<head>\n' + '<title>Access blocked</title>\n' + '</head>\n' + '<body>\n' + '<h1>Access blocked</h1>\n' + '\n' + '<p>You have been blocked because you have violated the\n' + '<a href="https://operations.osmfoundation.org/policies/nominatim/">usage policy</a>\n' + "of OSM's Nominatim geocoding service. Please be aware that OSM's resources are\n" + 'limited and shared between many users. The usage policy is there to ensure that\n' + 'the service remains usable for everybody.</p>\n' + '\n' + '<p>Please review the terms and make sure that your\n' + 'software adheres to the terms. You should in particular verify that you have set a\n' + '<b>custom HTTP referrer or HTTP user agent</b> that identifies your application, and\n' + 'that you are not overusing the service with massive bulk requests.</p>\n' + '\n' + '<p>If you feel that this block is unjustified or remains after you have adopted\n' + 'your usage, you may contact the Nominatim system administrator at\n' + 'nominatim@openstreetmap.org to have this block lifted.</p>\n' + '</body>\n' + '</head>\n', headers: Object [AxiosHeaders] { server: 'nginx', date: 'Wed, 04 Sep 2024 12:58:37 GMT', 'content-type': 'text/html', 'content-length': '941', connection: 'keep-alive', 'keep-alive': 'timeout=20', etag: '"64c63660-3ad"' }, responseTime: 147 }
      

      Bitte mir mal auf die Sprünge helfen.
      Danke.

      HomoranH Do not disturb
      HomoranH Do not disturb
      Homoran
      Global Moderator Administrators
      wrote on last edited by
      #2

      @bahnuhr sagte in Script: Adresse ermitteln -> axios ändern in httpget:

      statusCode: 403,

      not permitted!

      kein Support per PN! - Fragen im Forum stellen -
      Benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat.
      Das Forum freut sich über eine Spende. Benutzt dazu den Spendenbutton im Header. Danke!
      der Installationsfixer: curl -fsL https://iobroker.net/fix.sh | bash -

      bahnuhrB 1 Reply Last reply
      0
      • HomoranH Homoran

        @bahnuhr sagte in Script: Adresse ermitteln -> axios ändern in httpget:

        statusCode: 403,

        not permitted!

        bahnuhrB Online
        bahnuhrB Online
        bahnuhr
        Forum Testing Most Active
        wrote on last edited by
        #3

        @homoran
        Ja, das ist klar.
        Aber warum ?

        mit axios geht es.
        mit httpget geht es nicht.

        Kann ich gar nicht glauben.


        Wenn ich helfen konnte, dann Daumen hoch (Pfeil nach oben)!
        Danke.
        gute Forenbeiträge: https://forum.iobroker.net/topic/51555/hinweise-f%C3%BCr-gute-forenbeitr%C3%A4ge
        ScreenToGif :https://www.screentogif.com/downloads.html

        F 1 Reply Last reply
        0
        • bahnuhrB bahnuhr

          Hallo,
          habe folgendes Script mit axios:

          var latitude = 48.46567;
          var longitude = 9.7107;
          const axios = require('axios');
          
          updateLocation(latitude, longitude);
          
          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 (response.data)
                log (response.data.display_name);
                return(response.data.display_name);
              }
          }
          

          Dies funktioniert auch einwandfrei. Nun möchte ich dieses umbauen um den httpget zu nutzen.
          Bekomme dies aber nicht hin. Ob async, await notwendig ist, weiß ich auch nicht genau.

          Meine Versuche endeten in Fehlermeldung, ala:

          script.js.Scripte.System.Adresse: { statusCode: 403, data: '<html>\n' + '<head>\n' + '<title>Access blocked</title>\n' + '</head>\n' + '<body>\n' + '<h1>Access blocked</h1>\n' + '\n' + '<p>You have been blocked because you have violated the\n' + '<a href="https://operations.osmfoundation.org/policies/nominatim/">usage policy</a>\n' + "of OSM's Nominatim geocoding service. Please be aware that OSM's resources are\n" + 'limited and shared between many users. The usage policy is there to ensure that\n' + 'the service remains usable for everybody.</p>\n' + '\n' + '<p>Please review the terms and make sure that your\n' + 'software adheres to the terms. You should in particular verify that you have set a\n' + '<b>custom HTTP referrer or HTTP user agent</b> that identifies your application, and\n' + 'that you are not overusing the service with massive bulk requests.</p>\n' + '\n' + '<p>If you feel that this block is unjustified or remains after you have adopted\n' + 'your usage, you may contact the Nominatim system administrator at\n' + 'nominatim@openstreetmap.org to have this block lifted.</p>\n' + '</body>\n' + '</head>\n', headers: Object [AxiosHeaders] { server: 'nginx', date: 'Wed, 04 Sep 2024 12:58:37 GMT', 'content-type': 'text/html', 'content-length': '941', connection: 'keep-alive', 'keep-alive': 'timeout=20', etag: '"64c63660-3ad"' }, responseTime: 147 }
          

          Bitte mir mal auf die Sprünge helfen.
          Danke.

          HomoranH Do not disturb
          HomoranH Do not disturb
          Homoran
          Global Moderator Administrators
          wrote on last edited by
          #4

          @bahnuhr sagte in Script: Adresse ermitteln -> axios ändern in httpget:

          You have been blocked because you have violated the "https://operations.osmfoundation.org/policies/nominatim/

          ich fürchte du hast es zu oft versucht

          kein Support per PN! - Fragen im Forum stellen -
          Benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat.
          Das Forum freut sich über eine Spende. Benutzt dazu den Spendenbutton im Header. Danke!
          der Installationsfixer: curl -fsL https://iobroker.net/fix.sh | bash -

          1 Reply Last reply
          0
          • bahnuhrB bahnuhr

            Hallo,
            habe folgendes Script mit axios:

            var latitude = 48.46567;
            var longitude = 9.7107;
            const axios = require('axios');
            
            updateLocation(latitude, longitude);
            
            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 (response.data)
                  log (response.data.display_name);
                  return(response.data.display_name);
                }
            }
            

            Dies funktioniert auch einwandfrei. Nun möchte ich dieses umbauen um den httpget zu nutzen.
            Bekomme dies aber nicht hin. Ob async, await notwendig ist, weiß ich auch nicht genau.

            Meine Versuche endeten in Fehlermeldung, ala:

            script.js.Scripte.System.Adresse: { statusCode: 403, data: '<html>\n' + '<head>\n' + '<title>Access blocked</title>\n' + '</head>\n' + '<body>\n' + '<h1>Access blocked</h1>\n' + '\n' + '<p>You have been blocked because you have violated the\n' + '<a href="https://operations.osmfoundation.org/policies/nominatim/">usage policy</a>\n' + "of OSM's Nominatim geocoding service. Please be aware that OSM's resources are\n" + 'limited and shared between many users. The usage policy is there to ensure that\n' + 'the service remains usable for everybody.</p>\n' + '\n' + '<p>Please review the terms and make sure that your\n' + 'software adheres to the terms. You should in particular verify that you have set a\n' + '<b>custom HTTP referrer or HTTP user agent</b> that identifies your application, and\n' + 'that you are not overusing the service with massive bulk requests.</p>\n' + '\n' + '<p>If you feel that this block is unjustified or remains after you have adopted\n' + 'your usage, you may contact the Nominatim system administrator at\n' + 'nominatim@openstreetmap.org to have this block lifted.</p>\n' + '</body>\n' + '</head>\n', headers: Object [AxiosHeaders] { server: 'nginx', date: 'Wed, 04 Sep 2024 12:58:37 GMT', 'content-type': 'text/html', 'content-length': '941', connection: 'keep-alive', 'keep-alive': 'timeout=20', etag: '"64c63660-3ad"' }, responseTime: 147 }
            

            Bitte mir mal auf die Sprünge helfen.
            Danke.

            HomoranH Do not disturb
            HomoranH Do not disturb
            Homoran
            Global Moderator Administrators
            wrote on last edited by
            #5

            @bahnuhr sagte in Script: Adresse ermitteln -> axios ändern in httpget:

            make sure that your 'software adheres to the terms. You should in particular verify that you have set a custom HTTP referrer or HTTP user agent that identifies your application, and 'that you are not overusing the service with massive bulk requests

            kein Support per PN! - Fragen im Forum stellen -
            Benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat.
            Das Forum freut sich über eine Spende. Benutzt dazu den Spendenbutton im Header. Danke!
            der Installationsfixer: curl -fsL https://iobroker.net/fix.sh | bash -

            1 Reply Last reply
            0
            • bahnuhrB bahnuhr

              @homoran
              Ja, das ist klar.
              Aber warum ?

              mit axios geht es.
              mit httpget geht es nicht.

              Kann ich gar nicht glauben.

              F Offline
              F Offline
              fastfoot
              wrote on last edited by
              #6

              @bahnuhr warum überhaupt umstellen? httpGet nutzt unter der Haube eh axios, löscht aber den default user-agent den axios ohne Angabe desselben wohl setzt. Anyway:

              var latitude = 48.46567;
              var longitude = 9.7107;
              
              updateLocation(latitude, longitude);
              
              async function updateLocation(latitude, longitude) {
                  const url = `https://nominatim.openstreetmap.org/reverse?lat=${latitude}&lon=${longitude}&format=json`;
                  const response = await httpGetAsync(url, { headers: { "user-agent": 'ioBroker script' } });
                  const data = JSON.parse(response.data);
                  if (response && data) {
                      log(data)
                      log(data.display_name);
                      return (data.display_name);
                  }
              }
              
              

              iobroker läuft unter Docker auf QNAP TS-451+
              SkriptRecovery: https://forum.iobroker.net/post/930558

              haus-automatisierungH 1 Reply Last reply
              0
              • F fastfoot

                @bahnuhr warum überhaupt umstellen? httpGet nutzt unter der Haube eh axios, löscht aber den default user-agent den axios ohne Angabe desselben wohl setzt. Anyway:

                var latitude = 48.46567;
                var longitude = 9.7107;
                
                updateLocation(latitude, longitude);
                
                async function updateLocation(latitude, longitude) {
                    const url = `https://nominatim.openstreetmap.org/reverse?lat=${latitude}&lon=${longitude}&format=json`;
                    const response = await httpGetAsync(url, { headers: { "user-agent": 'ioBroker script' } });
                    const data = JSON.parse(response.data);
                    if (response && data) {
                        log(data)
                        log(data.display_name);
                        return (data.display_name);
                    }
                }
                
                
                haus-automatisierungH Online
                haus-automatisierungH Online
                haus-automatisierung
                Developer Most Active
                wrote on last edited by
                #7

                @fastfoot Ich meine hier gab es irgendwo mal Scripts, welche bei jeder Anfrage einen anderen User-Agent generiert haben (um zu verhindern, dass OpenStreeMap einen aussperrt?). Scheint ja ein recht spezielles Thema zu sein.

                🧑‍🎓 Autor des beliebten ioBroker-Master-Kurses
                🎥 Tutorials rund um das Thema DIY-Smart-Home: https://haus-automatisierung.com/
                📚 Meine inoffizielle ioBroker Dokumentation

                Ro75R DJMarc75D F 3 Replies Last reply
                1
                • haus-automatisierungH haus-automatisierung

                  @fastfoot Ich meine hier gab es irgendwo mal Scripts, welche bei jeder Anfrage einen anderen User-Agent generiert haben (um zu verhindern, dass OpenStreeMap einen aussperrt?). Scheint ja ein recht spezielles Thema zu sein.

                  Ro75R Offline
                  Ro75R Offline
                  Ro75
                  wrote on last edited by
                  #8

                  @haus-automatisierung

                  das ist meine Lösung für einen Random-USER-Agent

                  function UAChrome() {
                      const Plattform = Math.floor(Math.random() * 2)
                      const chromeVersion = Math.floor(Math.random() * 20) + 60;
                      const webkitVersion = Math.floor(Math.random() * 700) + 500;
                      const osPlatform = Plattform == 1 ? 'Win64; x64' : 'Macintosh; Intel Mac OS X 10_15_0';
                      const userAgent = `Mozilla/5.0 (${osPlatform}) AppleWebKit/${webkitVersion}.36 (KHTML, like Gecko) Chrome/${chromeVersion}.0.3163.100 Safari/${webkitVersion}.36`;
                      return userAgent;
                  }
                  
                  function UAFirefox() {
                      const Plattform = Math.floor(Math.random() * 2)
                      const firefoxVersion = Math.floor(Math.random() * 5) + 55;
                      const geckoVersion = Math.floor(Math.random() * 30) + 20100101;
                      const osPlatform = Plattform == 1 ? 'Win64; x64' : 'Macintosh; Intel Mac OS X 10_15_0';
                      const userAgent = `Mozilla/5.0 (${osPlatform}; rv: ${firefoxVersion}.0) Gecko/${geckoVersion} Firefox/${firefoxVersion}.0`;
                      return userAgent;
                  }
                  
                  function UASafari() {
                      const Plattform = Math.floor(Math.random() * 2)
                      const safariVersion = Math.floor(Math.random() * 5) + 10;
                      const osPlatform = Plattform == 1 ? 'Win64; x64' : 'Macintosh; Intel Mac OS X 10_15_0';
                      const userAgent = `Mozilla/5.0 (${osPlatform}) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/${safariVersion}.1.15 Safari/605.1.15`;
                      return userAgent;
                    }
                  
                  function UAAndroid() {
                      const androidVersion = Math.floor(Math.random() * 5) + 5;
                      const chromeVersion = Math.floor(Math.random() * 20) + 60;
                      const webkitVersion = Math.floor(Math.random() * 700) + 500;
                      const osPlatform = `Linux; Android ${androidVersion}.${Math.floor(Math.random() * 10)}; en-us; Nexus 6 Build/LYZ28M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${chromeVersion}.0.3163.98 Mobile Safari/${webkitVersion}.36`;
                      const userAgent = `Mozilla/5.0 (${osPlatform}`;
                      return userAgent;
                  }
                  
                  function UAIos() {
                      const iosVersion = Math.floor(Math.random() * 5) + 9;
                      const safariVersion = Math.floor(Math.random() * 5) + 600;
                      const webkitVersion = Math.floor(Math.random() * 700) + 500;
                      const osPlatform = `CPU iPhone OS ${iosVersion}_${Math.floor(Math.random() * 10)} like Mac OS X) AppleWebKit/${webkitVersion}.60 (KHTML, like Gecko) Version/${safariVersion}.0 Mobile/15E148 Safari/${webkitVersion}.60`;
                      const userAgent = `Mozilla/5.0 (${osPlatform}`;
                      return userAgent;
                  }
                  
                  function RUA() {
                      const UA = Math.floor(Math.random() * 4)
                      var UserAgent = '';
                  
                      if (UA == 0) {
                          UserAgent = UAChrome();
                      } else if (UA == 1) {
                          UserAgent = UAFirefox();
                      } else if (UA == 2) {
                          UserAgent = UASafari();
                      } else if (UA == 3) {
                          UserAgent = UAAndroid();
                      } else if (UA == 4) {
                          UserAgent = UAIos();
                      }
                      return UserAgent;
                  }
                  
                  console.log(RUA());
                  

                  @homoran sagte in Script: Adresse ermitteln -> axios ändern in httpget:

                  You have been blocked because you have violated the "https://operations.osmfoundation.org/policies/nominatim/

                  Maximal pro Tag 2500 Aufrufe.

                  Ro75.

                  SERVER = Beelink U59 16GB DDR4 RAM 512GB SSD, FB 7490, FritzDect 200+301+440, ConBee II, Zigbee Aqara Sensoren + NOUS A1Z, NOUS A1T, Philips Hue ** ioBroker, REDIS, influxdb2, Grafana, PiHole, Plex-Mediaserver, paperless-ngx (Docker), MariaDB + phpmyadmin *** VIS-Runtime = Intel NUC 8GB RAM 128GB SSD + 24" Touchscreen

                  1 Reply Last reply
                  3
                  • haus-automatisierungH haus-automatisierung

                    @fastfoot Ich meine hier gab es irgendwo mal Scripts, welche bei jeder Anfrage einen anderen User-Agent generiert haben (um zu verhindern, dass OpenStreeMap einen aussperrt?). Scheint ja ein recht spezielles Thema zu sein.

                    DJMarc75D Offline
                    DJMarc75D Offline
                    DJMarc75
                    wrote on last edited by
                    #9

                    @haus-automatisierung sagte in Script: Adresse ermitteln -> axios ändern in httpget:

                    hier gab es irgendwo mal Scripts, welche bei jeder Anfrage einen anderen User-Agent generiert haben

                    ja, irgendwo war da was - und daraus hab ich mir ein Blockly mit Funktion gebaut.

                    Ich selbst kann kein JS aber ich stelle mal den generierten JS-Code aus meinem Blockly rein:

                    var lon, lat, sDP, json, strasse, hausnummer, plz, stadt;
                    
                    // Beschreibe diese Funktion …
                    async function osmResolve(lon, lat, sDP) {
                        function UAChrome() {
                            const Plattform = Math.floor(Math.random() * 2)
                            const chromeVersion = Math.floor(Math.random() * 20) + 60;
                            const webkitVersion = Math.floor(Math.random() * 700) + 500;
                            const osPlatform = Plattform == 1 ? 'Win64; x64' : 'Macintosh; Intel Mac OS X 10_15_0';
                            const userAgent = `Mozilla/5.0 (${osPlatform}) AppleWebKit/${webkitVersion}.36 (KHTML, like Gecko) Chrome/${chromeVersion}.0.3163.100 Safari/${webkitVersion}.36`;
                            return userAgent;
                        }
                    
                        function UAFirefox() {
                            const Plattform = Math.floor(Math.random() * 2)
                            const firefoxVersion = Math.floor(Math.random() * 5) + 55;
                            const geckoVersion = Math.floor(Math.random() * 30) + 20100101;
                            const osPlatform = Plattform == 1 ? 'Win64; x64' : 'Macintosh; Intel Mac OS X 10_15_0';
                            const userAgent = `Mozilla/5.0 (${osPlatform}; rv: ${firefoxVersion}.0) Gecko/${geckoVersion} Firefox/${firefoxVersion}.0`;
                            return userAgent;
                        }
                    
                        function UASafari() {
                            const Plattform = Math.floor(Math.random() * 2)
                            const safariVersion = Math.floor(Math.random() * 5) + 10;
                            const osPlatform = Plattform == 1 ? 'Win64; x64' : 'Macintosh; Intel Mac OS X 10_15_0';
                            const userAgent = `Mozilla/5.0 (${osPlatform}) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/${safariVersion}.1.15 Safari/605.1.15`;
                            return userAgent;
                          }
                    
                        function UAAndroid() {
                            const androidVersion = Math.floor(Math.random() * 5) + 5;
                            const chromeVersion = Math.floor(Math.random() * 20) + 60;
                            const webkitVersion = Math.floor(Math.random() * 700) + 500;
                            const osPlatform = `Linux; Android ${androidVersion}.${Math.floor(Math.random() * 10)}; en-us; Nexus 6 Build/LYZ28M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${chromeVersion}.0.3163.98 Mobile Safari/${webkitVersion}.36`;
                            const userAgent = `Mozilla/5.0 (${osPlatform}`;
                            return userAgent;
                        }
                    
                        function UAIos() {
                            const iosVersion = Math.floor(Math.random() * 5) + 9;
                            const safariVersion = Math.floor(Math.random() * 5) + 600;
                            const webkitVersion = Math.floor(Math.random() * 700) + 500;
                            const osPlatform = `CPU iPhone OS ${iosVersion}_${Math.floor(Math.random() * 10)} like Mac OS X) AppleWebKit/${webkitVersion}.60 (KHTML, like Gecko) Version/${safariVersion}.0 Mobile/15E148 Safari/${webkitVersion}.60`;
                            const userAgent = `Mozilla/5.0 (${osPlatform}`;
                            return userAgent;
                        }
                    
                        function RUA() {
                            const UA = Math.floor(Math.random() * 4);
                    
                            if (UA == 0) {
                                return UAChrome();
                            } else if (UA == 1) {
                                return UAFirefox();
                            } else if (UA == 2) {
                                return UASafari();
                            } else if (UA == 3) {
                                return UAAndroid();
                            } else if (UA == 4) {
                                return UAIos();
                            }
                    
                            return '';
                        }
                    
                        httpGet(
                            `https://nominatim.openstreetmap.org/reverse?format=geojson&lat=${lat}&lon=${lon}`,
                            {
                                timeout: 15000,
                                headers: {
                                    'User-Agent': RUA(),
                                },
                            },
                            (err, response) => {
                                if (!err  && response.statusCode == 200) {
                                    const info = JSON.parse(response.data);
                                    const address = info.features[0].properties.address;
                    
                                    setState(sDP, JSON.stringify(address), true);
                                } else {
                                    console.error(`Nominatim: ${response.statusCode}`);
                                }
                            }
                        );
                    
                    }
                    
                    
                    on({ id: [].concat(['0_userdata.0.GPS.Marc.Adressabfrage']), change: 'ne' }, async (obj) => {
                      let value = obj.state.val;
                      let oldValue = obj.oldState.val;
                      await osmResolve(getState('0_userdata.0.GPS.Marc.lon').val, getState('0_userdata.0.GPS.Marc.lat').val, '0_userdata.0.GPS.Marc.AdresseJson');
                      json = getState('0_userdata.0.GPS.Marc.AdresseJson').val;
                      strasse = getAttr(json, 'road');
                      hausnummer = getAttr(json, 'house_number');
                      plz = getAttr(json, 'postcode');
                      stadt = getAttr(json, 'town');
                      setState('0_userdata.0.GPS.Marc.Adresse' /* Adresse */, ([strasse,' ',hausnummer,', ',plz,' ',stadt].join('')), true);
                    });
                    

                    und während ich schreibe war @Ro75 schneller ;)

                    Lehrling seit 1975 !!!
                    Beitrag geholfen ? dann gerne ein upvote rechts unten im Beitrag klicken ;)
                    https://forum.iobroker.net/topic/51555/hinweise-f%C3%BCr-gute-forenbeitr%C3%A4ge

                    1 Reply Last reply
                    1
                    • haus-automatisierungH haus-automatisierung

                      @fastfoot Ich meine hier gab es irgendwo mal Scripts, welche bei jeder Anfrage einen anderen User-Agent generiert haben (um zu verhindern, dass OpenStreeMap einen aussperrt?). Scheint ja ein recht spezielles Thema zu sein.

                      F Offline
                      F Offline
                      fastfoot
                      wrote on last edited by
                      #10

                      @haus-automatisierung also hier lag das Problem nur daran dass httpGet gar keinen user-agent mitsendet. Mit axios wurde er ja auch nie blockiert und das ändert den user-agent ja nicht. Ist halt alles schwierig für Nichtprogrammierer, aber immerhin gibt es ja das Forum...

                      iobroker läuft unter Docker auf QNAP TS-451+
                      SkriptRecovery: https://forum.iobroker.net/post/930558

                      haus-automatisierungH 1 Reply Last reply
                      0
                      • F fastfoot

                        @haus-automatisierung also hier lag das Problem nur daran dass httpGet gar keinen user-agent mitsendet. Mit axios wurde er ja auch nie blockiert und das ändert den user-agent ja nicht. Ist halt alles schwierig für Nichtprogrammierer, aber immerhin gibt es ja das Forum...

                        haus-automatisierungH Online
                        haus-automatisierungH Online
                        haus-automatisierung
                        Developer Most Active
                        wrote on last edited by
                        #11

                        @fastfoot sagte in Script: Adresse ermitteln -> axios ändern in httpget:

                        also hier lag das Problem nur daran dass httpGet gar keinen user-agent mitsendet

                        Natürlich wird im Standard ein Agent gesendet. Siehst Du ja im verbose mode sofort.

                        🧑‍🎓 Autor des beliebten ioBroker-Master-Kurses
                        🎥 Tutorials rund um das Thema DIY-Smart-Home: https://haus-automatisierung.com/
                        📚 Meine inoffizielle ioBroker Dokumentation

                        F 1 Reply Last reply
                        0
                        • haus-automatisierungH haus-automatisierung

                          @fastfoot sagte in Script: Adresse ermitteln -> axios ändern in httpget:

                          also hier lag das Problem nur daran dass httpGet gar keinen user-agent mitsendet

                          Natürlich wird im Standard ein Agent gesendet. Siehst Du ja im verbose mode sofort.

                          F Offline
                          F Offline
                          fastfoot
                          wrote on last edited by
                          #12

                          @haus-automatisierung upps, meine Annahme beruhte darauf dass ich ohne Angabe eines UA sofort gesperrt wurde, nach dem Setzen eines beliebigen UA (siehe codeschnipsel) ich aber sofort eine Antwort bekam. Tja, wieder was gelernt, man(ich!) sollte aus Schlussfolgerungen keine Tatsachen ableiten. Sorry for that! Dann bleibt nur die Vermutung dass der Inhalt des UA geprüft wird

                          iobroker läuft unter Docker auf QNAP TS-451+
                          SkriptRecovery: https://forum.iobroker.net/post/930558

                          haus-automatisierungH bahnuhrB 2 Replies Last reply
                          1
                          • F fastfoot

                            @haus-automatisierung upps, meine Annahme beruhte darauf dass ich ohne Angabe eines UA sofort gesperrt wurde, nach dem Setzen eines beliebigen UA (siehe codeschnipsel) ich aber sofort eine Antwort bekam. Tja, wieder was gelernt, man(ich!) sollte aus Schlussfolgerungen keine Tatsachen ableiten. Sorry for that! Dann bleibt nur die Vermutung dass der Inhalt des UA geprüft wird

                            haus-automatisierungH Online
                            haus-automatisierungH Online
                            haus-automatisierung
                            Developer Most Active
                            wrote on last edited by
                            #13

                            @fastfoot Alles gur. Ich wäre schon zufrieden, wenn viele Aussagen im Forum bei Unsicherheit als Frage formuliert würden 😉

                            🧑‍🎓 Autor des beliebten ioBroker-Master-Kurses
                            🎥 Tutorials rund um das Thema DIY-Smart-Home: https://haus-automatisierung.com/
                            📚 Meine inoffizielle ioBroker Dokumentation

                            1 Reply Last reply
                            1
                            • F fastfoot

                              @haus-automatisierung upps, meine Annahme beruhte darauf dass ich ohne Angabe eines UA sofort gesperrt wurde, nach dem Setzen eines beliebigen UA (siehe codeschnipsel) ich aber sofort eine Antwort bekam. Tja, wieder was gelernt, man(ich!) sollte aus Schlussfolgerungen keine Tatsachen ableiten. Sorry for that! Dann bleibt nur die Vermutung dass der Inhalt des UA geprüft wird

                              bahnuhrB Online
                              bahnuhrB Online
                              bahnuhr
                              Forum Testing Most Active
                              wrote on last edited by
                              #14

                              @fastfoot sagte in Script: Adresse ermitteln -> axios ändern in httpget:

                              dass ich ohne Angabe eines UA sofort gesperrt wurde

                              war bei mir auch so. Und 2500 Abfragen hab ich nie erreicht.
                              Ablehnung kam sofort.

                              @DJMarc75
                              @fastfoot
                              @haus-automatisierung
                              @Homoran
                              @Ro75

                              Danke an alle für die Antworten. Damit kann ich was anfangen.

                              mfg
                              Dieter


                              Wenn ich helfen konnte, dann Daumen hoch (Pfeil nach oben)!
                              Danke.
                              gute Forenbeiträge: https://forum.iobroker.net/topic/51555/hinweise-f%C3%BCr-gute-forenbeitr%C3%A4ge
                              ScreenToGif :https://www.screentogif.com/downloads.html

                              OliverIOO 1 Reply Last reply
                              0
                              • bahnuhrB bahnuhr

                                @fastfoot sagte in Script: Adresse ermitteln -> axios ändern in httpget:

                                dass ich ohne Angabe eines UA sofort gesperrt wurde

                                war bei mir auch so. Und 2500 Abfragen hab ich nie erreicht.
                                Ablehnung kam sofort.

                                @DJMarc75
                                @fastfoot
                                @haus-automatisierung
                                @Homoran
                                @Ro75

                                Danke an alle für die Antworten. Damit kann ich was anfangen.

                                mfg
                                Dieter

                                OliverIOO Offline
                                OliverIOO Offline
                                OliverIO
                                wrote on last edited by
                                #15

                                @bahnuhr

                                Zum Testen, welche headers und sonstige Daten dein request so alles übermittelt, kannst du dir hier eine individuelle Server Adresse generieren lassen. Auf der Seite dann, siehst du dann die requests mit all seinen Daten Und headers
                                https://webhook.site/

                                Wenn du dann beide Informationen hast, kann man vergleichen, wo die Unterschiede liegen und ob man die eventuell über die Parameter von HTTPget beeinflussen kann.

                                Meine Adapter und Widgets
                                TVProgram, SqueezeboxRPC, OpenLiga, RSSFeed, MyTime,, pi-hole2, vis-json-template, skiinfo, vis-mapwidgets, vis-2-widgets-rssfeed
                                Links im Profil

                                bahnuhrB 1 Reply Last reply
                                0
                                • OliverIOO OliverIO

                                  @bahnuhr

                                  Zum Testen, welche headers und sonstige Daten dein request so alles übermittelt, kannst du dir hier eine individuelle Server Adresse generieren lassen. Auf der Seite dann, siehst du dann die requests mit all seinen Daten Und headers
                                  https://webhook.site/

                                  Wenn du dann beide Informationen hast, kann man vergleichen, wo die Unterschiede liegen und ob man die eventuell über die Parameter von HTTPget beeinflussen kann.

                                  bahnuhrB Online
                                  bahnuhrB Online
                                  bahnuhr
                                  Forum Testing Most Active
                                  wrote on last edited by
                                  #16

                                  @oliverio sagte in Script: Adresse ermitteln -> axios ändern in httpget:

                                  Zum Testen, welche headers und sonstige Daten dein request so alles übermittelt, kannst du dir hier eine individuelle Server Adresse generieren lassen. Auf der Seite dann, siehst du dann die requests mit all seinen Daten Und headers

                                  starker Text.
                                  Hab ich so auf Anhieb nicht verstanden.

                                  Komm ich aber noch dahinter ;-)

                                  Danke dir.


                                  Wenn ich helfen konnte, dann Daumen hoch (Pfeil nach oben)!
                                  Danke.
                                  gute Forenbeiträge: https://forum.iobroker.net/topic/51555/hinweise-f%C3%BCr-gute-forenbeitr%C3%A4ge
                                  ScreenToGif :https://www.screentogif.com/downloads.html

                                  OliverIOO 1 Reply Last reply
                                  0
                                  • bahnuhrB bahnuhr

                                    @oliverio sagte in Script: Adresse ermitteln -> axios ändern in httpget:

                                    Zum Testen, welche headers und sonstige Daten dein request so alles übermittelt, kannst du dir hier eine individuelle Server Adresse generieren lassen. Auf der Seite dann, siehst du dann die requests mit all seinen Daten Und headers

                                    starker Text.
                                    Hab ich so auf Anhieb nicht verstanden.

                                    Komm ich aber noch dahinter ;-)

                                    Danke dir.

                                    OliverIOO Offline
                                    OliverIOO Offline
                                    OliverIO
                                    wrote on last edited by
                                    #17

                                    @bahnuhr

                                    Axios oder httpget sendet Daten.
                                    Irgendwo wohl auch unterschiedlich, obwohl hinter httpget auch axios steht.
                                    Genau anhand diesem Unterschied wird der request aber abgelehnt.
                                    Das es der User Agent String ist ist nur eine Vermutung. Serverbetreiber geben meistens nicht bekannt anhand welchen Kriterien sie ablehnen.

                                    Mit diesem Test findest du hoffentlich dann den Unterschied auch wirklich raus, weil du siehst, was am anderen Ende ankommt und nicht nur was du weg sendest.

                                    Meine Adapter und Widgets
                                    TVProgram, SqueezeboxRPC, OpenLiga, RSSFeed, MyTime,, pi-hole2, vis-json-template, skiinfo, vis-mapwidgets, vis-2-widgets-rssfeed
                                    Links im Profil

                                    Ro75R F 2 Replies Last reply
                                    1
                                    • bahnuhrB Online
                                      bahnuhrB Online
                                      bahnuhr
                                      Forum Testing Most Active
                                      wrote on last edited by
                                      #18

                                      So, habe mal als Muster das von @DJMarc75 genommen.
                                      Also ohne dieses async und await; aber mit random

                                      sieht so aus:

                                      var lat = 48.46567; var lon = 9.7107;
                                      var v_random = String(Math.floor(Math.random() * 100)); log (v_random);
                                      
                                          httpGet(`https://nominatim.openstreetmap.org/reverse?format=geojson&lat=${lat}&lon=${lon}`,
                                              { timeout: 15000, headers: { 'User-Agent': "iob" + v_random, }, },
                                              (err, response) => {
                                                  if (!err  && response.statusCode == 200) { const info = JSON.parse(response.data); const address = info.features[0].properties.address;
                                                      log ("Str= " + address.road); log ("Nr= " + address.house_number); 
                                                      log ("Plz= " + address.postcode); log ("Ort= " + address.municipality);
                                                  } else { console.error(`Nominatim: ${response.statusCode}`); }
                                              }
                                          );
                                      

                                      Wenn ich helfen konnte, dann Daumen hoch (Pfeil nach oben)!
                                      Danke.
                                      gute Forenbeiträge: https://forum.iobroker.net/topic/51555/hinweise-f%C3%BCr-gute-forenbeitr%C3%A4ge
                                      ScreenToGif :https://www.screentogif.com/downloads.html

                                      1 Reply Last reply
                                      1
                                      • OliverIOO OliverIO

                                        @bahnuhr

                                        Axios oder httpget sendet Daten.
                                        Irgendwo wohl auch unterschiedlich, obwohl hinter httpget auch axios steht.
                                        Genau anhand diesem Unterschied wird der request aber abgelehnt.
                                        Das es der User Agent String ist ist nur eine Vermutung. Serverbetreiber geben meistens nicht bekannt anhand welchen Kriterien sie ablehnen.

                                        Mit diesem Test findest du hoffentlich dann den Unterschied auch wirklich raus, weil du siehst, was am anderen Ende ankommt und nicht nur was du weg sendest.

                                        Ro75R Offline
                                        Ro75R Offline
                                        Ro75
                                        wrote on last edited by Ro75
                                        #19

                                        @oliverio sagte in Script: Adresse ermitteln -> axios ändern in httpget:

                                        Das es der User Agent String ist ist nur eine Vermutung. Serverbetreiber geben meistens nicht bekannt anhand welchen Kriterien sie ablehnen.

                                        Da bin ich für mich weiter. Für mich steht es fest, dass der USER-Agent zu 95% daran beteiligt ist. Ich hatte, als ich gesperrt wurde mein Abfrage-URL in meinen Windows-Browser eingegeben und da ging es. Im iobroker wiederholt mit dem Ergebnis = NO.

                                        Also mal die IP gewechselt. Ein Teil war anders, aber selbiges Ergebnis 1xJa und 1xNein. Nochmal die IP gewechselt. Komplett anderer Bereich, aber auch hier war das Ergebnis identisch.

                                        Für mich steht also fest, die prüfen IP ind Verbindung mit USER-Agent und Anzahl Aufrufe.

                                        Ich wechsel aller 6 Stunden den USER-Agent für Nominatim.

                                        httpGet('https://nominatim.openstreetmap.org/reverse?format=geojson&lat='+lat+'&lon='+lon, { timeout: 15000,"headers":{"User-Agent":"'" + RUA() + "'"}}, (error, response) => {
                                        
                                        

                                        Ro75.

                                        SERVER = Beelink U59 16GB DDR4 RAM 512GB SSD, FB 7490, FritzDect 200+301+440, ConBee II, Zigbee Aqara Sensoren + NOUS A1Z, NOUS A1T, Philips Hue ** ioBroker, REDIS, influxdb2, Grafana, PiHole, Plex-Mediaserver, paperless-ngx (Docker), MariaDB + phpmyadmin *** VIS-Runtime = Intel NUC 8GB RAM 128GB SSD + 24" Touchscreen

                                        1 Reply Last reply
                                        2
                                        • OliverIOO OliverIO

                                          @bahnuhr

                                          Axios oder httpget sendet Daten.
                                          Irgendwo wohl auch unterschiedlich, obwohl hinter httpget auch axios steht.
                                          Genau anhand diesem Unterschied wird der request aber abgelehnt.
                                          Das es der User Agent String ist ist nur eine Vermutung. Serverbetreiber geben meistens nicht bekannt anhand welchen Kriterien sie ablehnen.

                                          Mit diesem Test findest du hoffentlich dann den Unterschied auch wirklich raus, weil du siehst, was am anderen Ende ankommt und nicht nur was du weg sendest.

                                          F Offline
                                          F Offline
                                          fastfoot
                                          wrote on last edited by
                                          #20

                                          @oliverio also der einzige Unterschied auf der Seite ist der UA. axios sendet da als default nur axios/1.7.7 während httpGet da einen UA sendet der für mich wie der eines Browsers aussieht. Ich sehe keinen Grund den UA zu wechseln wie es einige hier tun, das ist nur der Versuch Restriktionen zu umgehen und schadet somit letztlich der Community

                                          iobroker läuft unter Docker auf QNAP TS-451+
                                          SkriptRecovery: https://forum.iobroker.net/post/930558

                                          OliverIOO bahnuhrB 2 Replies Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          Support us

                                          ioBroker
                                          Community Adapters
                                          Donate

                                          415

                                          Online

                                          32.7k

                                          Users

                                          82.5k

                                          Topics

                                          1.3m

                                          Posts
                                          Community
                                          Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen | Einwilligungseinstellungen
                                          ioBroker Community 2014-2025
                                          logo
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Home
                                          • Recent
                                          • Tags
                                          • Unread 0
                                          • Categories
                                          • Unreplied
                                          • Popular
                                          • GitHub
                                          • Docu
                                          • Hilfe