Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Visualisierung
    4. Umrechung Grad in Windrichtung HTML

    NEWS

    • [erledigt] 15. 05. Wartungsarbeiten am ioBroker Forum

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    Umrechung Grad in Windrichtung HTML

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

      Hallo!

      Ich bitte um eure Hilfe, stehe bei einem Problem an:

      Mein Netatmo Wetter Adapter gibt bei der Windrichtung Grad an. ICh hätte jedoch gerne N O S W NNO etc.

      Ich habe ein normales HTML Widget:

      > | Windrichtung: | **{netatmo.0.Robert.DaheimWind.Wind.WindAngle}Grad** |

      Kennt jemand eine Lösung um die Grad in Richtung umzurechnen und anzuzeigen?

      Danke!

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

        So was?

        https://www.npmjs.com/package/windrose

        Gruß

        Rainer

        1 Reply Last reply Reply Quote 0
        • R
          Robbsy last edited by

          Danke Homoran, ich kenne die ganzen grafischen Lösungen.

          Ich stehe auf Minimalismus. Deshalb auch ein einfaches HTML Widget. Jedoch übersteigt es mein Wissen, die Gradzahl in HTML so einzubinden das durch eine Formel (oder wie auch immer) die Windrichtung ausgegeben wird. 5652_wetter_ausgabe.jpg

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

            Ich hoffe dass ich da nichts falsches rausgesucht habe.

            Das verlinkte ist ein npm Modul.

            Dieses im js-Adapter unter npm Module eintragen, dann nach der Anleitung zu dem Modul dein Skript basteln, dann solltest du bei 180° ein S erhalten

            Gruß

            Rainer

            1 Reply Last reply Reply Quote 0
            • R
              Robbsy last edited by

              Ja du hast recht, dass sollte hinhauen.

              Ich melde mich sobald ich den Inhalt kapiert habe! :lol:

              Danke!

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

                Es genügt auch ein einfaches Skript.

                const idGrad = '...'; // Datenpunkt-ID für Windrichtung in Grad
                const idDir  = 'Windrichtung'; // Datenpunkt-Name für Windrichtung
                const dirs = ['N','NNO','NO','ONO','O','OSO','SO','SSO','S','SSW','SW','WSW','W','WNW','NW','NNW','N'];
                
                createState(idDir, 'N', {type: 'string'});
                
                on(idGrad, function(dp) {
                   var dir = dirs[Math.floor((dp.state.val + 11.25) / 22.5)];
                   setState(idDir, dir, true);
                });
                
                

                EDIT: createState für neuen Datenpunkt unter javascript.0 ergänzt.

                A 1 Reply Last reply Reply Quote 1
                • A
                  Alero @paul53 last edited by

                  @paul53
                  Hi Paul,
                  kannst du mir als Anfänger sagen was genau die Datenpunkt -id ist? Ist es
                  HM-RP2xxxxx:1 und der Dantenpunt name die Wind_Dir_Range?

                  Gruß
                  Alero

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

                    @Alero sagte:

                    was genau die Datenpunkt -id ist?

                    Jedes ioBroker-Objekt hat eine eindeutige ID. Das ist quasi die "Adresse" des Objektes. Datenpunkte sind Objekte vom Typ state und haben eine ID wie z.B. "hm-rpc.0.NEQ1234567.1.STATE".

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

                      @paul53
                      Hi,

                      Also so wie ich geschrieben habe. Muss bei der ID auch direkt der "State" mit dran? Und aus deinem script "Windrichtung" ist dann was genau?

                      Gruß
                      Alero

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

                        @Alero sagte:

                        Muss bei der ID auch direkt der "State" mit dran?

                        Nein, zeige bitte einen Screenshot vom Reiter "Objekte" auf dem der Datenpunkt, auf dem die Windrichtung reinkommt (Datenpunkte Wetterstation) zu sehen ist.

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

                          @paul53

                          Hi,

                          hier der screenshot:

                          a3307406-e39c-4214-98f0-aea1f77aee32-grafik.png

                          Hier brauche ich, meiner Meinung nach den WIND_DIR_Range, oder?
                          Gruß
                          Alero

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

                            @Alero sagte:

                            den WIND_DIR_Range, oder?

                            Ich nehme an, den hmp-rpc.N.Seriennummer.1.WIND_DIR. (N: Instanznummer)

                            A 1 Reply Last reply Reply Quote 0
                            • sigi234
                              sigi234 Forum Testing Most Active last edited by sigi234

                              const idGrad = 'openweathermap.0.forecast.current.windDirection'; // Datenpunkt-ID für Windrichtung in Grad
                              const idDir  = 'Windrichtung'; // Datenpunkt-Name für Windrichtung
                              const dirs = ['N','NNO','NO','ONO','O','OSO','SO','SSO','S','SSW','SW','WSW','W','WNW','NW','NNW','N'];
                              
                              createState(idDir, 'N', {type: 'string'});
                                 
                              on(idGrad, function(dp) {
                                 var dir = dirs[Math.floor((dp.state.val + 11.25) / 22.5)];
                                 setState(idDir, dir, true);
                              });
                              

                              Bitte löschen..............übersehen schon vorhanden....☺

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

                                @paul53
                                Hi, vielen Dank für deinen Mühe. Aber ich stehe auf dem Schlauch (heute schon das 2te mal 😉
                                Was muss ich jetzt hier eintragen?
                                const idGrad = 'Wetterstation:1.WIND_DIR'; ?
                                const idDir = 'WIND_DIR';?

                                Gruß
                                Alero

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

                                  @Alero

                                  const idGrad = 'hm-rpc.N.seriennummer.1.WIND_DIR'; // Datenpunkt-ID für Windrichtung in Grad
                                  const idDir  = 'Wetter.Windrichtung'; // Datenpunkt-Name für Windrichtung
                                  

                                  N.seriennummer durch die tatsächlichen Zahlen ersetzen !

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

                                    @paul53
                                    Habs so eingetragen.
                                    Zeigt aber immer N an obwohl die Wetterstation 130 anzeigt.
                                    Sollte doch SO sein, oder?

                                    Gruß
                                    Alero

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

                                      @Alero sagte:

                                      Zeigt aber immer N an

                                      Wird denn getriggert ? Bau zum Test vor setState(idDir, dir, true) ein Log ein:

                                      log(dp.state.val + ' --> ' + dir);
                                      
                                      A 1 Reply Last reply Reply Quote 0
                                      • A
                                        Alero @paul53 last edited by Alero

                                        @paul53
                                        Hi,
                                        wenn ich die Objekte unter Javascript.0 gehe sehe ich das der Wert immer aktualisiert wird. Nur die Windrichtung (N) ändert sich nicht.

                                        Gruß
                                        Alero

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

                                          @Alero Vielleicht liefert WIND_DIR keine Zahl, was aber bei HomeMatic unwahrscheinlich ist. Füge mal als erstes im Trigger dieses Log ein:

                                          log(dp.state.val + ' Typ: ' + typeof dp.state.val);
                                          
                                          A 1 Reply Last reply Reply Quote 0
                                          • A
                                            Alero @paul53 last edited by Alero

                                            @paul53
                                            Hi, ist eingetragen.

                                            const idGrad = 'hm-rpc.2.001858A992B979.WIND_DIR'; // Datenpunkt-ID für Windrichtung in Grad

                                            const idDir = 'Wetter.Windrichtung'; // Datenpunkt-Name für Windrichtung

                                            const dirs = ['N','NNO','NO','ONO','O','OSO','SO','SSO','S','SSW','SW','WSW','W','WNW','NW','NNW','N'];

                                            createState(idDir, 'N', {type: 'string'});

                                            on(idGrad, function(dp) {'{"time":{"start":"00:00","end":"23:59","mode":"hours","interval":1},"period":{"days":1}}'

                                            var dir = dirs[Math.floor((dp.state.val + 11.25) / 22.5)];
                                            log(dp.state.val + ' Typ: ' + typeof dp.state.val);

                                            setState(idDir, dir, true);

                                            });


                                            Komisch, er aktualisiert nicht mehr unter Objekten. letzte Aktualisierung 13:59.

                                            Gruß
                                            Alero

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

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            718
                                            Online

                                            31.6k
                                            Users

                                            79.5k
                                            Topics

                                            1.3m
                                            Posts

                                            8
                                            62
                                            4210
                                            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