Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. JavaScript
    5. (gelöst) Längen- und Breitengrade

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    (gelöst) Längen- und Breitengrade

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

      @ice987 sagte: gibt es eine Möglichkeit diese um JS direkt zu verwenden?

      const suncalc = require('suncalc');
      
      const jsa = getObject("system.adapter.javascript.0");
      const lat = jsa.native.latitude;
      const long = jsa.native.longitude;
      
      ice987 1 Reply Last reply Reply Quote 1
      • UncleSam
        UncleSam Developer @ice987 last edited by

        @ice987 Hast du diesen Adapter auch schon gesehen? Der benutzt intern suncalc:
        https://github.com/walli545/ioBroker.time-switch

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

          @paul53 sagte in Längen- und Breitengrade:

          const suncalc = require('suncalc');
          
          const jsa = getObject("system.adapter.javascript.0");
          const lat = jsa.native.latitude;
          const long = jsa.native.longitude;
          

          genau das habe ich gesucht, vielen Dank. Leider sind diese Werte bei mir leer, obwohl die Längen- und Breitengrade unter Haupteinstellungen in ioBroker korrekt angezeigt werden.

          mit

          const jsa = getObject("system.adapter.javascript.0");
          if (LOG_DEBUG) log("jsa: " + JSON.stringify(jsa));
          

          kriege ich die Ausgabe hin, jedoch sind die beiden Werte leer (...) {"latitude":"","longitude":"", (...). Wie werden diese gefüllt?

          @UncleSam
          Vielen Dank für den Link, den Adapter muss ich mir mal ansehen 👍

          Thomas Braun 1 Reply Last reply Reply Quote 0
          • Thomas Braun
            Thomas Braun Most Active @ice987 last edited by

            @ice987 sagte in Längen- und Breitengrade:

            Leider sind diese Werte bei mir leer, obwohl die Längen- und Breitengrade unter Haupteinstellungen in ioBroker korrekt angezeigt werden.

            Stell die im javascript-Adapter nochmal gesondert ein.

            ice987 UncleSam 2 Replies Last reply Reply Quote 1
            • ice987
              ice987 @Thomas Braun last edited by

              @thomas-braun
              achso, jetzt verstehe ich auch @Homoran :
              unter
              b2c8f5a5-1f10-4b74-9bf3-57f6990d8f1c-image.png
              Haken rausnehmen und die Koordinaten noch einmal reinschreiben

              Thomas Braun 1 Reply Last reply Reply Quote 0
              • Thomas Braun
                Thomas Braun Most Active @ice987 last edited by

                @ice987
                Richtig.

                ice987 1 Reply Last reply Reply Quote 0
                • ice987
                  ice987 @Thomas Braun last edited by

                  @thomas-braun
                  tatsächlich: Funktioniert, Vielen Dank

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

                    @ice987 sagte in Längen- und Breitengrade:

                    tatsächlich: Funktioniert,

                    natürlich!

                    1 Reply Last reply Reply Quote 0
                    • UncleSam
                      UncleSam Developer @Thomas Braun last edited by

                      @thomas-braun Oder einfach die System-Einstellungen nehmen: 'system.config' --> common.latitude etc.

                      const config= getObject("system.config");
                      const lat = config.common.latitude;
                      const long = config.common.longitude;
                      

                      Sollte auch gehen.

                      Thomas Braun ice987 2 Replies Last reply Reply Quote 1
                      • Thomas Braun
                        Thomas Braun Most Active @UncleSam last edited by

                        @unclesam Keine Ahnung... Bin doch Javascript-Legastheniker.

                        1 Reply Last reply Reply Quote 0
                        • ice987
                          ice987 @UncleSam last edited by

                          @unclesam sagte in Längen- und Breitengrade:

                          Oder einfach die System-Einstellungen nehmen: 'system.config' --> common.latitude etc.

                          const config= getObject("system.config");
                          const lat = config.common.latitude;
                          const long = config.common.longitude;
                          

                          das geht auch! (ist sogar noch etwas eleganter, aber über Eleganz kann man sich natürlich streiten 😳 ) Danke!

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

                          Support us

                          ioBroker
                          Community Adapters
                          Donate

                          412
                          Online

                          31.9k
                          Users

                          80.1k
                          Topics

                          1.3m
                          Posts

                          javascript
                          5
                          13
                          763
                          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