Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. wrong type of...

    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

    wrong type of...

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

      @Homoran ja du musst Konvertieren. Es gibt fälle da behandelt js zahlen wie einen String.

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

        @Homoran sagte:

        "luftdaten.0.34499.SDS_P2"

        enthält offenbar einen String.

        SBorg Homoran 2 Replies Last reply Reply Quote 0
        • SBorg
          SBorg Forum Testing Most Active @paul53 last edited by

          Wahrscheinlich 12,5, nicht 12.5 ...

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

            @paul53 sagte in wrong type of...:

            @Homoran sagte:

            "luftdaten.0.34499.SDS_P2"

            enthält offenbar einen String.

            wie bekomme ich das raus?
            Der Datenpunkt ist vom Typ Number

            Ich denke ich werde sicherheitshalber einen konvert Block dazunehmen

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

              @Homoran sagte:

              wie bekomme ich das raus?

              log(typeof getState("luftdaten.0.34499.SDS_P2").val);
              

              @Homoran sagte in wrong type of...:

              Der Datenpunkt ist vom Typ Number

              Das sagt nichts darüber aus, welcher Typ tatsächlich in val enthalten ist.

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

                @paul53 sagte in wrong type of...:

                log(typeof getState("luftdaten.0.34499.SDS_P2").val);

                Danke!
                😱

                14:32:00.412	info	javascript.0 (1053) Start javascript script.js.typtest
                14:32:00.416	info	javascript.0 (1053) script.js.typtest: string
                

                Obwohl, die Config auf number steht

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

                  @Homoran sagte:

                  Obwohl, die Config auf number steht

                  Ein Fall für ein Issue auf Github.

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

                    @paul53
                    Done!

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

                      Danke an alle!

                      Habe jetzt erst einmal alle States mit "nach Zahl" konvertiert. Läuftjetzt ohne Fehlermeldung.

                      Issue beim Luftdaten-Adapter ist erstellt.

                      @SBorg sagte in wrong type of...:

                      Wahrscheinlich 12,5, nicht 12.5 ...

                      States_number.png

                      Zumindest nicht sichtbar

                      paul53 K 2 Replies Last reply Reply Quote 0
                      • paul53
                        paul53 @Homoran last edited by

                        @Homoran sagte:

                        alle States mit "nach Zahl" konvertiert.

                        Du meinst alle Werte aus "luftdaten.0" ? Das wäre ausreichend.

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

                          @paul53 sagte in wrong type of...:

                          Das wäre ausreichend.

                          Danke!
                          Da war ich mir eben nicht sicher, ob die States, in denen er das Ergebnis aus einer "Text-Addition" eingetragen hatte nicht auch den falschen Typ haben.
                          Mit diesen Werten rechnet er ja nachher weiter.

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

                            @Homoran sagte:

                            States, in denen er das Ergebnis aus einer "Text-Addition" eingetragen hatte nicht auch den falschen Typ haben.

                            Ja, das muss einmalig korrigiert werden.

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

                              @paul53
                              Dann setze ich alles auf 0 und beginne von vorn.
                              Da stimmt sowie so etwas nicht 😉
                              Die potentiellen Tagesmittelwerte sind unplausibel.

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

                                @Homoran sagte:

                                Die potentiellen Tagesmittelwerte sind unplausibel.

                                Wenn bisher eine String-Verkettung anstelle einer Addition erfolgte, können die Werte nicht stimmen.

                                Homoran SBorg 2 Replies Last reply Reply Quote 0
                                • Homoran
                                  Homoran Global Moderator Administrators @paul53 last edited by

                                  @paul53
                                  Das habe ich mir auch gedacht

                                  1 Reply Last reply Reply Quote 0
                                  • SBorg
                                    SBorg Forum Testing Most Active @paul53 last edited by

                                    @paul53 sagte in wrong type of...:

                                    @Homoran sagte:

                                    Die potentiellen Tagesmittelwerte sind unplausibel.

                                    Wenn bisher eine String-Verkettung anstelle einer Addition erfolgte, können die Werte nicht stimmen.

                                    Das war wohl schon immer String:

                                    self.setState(path + 'SDS_' + obj.value_type, {val: obj.value, ack: true});
                                    

                                    Ich finde aber nix was obj.value prüft oder als Zahl konvertiert. Mein JS ist "so naja", aber was ich dabei nicht verstehe, die Funktion ist für 2.5 + 10, warum meckert er nur die 2.5 an (10 ist, wie es die Funktion ja auch vorgibt, ebenfalls String)?

                                    Homoran paul53 2 Replies Last reply Reply Quote 0
                                    • Homoran
                                      Homoran Global Moderator Administrators @SBorg last edited by

                                      @SBorg
                                      er hatte beides angemeckert.
                                      Ich hatte nur das eine als Beispiel genommen

                                      SBorg 1 Reply Last reply Reply Quote 0
                                      • SBorg
                                        SBorg Forum Testing Most Active @Homoran last edited by

                                        @Homoran Ok, danke, dann raff ich das auch ^^
                                        Muss Matthias fixen... 🙂

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

                                          @SBorg sagte:

                                          Das war wohl schon immer String:

                                          Ist der Code aus dem Adapter ?
                                          Wenn es eine Zahl sein soll, wie es common.type = 'number' vorgibt, muss gewandelt werden.

                                          self.setState(path + 'SDS_' + obj.value_type, {val: parseFloat(obj.value), ack: true});
                                          
                                          SBorg 1 Reply Last reply Reply Quote 0
                                          • SBorg
                                            SBorg Forum Testing Most Active @paul53 last edited by

                                            @paul53 sagte in wrong type of...:

                                            Wenn es eine Zahl sein soll, wie es common.type = 'number' vorgibt, muss gewandelt werden.

                                            self.setState(path + 'SDS_' + obj.value_type, {val: parseFloat(obj.value), ack: true});
                                            

                                            Ja, und genau so sieht meine Änderung auch aus (war mir nicht zu 100% sicher) 🙂
                                            Resultat:

                                            16:30:46.076	info	javascript.0 (31077) script.js.Skript_1: number
                                            16:30:46.077	info	javascript.0 (31077) script.js.Skript_1: registered 0 subscriptions and 0 schedules
                                            
                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            807
                                            Online

                                            31.9k
                                            Users

                                            80.1k
                                            Topics

                                            1.3m
                                            Posts

                                            blockly
                                            5
                                            22
                                            1455
                                            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