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.
    • oberfragger
      oberfragger @MCU last edited by

      @MCU Moin,
      wo ist der Fehler?

      50a01555-c518-45c4-a1f0-293825b41532-image.png
      Variable auf "leer" gesetzt und dann gepingt.
      Ich habe einen ganz anderen Block.

      Auch mit dem request von dir bekomme ich kein Ergebnis (hab das device auch vorher angepingt). Wo ist der Fehler?

      0a387c9c-efe8-436e-ab6f-5e9028b51b58-image.png

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

        @oberfragger sagte:

        Wo ist der Fehler?

        In beiden Fällen wird das Ergebnis in der lokalen Variablen result übergeben.

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

          @oberfragger
          Darf der user überhaupt ping ausführen?

          Auf welchem System läuft das?

          sudo -u iobroker ping google.de 192.168.178.160
          
          oberfragger 1 Reply Last reply Reply Quote 1
          • oberfragger
            oberfragger @Thomas Braun last edited by

            @Thomas-Braun
            Ähh.. ich glaube Top Hinweis.
            iobroker läuft auf einem Debian10 unter Proxmox (VM). Habe mal gepingt und da ging nix (.160 war defintiv nicht online, .100 ist der Proxmox Host.

            443c7882-d438-42ae-94c3-cf5a0343806f-image.png

            Quizfrage...wie erlaube ich "ping" für den user iobroker? Ich habe google bemüht...bin aber nicht richtig fündig geworden...

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

              @oberfragger Vielleicht mal nur "sudo ping -c 1 192.168.178.160"

              b5769e98-84f9-4857-a695-9c38f6b316be-image.png

              22:59:36.426	info	javascript.0 (1661) script.js.TESTS.Alexa_Frage: exec: sudo ping -c 1 192.168.178.105
              22:59:36.426	info	javascript.0 (1661) script.js.TESTS.Alexa_Frage: registered 0 subscriptions and 0 schedules
              22:59:36.455	info	javascript.0 (1661) script.js.TESTS.Alexa_Frage: PING 192.168.178.105 (192.168.178.105) 56(84) bytes of data. 64 bytes from 192.168.178.105: icmp_seq=1 ttl=255 time=3.05 ms --- 192.168.178.105 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 3.046/3.046/3.046/0.000 ms
              

              User iobroker kann man der Gruppe Sudo hinzufügen.

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

                @MCU Klappt leider auch nicht.
                Auf der Konsole bekomme ich:
                ee470467-675c-4535-ab60-def7e7ba5ccd-image.png

                Im Log kommt leider nichts an.
                2f56aaf2-003c-48d6-8218-c0d8f9cfb136-image.png

                User iobroker habe ich zu sudo hinzugefügt. Leider kein Erfolg.

                60879795-2dd7-47d9-985b-71d824164d75-image.png

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

                F Thomas Braun M 3 Replies Last reply Reply Quote 0
                • 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
                                            • First post
                                              Last post

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            839
                                            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