Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. JavaScript
    5. Hilfe bei Skripte von request auf httpGet umbauen

    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

    Hilfe bei Skripte von request auf httpGet umbauen

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

      @liv-in-sky

      wo seht ihr nun einen unterschied?
      die beiden zeilen sind doch gleich?

      javascript.0	16:22:19.588	info	script.js.common.VolkszaehlerNeuTest: {"version":"0.3","data":[{"tuples":[[1716906115000,0,1]],"uuid":"bc3edcd0-24c4-11ea-b257-bdbd9553c516","from":1716906055000,"to":1716906115000,"min":[1716906115000,0],"max":[1716906115000,0],"average":0,"consumption":0,"rows":2},{"tuples":[[1716906115000,840,1]],"uuid":"deda8550-24c4-11ea-b402-275ee0956365","from":1716906085000,"to":1716906115000,"min":[1716906115000,840],"max":[1716906115000,840],"average":840,"consumption":7,"rows":2}]}
      javascript.0	16:22:19.590	info	script.js.common.VolkszaehlerNeuTest: ---------------------------
      javascript.0	16:22:19.590	info	script.js.common.VolkszaehlerNeuTest: {"version":"0.3","data":[{"tuples":[[1716906115000,0,1]],"uuid":"bc3edcd0-24c4-11ea-b257-bdbd9553c516","from":1716906055000,"to":1716906115000,"min":[1716906115000,0],"max":[1716906115000,0],"average":0,"consumption":0,"rows":2},{"tuples":[[1716906115000,840,1]],"uuid":"deda8550-24c4-11ea-b402-275ee0956365","from":1716906085000,"to":1716906115000,"min":[1716906115000,840],"max":[1716906115000,840],"average":840,"consumption":7,"rows":2}]}
      j
      
      liv-in-sky 1 Reply Last reply Reply Quote 0
      • liv-in-sky
        liv-in-sky @OliverIO last edited by liv-in-sky

        @oliverio oh sorry - da ich nicht testen kann und das script etwas angepaßt habe, funktioniert es jetzt - dann kann ich mit @Negalein wiede weitermachen

        vorher stand bei max und min nur das wort [array] drin

        also so:

        javascript.0	16:22:19.590	info	script.js.common.VolkszaehlerNeuTest: {"version":"0.3","data":[{"tuples":[[1716906115000,0,1]],"uuid":"bc3edcd0-24c4-11ea-b257-bdbd9553c516","from":1716906055000,"to":1716906115000,"min":[array],"max":[array],"average":0,"consumption":0,"rows":2},{"tuples":[[1716906115000,840,1]],"uuid":"deda8550-24c4-11ea-b402-275ee0956365","from":1716906085000,"to":1716906115000,"min":[array],"max":[array],"average":840,"consumption":7,"rows":2}]}
        j
        
        
        OliverIO 1 Reply Last reply Reply Quote 0
        • OliverIO
          OliverIO @liv-in-sky last edited by

          @liv-in-sky
          das kann eine funktion der log ausgabe sein, die ab einer bestimmten tiefe der objektverschachtelung nur noch den typ ausgibt, obwohl es da schon noch weitergeht.
          über die stringify ausgabe seht ihr ja, das da alles da ist.
          die reihenfolge der properties in einem json ist nicht standardisiert, führt aber immer zum gleichen objekt. daher ist ein textbasierter vergleich meist schwierig.

          1 Reply Last reply Reply Quote 1
          • K
            kukoratsch last edited by kukoratsch

            neues Thema aufgemacht

            1 Reply Last reply Reply Quote 0
            • R
              Rushmed Most Active last edited by

              Hallo meine Herren,

              ich muss nochmal nach dem Thema:

              timeout of 2000ms exceeded
              

              fragen.

              Wenn ich diesen Block ausführe:
              da94fe68-5856-4054-8ca8-5e974ef43b36-grafik.png
              bekomme ich diese Antwort:

              javascript.0	19:17:46.172	info	Start JavaScript script.js.Matrix_Displays (Blockly)
              javascript.0	19:17:46.207	info	script.js.Matrix_Displays: registered 69 subscriptions, 0 schedules, 0 messages, 0 logs and 0 file subscriptions
              javascript.0	19:17:46.267	info	script.js.Matrix_Displays: {"Restart":"Restarting"}
              javascript.0	19:17:50.287	error	script.js.Matrix_Displays: timeout of 2000ms exceeded
              

              Der Befehl wird auf dem (Tasmota) Gerät ausgeführt und die Antwort kommt ja augenscheinlich auch im ioBroker an. Warum kommt dann hier der Error und kann ich etwas dagegen tun?

              Danke vorab.

              W R 2 Replies Last reply Reply Quote 0
              • W
                Wildbill @Rushmed last edited by Wildbill

                @rushmed Vermutlich, weil das Gerät den Restart gleich ausführt, ohne darüber nochmal eine Rückmeldung zu geben. Also wird nach den 2 Sekunden eben der Timeout ins Log geschrieben.
                Ich meine, wenn ich bei (einigen zumindest) Tasmota-Geräten per Webinterface einen Restart auslöse, dass dann auch die Fehlerseite aufgeht, dass die Seite nicht erreichbar wäre. Bei anderen kommt vorher noch eine Seite mit „Success“. Woran das aber liegt, dass die Success-Seite mal kommt und mal nicht und ob das immer die gleichen Geräte sind habe ich nie verfolgt, weil es mich bisher auch nicht gestört hat.

                Gruss, Jürgen

                EDIT: Der Restart wird ammer in beiden Fällen jeweils problemlos ausgeführt.

                R 1 Reply Last reply Reply Quote 0
                • R
                  Rushmed Most Active @Wildbill last edited by Rushmed

                  @wildbill Ok, aber die Antwort von Tasmota:

                  javascript.0	19:17:46.267	info	script.js.Matrix_Displays: {"Restart":"Restarting"}
                  

                  wird doch empfangen aber scheinbar nicht als Antwort interpretiert.

                  Hat @haus-automatisierung hier evtl. einen Rat?

                  W haus-automatisierung 2 Replies Last reply Reply Quote 0
                  • W
                    Wildbill @Rushmed last edited by

                    @rushmed Das stimmt allerdings, wenn man es so sieht. Keine Ahnung, ob da noch danach was „erwartet“ wird, was wegen des Reboots aber nicht kommt.

                    Gruss, Jürgen

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

                      @rushmed sagte in Hilfe bei Skripte von request auf httpGet umbauen:

                      Hat @haus-automatisierung hier evtl. einen Rat?

                      Tasmota ist hier zumindest immer wieder auffällig. Bitte mal die gleiche URL mit curl aufrufen und verbose aktivieren -v damit man alle Header sieht.

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

                        @haus-automatisierung
                        ich habe:
                        9862153b-f04f-4db7-8db4-00cf515c091f-grafik.png
                        Ausgeführt und es ist garnichts passiert. Weder wurde der Befehl ausgeführt, noch kam eine Antwort.

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

                          @rushmed Mach das mal direkt per ssh oder auf einem anderen System. Also nicht aus Blockly heraus. Ansonsten müssen natürlich Anführungszeichen um die URL, damit die 1 am Ende noch dazu gehört (oder %20 dazwischen)

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

                            @haus-automatisierung

                            pi@Smartazamba:~ $ curl -v http://192.168.178.138/cm?cmnd=Restart 1
                            *   Trying 192.168.178.138:80...
                            * Connected to 192.168.178.138 (192.168.178.138) port 80 (#0)
                            > GET /cm?cmnd=Restart HTTP/1.1
                            > Host: 192.168.178.138
                            > User-Agent: curl/7.88.1
                            > Accept: */*
                            >
                            < HTTP/1.1 200 OK
                            < Content-Type: application/json
                            < Server: Tasmota/14.1.0.1 (ESP8266EX)
                            < Cache-Control: no-cache, no-store, must-revalidate
                            < Pragma: no-cache
                            < Expires: -1
                            < Accept-Ranges: none
                            < Transfer-Encoding: chunked
                            < Connection: close
                            <
                            * Closing connection 0
                            {"Restart":"1 to restart, 2 to halt"}*   Trying 0.0.0.1:80...
                            

                            Restart ist nicht erfolgt.

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

                              @rushmed sagte in Hilfe bei Skripte von request auf httpGet umbauen:

                              Restart ist nicht erfolgt.

                              Weil Du wieder keine Anführungszeichen um die Url gemacht hast und die 1 am Ende für curl somit nicht zur Url gehört (sieht man auch im verbose)

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

                                @haus-automatisierung Sorry.

                                pi@Smartazamba:~ $ curl -v "http://192.168.178.138/cm?cmnd=Restart 1"
                                * Closing connection -1
                                curl: (3) URL using bad/illegal format or missing URL
                                
                                
                                haus-automatisierung 1 Reply Last reply Reply Quote 0
                                • haus-automatisierung
                                  haus-automatisierung Developer Most Active @Rushmed last edited by

                                  @rushmed curl -v "http://192.168.178.138/cm?cmnd=Restart%201"

                                  1 Reply Last reply Reply Quote 0
                                  • R
                                    Rushmed Most Active last edited by Rushmed

                                    @haus-automatisierung sagte in Hilfe bei Skripte von request auf httpGet umbauen:

                                    curl -v "http://192.168.178.138/cm?cmnd=Restart 1"

                                    pi@Smartazamba:~ $ curl -v "http://192.168.178.138/cm?cmnd=Restart%201"
                                    *   Trying 192.168.178.138:80...
                                    * Connected to 192.168.178.138 (192.168.178.138) port 80 (#0)
                                    > GET /cm?cmnd=Restart%201 HTTP/1.1
                                    > Host: 192.168.178.138
                                    > User-Agent: curl/7.88.1
                                    > Accept: */*
                                    >
                                    < HTTP/1.1 200 OK
                                    < Content-Type: application/json
                                    < Server: Tasmota/14.1.0.1 (ESP8266EX)
                                    < Cache-Control: no-cache, no-store, must-revalidate
                                    < Pragma: no-cache
                                    < Expires: -1
                                    < Accept-Ranges: none
                                    < Transfer-Encoding: chunked
                                    < Connection: close
                                    <
                                    * Closing connection 0
                                    {"Restart":"Restarting"}p
                                    

                                    Restart wir ausgeführt.
                                    Script sendet wieder:

                                    javascript.0	22:20:34.986	error	script.js.Matrix_Displays: timeout of 2000ms exceeded
                                    

                                    Das passiert ohne Scriptneustart o.ä.. Scheinbar lauscht das Script aber empfängt nichts.
                                    Gesendet hab' ich den Befehl per Putty.

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

                                      @rushmed sagte in Hilfe bei Skripte von request auf httpGet umbauen:

                                      Transfer-Encoding: chunked

                                      Könnte sein dass axios denkt dass da noch mehr kommen müsste und deswegen wartet (bis timeout). Muss ich mir mal ein Test-Setup aufbauen. Eventuell auch eine blöde Kombination in Tasmota mit Restart, dass die Verbindung dann nicht richtig geschlossen wird, weil ESP neustartet.

                                      https://nothing-else.blog/blog/axios-timeout-for-chunked-responses

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

                                        @haus-automatisierung Ich hab' noch eine Info:
                                        38e03a61-d73f-4ad4-b41f-71223e79a4e2-grafik.png
                                        Bringt nur:

                                        javascript.0	22:26:05.158	error	script.js.Tasmota: timeout of 2000ms exceeded
                                        javascript.0	22:26:05.164	error	script.js.Tasmota: timeout of 2000ms exceeded
                                        

                                        bei drei angesprochenen Geräten von denen zwei offline sind. Hier kommt die Meldung für das Verfügbare gerät nicht. Das ist schlüssig.
                                        Wo liegt hier der Unterschied?

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

                                          @rushmed sagte in Hilfe bei Skripte von request auf httpGet umbauen:

                                          Wo liegt hier der Unterschied?

                                          Andere Tasmota-Version?

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

                                            @haus-automatisierung Oha, da passiert was, ich prüfe kurz.

                                            Edit1:
                                            Tasmota Development Version" Tasmota 14.1.0.1 (display)" bringt den Error.
                                            Tasmota Master Version "Tasmota 14.1.0 (display)" bringt den Error nicht.
                                            Super!
                                            Werde die Devices auf die Tasmota Master umstellen.
                                            Vielen Dank!

                                            Edit2:
                                            Hab' mich zu früh gefreut. Der Error kommt wieder.

                                            Edit3:
                                            Jetzt sind zwei von drei Geräten angschlossen bei der Ausführung von:
                                            04efa019-1d5e-4192-a564-47c674fd6447-1718396830836-38e03a61-d73f-4ad4-b41f-71223e79a4e2-grafik.png
                                            und die Errormeldung kommt nurnoch einmal. Wieder schlüssig.

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

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            851
                                            Online

                                            31.8k
                                            Users

                                            80.0k
                                            Topics

                                            1.3m
                                            Posts

                                            16
                                            132
                                            9220
                                            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