Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. [geloest] Ping via Blockly ohne ping.adapter auslesen

    NEWS

    • Wir empfehlen: Node.js 22.x

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker goes Matter ... Matter Adapter in Stable

    [geloest] Ping via Blockly ohne ping.adapter auslesen

    This topic has been deleted. Only users with topic management privileges can see it.
    • F
      fastfoot @oberfragger last edited by

      @oberfragger sagte in Ping via Blockly ohne ping.adapter auslesen:
      Leider kein Erfolg.

      7a8f0839-e0b5-428d-9364-b19be8a39ec7-image.png

      wo bitte weist du denn der Variablen das Ergebnis des Ping zu?

      1 Reply Last reply Reply Quote 0
      • Thomas Braun
        Thomas Braun Most Active @oberfragger last edited by

        @oberfragger

        pi@raspberrypi:~ $ which ping
        /bin/ping
        pi@raspberrypi:~ $ ls -la /bin/ping
        -rwsr-xr-x 1 root root 55720 Jan 14  2020 /bin/ping
        
        1 Reply Last reply Reply Quote 0
        • M
          MCU @oberfragger last edited by

          @oberfragger Nochmal langsam die Debug Output Variable muss result heissen!
          Erstelle eine Variable namens result. Und nimm das elternbad_spiegel_response raus

          oberfragger 1 Reply Last reply Reply Quote 0
          • oberfragger
            oberfragger @MCU last edited by

            @MCU Ach herrje. Dass man die Variable genau so benennen muss. Habe das mal gemacht und leider kein Erfolg.

            7b67412c-d36f-4863-9bd5-b8168a90415c-image.png

            06b60555-a9c1-486e-b707-28d8a73fc597-image.png

            paul53 M 2 Replies Last reply Reply Quote 0
            • paul53
              paul53 @oberfragger last edited by paul53

              @oberfragger sagte:

              leider kein Erfolg.

              "sudo ping - c 192.168.178.160" ist keine URL, sondern ein Kommando (exec).

              Die Initialisierung von result mit einem Leerstring ist unnötig.
              Versuche es mal so:

              Blockly_temp.JPG

              Wahrscheinlich sollte error ausgewertet werden, um die Erreichbarkeit zu prüfen. Allerdings wird bei einem Error immer auch ein Error-Log erzeugt.

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

                @paul53 Sorry,
                woher bekomme cih das Objekt "error"?
                07261029-5a4f-41bb-ac7a-1a366c69267f-image.png

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

                  @oberfragger sagte:

                  woher bekomme cih das Objekt "error"?

                  Du musst einen Variable mit dem Bezeichner error erstellen.

                  Anstelle der URL steht immer noch ein Kommando !

                  1 Reply Last reply Reply Quote 0
                  • M
                    MCU @oberfragger last edited by

                    @oberfragger Du hattest doch vorher Exec genutzt, warum denn umgestellt auf request?

                    Exec nutzt man für : sudo ping und andere Befehle, die man auf den Console ausführen kann

                    request nutzt man für URL -> http-Abfragen oder Aufrufe

                    Thomas Braun oberfragger 2 Replies Last reply Reply Quote 0
                    • Thomas Braun
                      Thomas Braun Most Active @MCU last edited by

                      @MCU sagte in Ping via Blockly ohne ping.adapter auslesen:

                      request nutzt man für URL -> http-Abfragen oder Aufrufe

                      Besser nicht mehr. request gilt als deprecated.

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

                        @oberfragger

                        Verwende exec() ohne sudo (bei mir funktioniert es).

                        Blockly_temp.JPG

                        1 Reply Last reply Reply Quote 1
                        • M
                          MCU @Thomas Braun last edited by

                          @Thomas-Braun Was nutzt man denn anstatt "request" in Blockly?

                          Thomas Braun F 2 Replies Last reply Reply Quote 0
                          • Thomas Braun
                            Thomas Braun Most Active @MCU last edited by

                            @MCU
                            Keine Ahnung. Bin eher Blocky-Legastheniker. Muss vermutlich perspektivisch auf irgendwas anderes umgestellt werden.

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

                            M 1 Reply Last reply Reply Quote 0
                            • M
                              MCU @Thomas Braun last edited by

                              @Thomas-Braun Ok. Danke für die Info.

                              1 Reply Last reply Reply Quote 0
                              • F
                                fastfoot @MCU last edited by

                                @MCU sagte in Ping via Blockly ohne ping.adapter auslesen:

                                Was nutzt man denn anstatt "request" in Blockly?

                                solange request() noch in iobroker(und damit in Blockly) integriert ist, sehe ich keine Notwendigkeit da umzusteigen, innerhalb Blockly wäre das ja auch mit erheblichen Klimmzügen verbunden(JS-Funktion anstatt request-Block, laden einer Alternative in der JS-Instanz).

                                Für JS wird von Apollon77 wohl axios() empfohlen, welches auch recht einfach anzuwenden ist. Ich pers. nehme da nichts Anderes mehr.

                                M 1 Reply Last reply Reply Quote 0
                                • oberfragger
                                  oberfragger @MCU last edited by

                                  @MCU Deine 2. Antwort enthielt request im Screenshot.
                                  @paul53 - Danke- so funktioniert es!

                                  Danke @all für die Hilfe.

                                  1 Reply Last reply Reply Quote 0
                                  • M
                                    MCU @fastfoot last edited by

                                    @fastfoot Ok. Danke für die Info.

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

                                    Support us

                                    ioBroker
                                    Community Adapters
                                    Donate

                                    933
                                    Online

                                    32.0k
                                    Users

                                    80.4k
                                    Topics

                                    1.3m
                                    Posts

                                    5
                                    24
                                    1696
                                    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