Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Speedtest-Skript von kreyenborg.koeln für Kabel-Gigabit

    NEWS

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    Speedtest-Skript von kreyenborg.koeln für Kabel-Gigabit

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

      @skb

      Ja. Der 0_userdata.0.Speedtest.Speedtest-Trigger ist ein boolean-dp

      DJMarc75 SKB 2 Replies Last reply Reply Quote 0
      • DJMarc75
        DJMarc75 @Loemic last edited by

        @loemic sagte in Speedtest-Skript von kreyenborg.koeln für Kabel-Gigabit:

        Ja. Der 0_userdata.0.Speedtest.Speedtest-Trigger ist ein boolean-dp

        Na dann zeig mal die Objektdaten bitte, damit wir das auch bestätigen können 😉

        1 Reply Last reply Reply Quote 0
        • SKB
          SKB Developer Most Active @Loemic last edited by

          @loemic Ah, sorry, Fehler gefunden.

          on({ id: "javascript.0.Speedtest.trigger", change: "any" }, function (obj) {
          if (obj.state.val===true) { /* state fehlte */
          speedtest ();
          }
          });
          
          Loemic 1 Reply Last reply Reply Quote 0
          • Loemic
            Loemic @SKB last edited by

            @skb @DJMarc75

            es funktioniert jetzt, vielen vielen Dank 🙂

            Der DP war korrekt, es fehlte tatsächlich das "state", wie von @SKB gesagt.
            Ich habe noch eine Zeile für einen Log-Eintrag hinzugefügt.
            Hier der Code-Schnipsel, falls das jemand "nachbauen" möchte, der bei mir funktioniert:

            // Script ausführen wenn Datenpunkt "Speedtest-Trigger" = true (Danke an @SKB im iobroker-Forum)
            on({ id: "boolean-Datenpunkt", change: "any" }, function (obj) {
            if (obj.state.val===true) {
            speedtest ();
            log("Speedtest: Trigger löst Speedtest aus!");
            }
            }
            );
            
            SKB 1 Reply Last reply Reply Quote 0
            • SKB
              SKB Developer Most Active @Loemic last edited by

              @loemic ich weiss 🙂

              Ist ja mein Speedtest-Skript 😄

              1 Reply Last reply Reply Quote 0
              • manuxi
                manuxi last edited by

                @thomas-braun sagte in Speedtest-Skript von kreyenborg.koeln für Kabel-Gigabit:

                curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | sudo bash

                Für buanet-Docker-Container funktioniert sudo nicht, daher habe ich folgendes gemacht:

                cd~
                wget https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh
                chmod 744 script.deb.sh
                ./script.deb.sh
                

                Danach kann der Speedtest installiert werden mit

                apt install speedtest
                
                1 Reply Last reply Reply Quote 0
                • M
                  Mephisto090 last edited by Mephisto090

                  Hallo,

                  was mache ich falsch? In der Console funktioniert der Speedtest ohne Probleme. Das js Skript gibt mir Fehler aus. Ich nutze Docker von Bauanet. Mich wundert der Post von manuxi wo er beschreibt, dass buanet mit sudo nicht funktioniert. Bei mir ist es ja anscheinend mit sudo installiert.

                  (Das Skript ist unbearbeitet)

                  script.js.common.Speedtest:182:18:

                  // Schreibe Werte des JSON String in ein Array
                  function generiere_array(json_array) {
                      var j = JSON.parse(json_array);
                      var array_werte = [json_array,
                          j.ping.latency,
                          j.ping.jitter,
                          parseFloat((j.download.bandwidth / 125000).toFixed(2)),
                          parseFloat((j.upload.bandwidth / 125000).toFixed(2)),
                          parseFloat((j.download.bandwidth / (1024 * 1024)).toFixed(2)),
                          parseFloat((j.upload.bandwidth / (1024 * 1024)).toFixed(2)),
                          j.download.bandwidth,
                          j.upload.bandwidth,
                          j.isp,
                          j.interface.externalIp,
                          j.result.url,
                          j.result.id,
                          j.server.id,
                          j.server.ip,
                          j.server.name,
                          j.server.location,
                          j.server.country,
                          j.server.host,
                          parseFloat((j.download.bytes / (1024 * 1024)).toFixed(2)),
                          parseFloat((j.upload.bytes / (1024 * 1024)).toFixed(2)),
                          j.download.bytes,
                          j.upload.bytes,
                          parseFloat((j.download.elapsed / 1000).toFixed(2)),
                          parseFloat((j.upload.elapsed / 1000).toFixed(2)),
                          hole_datum()
                      ];
                      return array_werte;
                  }
                  

                  3746126a-ba84-4d0a-a2e6-f3b5ac7d4740-image.png

                  b8ccbfb1-4ada-4e98-a920-eba3721fd41f-image.png

                  70589f2c-f724-4b10-abdb-17d057660209-image.png

                  SKB 1 Reply Last reply Reply Quote 0
                  • SKB
                    SKB Developer Most Active @Mephisto090 last edited by

                    @mephisto090 Dazu kann ich leider nichts sagen - ich habe kein Docker im Einsatz.

                    Ich denke, du musst via:

                    type -p speedtest
                    

                    Schauen, wie der Pfad lautet. Diesen dann im Skript anpassen.

                    M 1 Reply Last reply Reply Quote 0
                    • M
                      Mephisto090 @SKB last edited by

                      @skb
                      1a4ab78c-7305-496d-aee4-d9bb0f20d5ff-image.png
                      70646e43-25d3-44c6-ab1d-dfd53cf66c41-image.png

                      Das passt 😞

                      SKB 1 Reply Last reply Reply Quote 0
                      • SKB
                        SKB Developer Most Active @Mephisto090 last edited by

                        @mephisto090 Und, wenn du das komplette Kommando via SSH eingibst, was passiert?

                        M 1 Reply Last reply Reply Quote 0
                        • M
                          Mephisto090 @SKB last edited by

                          @skb b210318d-3213-44fd-b762-3ebaad090bd4-image.png

                          das hier

                          SKB 1 Reply Last reply Reply Quote 0
                          • SKB
                            SKB Developer Most Active @Mephisto090 last edited by

                            @mephisto090 Dann teste mal statt -f json --json

                            Musst dann ggf. das Kommando anpassen.

                            M 1 Reply Last reply Reply Quote 0
                            • M
                              Mephisto090 @SKB last edited by Mephisto090

                              @skb laut ssh geht das irgendwie auch nicht

                              6f845c6f-a56a-46cb-8f9e-fff58d376ea9-image.png

                              SKB DJMarc75 2 Replies Last reply Reply Quote 0
                              • SKB
                                SKB Developer Most Active @Mephisto090 last edited by

                                @mephisto090 Und nur mit --json ?

                                M 2 Replies Last reply Reply Quote 0
                                • M
                                  Mephisto090 @SKB last edited by

                                  @skb scheint zu funktionieren. Habe es jetzt mal im script so angepasst.

                                  71645c5f-fec4-474e-9cfe-f47787d47df0-image.png

                                  SKB 1 Reply Last reply Reply Quote 0
                                  • M
                                    Mephisto090 @SKB last edited by

                                    @skb fef0a3fa-e41e-4229-ac1f-c597456fb420-image.png

                                    1 Reply Last reply Reply Quote 0
                                    • DJMarc75
                                      DJMarc75 @Mephisto090 last edited by

                                      @mephisto090 Konsolentexte nicht als Bild sondern kopieren und in Codetags hier einsetzen 😉

                                      M 1 Reply Last reply Reply Quote 0
                                      • SKB
                                        SKB Developer Most Active @Mephisto090 last edited by

                                        @mephisto090 Dann wird es laufen 🙂

                                        M 2 Replies Last reply Reply Quote 0
                                        • M
                                          Mephisto090 @DJMarc75 last edited by Mephisto090

                                          @DJMarc75

                                          root@iobroker:/opt/iobroker# /usr/bin/speedtest --json
                                          
                                          {
                                              "bytes_received": 111995656,
                                              "bytes_sent": 43466752,
                                              "client": {
                                                  "country": "DE",
                                                  "ip": "???????",
                                                  "isp": "Vodafone Germany DSL",
                                                  "ispdlavg": "0",
                                                  "isprating": "3.7",
                                                  "ispulavg": "0",
                                                  "lat": "11.111",
                                                  "loggedin": "0",
                                                  "lon": "22.222",
                                                  "rating": "0"
                                              },
                                              "download": 89252315.3942659,
                                              "ping": 26.842,
                                              "server": {
                                                  "cc": "DE",
                                                  "country": "Germany",
                                                  "d": 5.1528760454098,
                                                  "host": "speedeu.akesacloud.co.za:8080",
                                                  "id": "60714",
                                                  "lat": "52.5167",
                                                  "latency": 26.842,
                                                  "lon": "13.3833",
                                                  "name": "Berlin",
                                                  "sponsor": "Akesa IT - Europe",
                                                  "url": "http://speedeu.akesacloud.co.za:8080/speedtest/upload.php"
                                              },
                                              "share": null,
                                              "timestamp": "2023-10-20T14:47:20.708905Z",
                                              "upload": 34704998.6338473
                                          }
                                          
                                          root@iobroker:/opt/iobroker# /usr/bin/speedtest -h
                                          usage: speedtest [-h] [--no-download] [--no-upload] [--single] [--bytes] [--share] [--simple] [--csv] [--csv-delimiter CSV_DELIMITER] [--csv-header] [--json] [--list] [--server SERVER] [--exclude EXCLUDE] [--mini MINI]
                                                           [--source SOURCE] [--timeout TIMEOUT] [--secure] [--no-pre-allocate] [--version]
                                          
                                          Command line interface for testing internet bandwidth using speedtest.net. -------------------------------------------------------------------------- https://github.com/sivel/speedtest-cli
                                          
                                          options:
                                            -h, --help            show this help message and exit
                                            --no-download         Do not perform download test
                                            --no-upload           Do not perform upload test
                                            --single              Only use a single connection instead of multiple. This simulates a typical file transfer.
                                            --bytes               Display values in bytes instead of bits. Does not affect the image generated by --share, nor output from --json or --csv
                                            --share               Generate and provide a URL to the speedtest.net share results image, not displayed with --csv
                                            --simple              Suppress verbose output, only show basic information
                                            --csv                 Suppress verbose output, only show basic information in CSV format. Speeds listed in bit/s and not affected by --bytes
                                            --csv-delimiter CSV_DELIMITER
                                                                  Single character delimiter to use in CSV output. Default ","
                                            --csv-header          Print CSV headers
                                            --json                Suppress verbose output, only show basic information in JSON format. Speeds listed in bit/s and not affected by --bytes
                                            --list                Display a list of speedtest.net servers sorted by distance
                                            --server SERVER       Specify a server ID to test against. Can be supplied multiple times
                                            --exclude EXCLUDE     Exclude a server from selection. Can be supplied multiple times
                                            --mini MINI           URL of the Speedtest Mini server
                                            --source SOURCE       Source IP address to bind to
                                            --timeout TIMEOUT     HTTP timeout in seconds. Default 10
                                            --secure              Use HTTPS instead of HTTP when communicating with speedtest.net operated servers
                                            --no-pre-allocate     Do not pre allocate upload data. Pre allocation is enabled by default to improve upload performance. To support systems with insufficient memory, use this option to avoid a MemoryError
                                            --version             Show the version number and exit
                                          
                                          --version: Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0]
                                          
                                          DJMarc75 1 Reply Last reply Reply Quote 0
                                          • M
                                            Mephisto090 @SKB last edited by

                                            @skb leider nicht

                                            16:49:14.239	info	javascript.0 (951689) Start javascript script.js.common.Speedtest
                                            16:49:14.243	info	javascript.0 (951689) script.js.common.Speedtest: Speedtest: Erster Start des Skriptes! Datenpunkte werden erstellt!
                                            16:49:14.244	info	javascript.0 (951689) script.js.common.Speedtest: Speedtest: Datenpunkte erstellt! Erster Speedtest wird in 30 Sekunden ausgeführt!
                                            16:49:14.246	info	javascript.0 (951689) script.js.common.Speedtest: registered 1 subscription, 1 schedule, 0 messages, 0 logs and 0 file subscriptions
                                            16:49:44.245	info	javascript.0 (951689) script.js.common.Speedtest: Speedtest mit Server 37316 gestartet! Der Test dauert zwischen 10 - 20 Sekunden!
                                            16:49:44.457	error	javascript.0 (951689) script.js.common.Speedtest: SyntaxError: Unexpected end of JSON input
                                            16:49:44.459	error	javascript.0 (951689) at generiere_array (script.js.common.Speedtest:182:18)
                                            16:49:44.459	error	javascript.0 (951689) at script.js.common.Speedtest:231:28
                                            16:49:44.570	error	host.iobroker Caught by controller[0]: at generiere_array (script.js.common.Speedtest:205:18)
                                            16:49:44.570	error	host.iobroker Caught by controller[0]: at script.js.common.Speedtest:254:28
                                            
                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            1.0k
                                            Online

                                            31.7k
                                            Users

                                            79.7k
                                            Topics

                                            1.3m
                                            Posts

                                            33
                                            391
                                            51974
                                            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