Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Problem mit getStateAsync

    NEWS

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    Problem mit getStateAsync

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

      @paul53
      Wie ist es richtig?

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

        @automatisierer-0 sagte: Wie ist es richtig?

        var MyoldValue = await getStateAsync("knx.0.Heizung_und_Temp_(HZ).Alles_(Zentral).HZ_-_TH_-_Therme_-_Heizkreis_1_Vorlaufemperatur_(R)_old").val;
        

        Vielleicht kann man mit .val auch erst nachträglich auf das Objekt zugreifen? Wie @ciddi89 gezeigt hat:

        const MyoldObj = await getStateAsync('knx.0.Heizung_und_Temp_(HZ).Alles_(Zentral).HZ_-_TH_-_Therme_-_Heizkreis_1_Vorlaufemperatur_(R)_old');
        let MyoldValue = MyoldObj.val;
        
        A 2 Replies Last reply Reply Quote 0
        • A
          Automatisierer 0 @paul53 last edited by

          @paul53 said in Problem mit getStateAsync:

          var MyoldValue = await getStateAsync("knx.0.Heizung_und_Temp_(HZ).Alles_(Zentral).HZ_-TH-Therme-Heizkreis_1_Vorlaufemperatur(R)_old").val;

          NEIN: bringt Compilerfehler

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

            @paul53 said in Problem mit getStateAsync:

            const MyoldObj = await getStateAsync(knx.0.Heizung_und_Temp_(HZ).Alles_(Zentral).HZ_-_TH_-_Therme_-_Heizkreis_1_Vorlaufemperatur_(R)_old);

            NEIN: Gleicher Fehler, funktioniert nicht

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

              @automatisierer-0 sagte: funktioniert nicht

              Tausche die ` gegen Hochkommata aus.

              1 Reply Last reply Reply Quote 0
              • A
                Automatisierer 0 @haus-automatisierung last edited by

                @haus-automatisierung said in Problem mit getStateAsync:

                Dann musst du mit await sendToAsync() arbeiten und auf das Ergebnis warten.

                Kannst du mir bitte die Codezeile schreiben wie es richtg sein soll?
                Die Alte ist:

                sendTo("pushover", "send", {message: "---Lesen OLD", sound: "" }); 
                
                haus-automatisierung 1 Reply Last reply Reply Quote 0
                • A
                  Automatisierer 0 @paul53 last edited by

                  @paul53 said in Problem mit getStateAsync:

                  Hast Du den Puffer in der Javascript-Instanz deaktiviert?

                  Nein. Bitte wie mache ich das ?

                  ? 1 Reply Last reply Reply Quote 0
                  • haus-automatisierung
                    haus-automatisierung Developer Most Active @Automatisierer 0 last edited by

                    @automatisierer-0 sagte in Problem mit getStateAsync:

                    Kannst du mir bitte die Codezeile schreiben wie es richtg sein soll?

                    Na

                    await sendToAsync("pushover", "send", { message: "---Lesen OLD", sound: "" });
                    
                    A 1 Reply Last reply Reply Quote 0
                    • ?
                      A Former User @Automatisierer 0 last edited by

                      @automatisierer-0 das mit den Puffer lass mal sein.
                      Frage: Warum muss es unbedingt async sein? Hier reicht der ganz normale getState aus. Finde merkwürdig das du ein Compiler Fehler bekommst. Was sagt der genau? Hab es in mehreren scripts genau so und da kommt kein Fehler. Steht da wirklich schon was im Datenpunkt drin den du abfragen möchtest? Finde keine Antwort auf die Frage die Hausautomatisierung dir gestellt hat.

                      1 Reply Last reply Reply Quote 0
                      • A
                        Automatisierer 0 @haus-automatisierung last edited by

                        @haus-automatisierung said in Problem mit getStateAsync:

                        await sendToAsync("pushover", "send", { message: "---Lesen OLD", sound: "" });

                        Image 029.jpg

                        haus-automatisierung 1 Reply Last reply Reply Quote 0
                        • haus-automatisierung
                          haus-automatisierung Developer Most Active @Automatisierer 0 last edited by haus-automatisierung

                          @automatisierer-0 Naja, die Doku und Type Definition ist scheinbar nicht ganz vollständig (hatten wir ja oben schon). Soll ich auf die Stelle im GitHub Repo verlinken, dass es die Funktion gibt? 🙂

                          A 2 Replies Last reply Reply Quote 0
                          • A
                            Automatisierer 0 @haus-automatisierung last edited by

                            @haus-automatisierung
                            Ich bin ziemlich ein Anfänger, der Verweis auf github befüchte ich wird mit gar nicht weiterhelfen.

                            Aber wie löse ich das Problem mit dem Fehler: cannot find name 'SendToAsync' ?
                            Was muss ich tun dass der Fehler weggeht?

                            1 Reply Last reply Reply Quote 0
                            • A
                              Automatisierer 0 @haus-automatisierung last edited by

                              @haus-automatisierung
                              Ich habe auf die letzte Version des JavaScipt Adapters upgedated.
                              Jetzt kommt kein Compilerfehler mehr.

                              Aber funktonieren tut es leider trotzdem nicht.
                              Hier kurz mein Code:

                              // Test
                              MyInit()
                              
                              async function MyInit(){
                                  await sendToAsync("pushover", "send", {message: "MyInit_1", sound: "" })
                                  await sendToAsync("pushover", "send", {message: "MyInit_2", sound: "" })
                                  await sendToAsync("pushover", "send", {message: "MyInit_3", sound: "" })
                              }
                              

                              Am Handy kommt leider nur die erste Pushover Nachricht an.
                              Was muss ich machen dass alle drei Nachrichten kommen?

                              haus-automatisierung 1 Reply Last reply Reply Quote 1
                              • haus-automatisierung
                                haus-automatisierung Developer Most Active @Automatisierer 0 last edited by

                                @automatisierer-0 Müsste ich jetzt testen ob das an Pushover liegt. Das Promise wird nie erfüllt und daher geht es nicht weiter. Ändere das mal in eine konkrete Instanz (also pushover.0 statt pushover). Oder hast Du mehrere Instanzen die den Text versenden sollen?

                                A ? 2 Replies Last reply Reply Quote 0
                                • A
                                  Automatisierer 0 @haus-automatisierung last edited by

                                  @haus-automatisierung
                                  ich schreibe;

                                  // Test
                                  MyInit()
                                  
                                  
                                  async function MyInit(){
                                      await sendToAsync("pushover.0", "send", {message: "MyInit_1", sound: "" })
                                      await sendToAsync("pushover.0", "send", {message: "MyInit_2", sound: "" })
                                      await sendToAsync("pushover.0", "send", {message: "MyInit_3", sound: "" })
                                  }
                                  

                                  Es kommt dann der folgende Fehler nd der Javascript Adapter ist "rot":

                                  host.VM-KNX1
                                  	2023-02-11 22:26:06.418	info	Restart adapter system.adapter.javascript.0 because enabled
                                  host.VM-KNX1
                                  	2023-02-11 22:26:06.418	error	instance system.adapter.javascript.0 terminated with code 6 (UNCAUGHT_EXCEPTION)
                                  host.VM-KNX1
                                  	2023-02-11 22:26:06.417	error	Caught by controller[1]: }
                                  host.VM-KNX1
                                  	2023-02-11 22:26:06.417	error	Caught by controller[1]: result: '{"status":1,"request":"09796865-b49e-48df-8ef1-aec5288af1d4"}'
                                  host.VM-KNX1
                                  	2023-02-11 22:26:06.417	error	Caught by controller[1]: error: null,
                                  host.VM-KNX1
                                  	2023-02-11 22:26:06.417	error	Caught by controller[1]: {
                                  host.VM-KNX1
                                  	2023-02-11 22:26:06.417	error	Caught by controller[0]: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
                                  

                                  langsam verzweifle ich.....

                                  haus-automatisierung 1 Reply Last reply Reply Quote 0
                                  • ?
                                    A Former User @haus-automatisierung last edited by

                                    @haus-automatisierung said in Problem mit getStateAsync:

                                    @automatisierer-0 Müsste ich jetzt testen ob das an Pushover liegt.

                                    Also ich hab die Erfahrung gemacht das pushover da nicht so drauf steht wenn mehrere Nachrichten gleichzeitig gesendet werden sollen. Dann verschluckt er sich gerne mal und sendet was nicht oder sogar doppelt. Daher wäre es besser diese versetzt zu senden.

                                    A 1 Reply Last reply Reply Quote 0
                                    • A
                                      Automatisierer 0 @Guest last edited by

                                      @ciddi89
                                      Bitte um ein Beispiel wie ich den Zeitversatz mache

                                      1 Reply Last reply Reply Quote 0
                                      • haus-automatisierung
                                        haus-automatisierung Developer Most Active @Automatisierer 0 last edited by

                                        @automatisierer-0 sagte in Problem mit getStateAsync:

                                        Es kommt dann der folgende Fehler nd der Javascript Adapter ist "rot":

                                        Liegt nicht an Dir. Ist ein Bug im Adapter und schon bekannt und gefixt. Wird mit der nächsten Version laufen (wenn diese bald freigegeben wird): https://github.com/ioBroker/ioBroker.javascript/issues/1198

                                        Marty56 created this issue in ioBroker/ioBroker.javascript

                                        closed sendToAsync always returns error state #1198

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

                                        Support us

                                        ioBroker
                                        Community Adapters
                                        Donate

                                        815
                                        Online

                                        31.7k
                                        Users

                                        79.8k
                                        Topics

                                        1.3m
                                        Posts

                                        4
                                        27
                                        1292
                                        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