Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. JavaScript
    5. getState - warning log / JS Dokumentation

    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

    getState - warning log / JS Dokumentation

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

      @ticaki Danke, dass du dir das noch einmal angeschaut hast. Brauchst dir aber keine Vorwürfe machen. Ich hab in der Zeit einiges dazugelernt.

      Muss dennoch noch einmal einhaken.

      @ticaki said in getState - warning log / JS Dokumentation:

      Zu deinen weiteren Anmerkungen hab ich mich noch nicht tief genug eingearbeitet. Diese Selektor werden dafür verwendet "Arrays" bzw. Json von Objekten zu bekommen.
      z.B
      $('state[state.id=javascript.0.test5.0.*]');

      gibt dir alles unterhalb von ...test5.0.

      Bei mir stimmt das nicht. Mit

      console.log($('state[id=stiebel-isg.0.Info.STATUS.BETRIEBSSTATUS.]'));
      

      oder

      console.log($('state[id=stiebel-isg.0.Info.STATUS.BETRIEBSSTATUS.*]'));
      

      sollte ich ja erhalten:
      992e7df2-1e9f-407f-99b3-6bb9d2dba92c-image.png

      Ich erhalte aber lediglich:

      07:31:21.722	info	javascript.0 (13463) script.js.Tests.Statusabfrage: {'0':'stiebel-isg.0.Info.STATUS.BETRIEBSSTATUS.SCHALTPROGRAMM_AKTIV','length':1}
      

      Und gestern Abend habe ich mit selbiger Abfrage mehr erhalten:

      18:40:38.156 info javascript.0 (13463) script.js.Tests.Statusabfrage: {'0':'stiebel-isg.0.Info.STATUS.BETRIEBSSTATUS.ABTAUEN_VERDAMPFER','1':'stiebel-isg.0.Info.STATUS.BETRIEBSSTATUS.HEIZEN','2':'stiebel-isg.0.Info.STATUS.BETRIEBSSTATUS.SCHALTPROGRAMM_AKTIV','length':3}
      
      1 Reply Last reply Reply Quote 0
      • T
        ticaki Developer last edited by

        Da muß ich passen, bei mir geht es in jedem von mir getesteten Zweig mit diesen beiden und zeigt auch den richtigen Inhalt an. Ist es möglich das die States garnicht existieren? Hast du unmittelbar um den Test herum ein Reload des Objekttab gemacht?

        S 1 Reply Last reply Reply Quote 0
        • C
          CruziX last edited by CruziX

          Das sollte glaube auch so gehen

          let exists = $(idVomDp);
          

          Müsste dann false sein, wenn er nicht vorhanden ist.
          bzw. prüfe ich dann immer
          if(!exists) {}

          1 Reply Last reply Reply Quote 0
          • AlCalzone
            AlCalzone Developer last edited by

            Hallo zusammen, nehmt doch einfach existsState(id) 🙂

            C S T 3 Replies Last reply Reply Quote 3
            • C
              CruziX @AlCalzone last edited by

              @AlCalzone sagte in getState - warning log / JS Dokumentation:

              existsState

              Die Funktion gibt es?
              Ist gar nicht in der Doku beschrieben

              AlCalzone 1 Reply Last reply Reply Quote 0
              • AlCalzone
                AlCalzone Developer @CruziX last edited by

                @CruziX Ja gibt es. Sollte eigentlich auch im Dropdown für autocomplete auftauchen:

                	/**
                	 * Checks if the state with the given ID exists
                	 */
                	function existsState(id: string): boolean;
                	/**
                	 * Checks if the object with the given ID exists
                	 */
                	function existsObject(id: string): boolean;
                

                Wenn sie nicht in der Doku steht, ist natürlich doof.

                C 1 Reply Last reply Reply Quote 0
                • C
                  CruziX @AlCalzone last edited by

                  @AlCalzone Das ist natürlich praktisch ^^
                  Wo kann man denn die Funktionen im Code direkt ansehen?

                  AlCalzone 1 Reply Last reply Reply Quote 0
                  • AlCalzone
                    AlCalzone Developer @CruziX last edited by

                    @CruziX Diese Datei enthält die Definitionen für Auto-Complete und Syntax-Check:
                    https://github.com/ioBroker/ioBroker.javascript/blob/master/lib/javascript.d.ts
                    Interessant wird es ab https://github.com/ioBroker/ioBroker.javascript/blob/5055cc9cb5e017c37eb9a64f0084e2a76fba26f2/lib/javascript.d.ts#L537

                    Die Funktionen selbst kannst du dir hier anschauen (sandbox-Objekt):
                    https://github.com/ioBroker/ioBroker.javascript/blob/5055cc9cb5e017c37eb9a64f0084e2a76fba26f2/lib/sandbox.js#L452

                    1 Reply Last reply Reply Quote 1
                    • S
                      SaschaS @ticaki last edited by

                      @ticaki Der Cache des Browers hat mich in die Irre geführt.

                      1 Reply Last reply Reply Quote 0
                      • S
                        SaschaS @AlCalzone last edited by

                        @AlCalzone said in getState - warning log / JS Dokumentation:

                        Hallo zusammen, nehmt doch einfach existsState(id) 🙂

                        Die macht das Leben so viel einfacher. Die kannte ich in der Tat noch nicht..Genial 🙂

                        1 Reply Last reply Reply Quote 0
                        • T
                          ticaki Developer @AlCalzone last edited by

                          @AlCalzone
                          Danke

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

                          Support us

                          ioBroker
                          Community Adapters
                          Donate

                          430
                          Online

                          31.8k
                          Users

                          80.0k
                          Topics

                          1.3m
                          Posts

                          5
                          17
                          1590
                          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