Skip to content
  • Home
  • Aktuell
  • Tags
  • 0 Ungelesen 0
  • Kategorien
  • Unreplied
  • Beliebt
  • GitHub
  • Docu
  • Hilfe
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Standard: (Kein Skin)
  • Kein Skin
Einklappen
ioBroker Logo

Community Forum

donate donate
  1. ioBroker Community Home
  2. Deutsch
  3. Skripten / Logik
  4. JavaScript
  5. Hilfe bei Skripte von request auf httpGet umbauen

NEWS

  • UPDATE 31.10.: Amazon Alexa - ioBroker Skill läuft aus ?
    apollon77A
    apollon77
    48
    3
    8.9k

  • Monatsrückblick – September 2025
    BluefoxB
    Bluefox
    13
    1
    2.3k

  • Neues Video "KI im Smart Home" - ioBroker plus n8n
    BluefoxB
    Bluefox
    16
    1
    3.5k

Hilfe bei Skripte von request auf httpGet umbauen

Geplant Angeheftet Gesperrt Verschoben JavaScript
132 Beiträge 16 Kommentatoren 17.0k Aufrufe 12 Watching
  • Älteste zuerst
  • Neuste zuerst
  • Meiste Stimmen
Antworten
  • In einem neuen Thema antworten
Anmelden zum Antworten
Dieses Thema wurde gelöscht. Nur Nutzer mit entsprechenden Rechten können es sehen.
  • NegaleinN Negalein

    @liv-in-sky sagte in Hilfe bei Skripte von request auf httpGet umbauen:

    die datei curl-format.txt hast du ins verzeichnis kopiert ?

    yes

    45c40654-48f6-477c-b7ba-190bc4f2b5fd-image.png

    liv-in-skyL Offline
    liv-in-skyL Offline
    liv-in-sky
    schrieb am zuletzt editiert von liv-in-sky
    #79

    @negalein

    kopiere das in die datei

    #!/bin/bash
    dauer=`curl -w "@curl-format.txt" -s 'http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365' | grep time_total -m 1 | awk '{print $2}' | sed -e 's/s//'`
    iobroker state set 0_userdata.0.Tests.htttpget-test $dauer 
    sleep 15 
    tempi=`curl -w "@curl-format.txt" -s 'http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365' | grep time_total -m 1 | awk '{print $2}' | sed -e 's/s//'` 
    iobroker state set 0_userdata.0.Tests.htttpget-test $tempi
    sleep 15
    tempi=`curl -w "@curl-format.txt" -s 'http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365' | grep time_total -m 1 | awk '{print $2}' | sed -e 's/s//'` 
    iobroker state set 0_userdata.0.Tests.htttpget-test $tempi
    sleep 15
    tempi=`curl -w "@curl-format.txt" -s 'http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365' | grep time_total -m 1 | awk '{print $2}' | sed -e 's/s//'`
    iobroker state set 0_userdata.0.Tests.htttpget-test $tempi
    

    es dürfen keine zeilenumbrüche in den befehlen drin sein

    nach einem gelösten Thread wäre es sinnvoll dies in der Überschrift des ersten Posts einzutragen [gelöst]-... Bitte benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat. Forum-Tools: PicPick https://picpick.app/en/download/ und ScreenToGif https://www.screentogif.com/downloads.html

    NegaleinN 1 Antwort Letzte Antwort
    0
    • liv-in-skyL liv-in-sky

      @negalein

      in der ersten zeile dauer=......

      ist da ein zeilenumbruch vor | awk '{print $2}' | sed -e 's/s/ - das muss in einer zeile stehen

      NegaleinN Offline
      NegaleinN Offline
      Negalein
      Global Moderator
      schrieb am zuletzt editiert von
      #80

      @liv-in-sky sagte in Hilfe bei Skripte von request auf httpGet umbauen:

      ist da ein zeilenumbruch vor | awk '{print $2}' | sed -e 's/s/ - das muss in einer zeile stehen

      stimmt, da hats einen Zeilenumbruch reingehaun.

      Aber auch ohne kommt nur:

      pi@raspberrypi:/usr/local/bin $ httptest
      Warning: Failed to read curl-format.txtWarning: Failed to read curl-format.txtcurl: no URL specified!
      curl: try 'curl --help' or 'curl --manual' for more information
      /usr/local/bin/httptest: Zeile 5: http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365: Datei oder Verzeichnis nicht gefunden
      /usr/local/bin/httptest: Zeile 4: iobroker: Kommando nicht gefunden.
      Warning: Failed to read curl-format.txtcurl: no URL specified!
      curl: try 'curl --help' or 'curl --manual' for more information
      /usr/local/bin/httptest: Zeile 7: http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365: Datei oder Verzeichnis nicht gefunden
      /usr/local/bin/httptest: Zeile 6: iobroker: Kommando nicht gefunden.
      Warning: Failed to read curl-format.txtcurl: no URL specified!
      curl: try 'curl --help' or 'curl --manual' for more information
      /usr/local/bin/httptest: Zeile 9: http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365: Datei oder Verzeichnis nicht gefunden
      /usr/local/bin/httptest: Zeile 8: iobroker: Kommando nicht gefunden.
      /usr/local/bin/httptest: Zeile 10: iobroker: Kommando nicht gefunden.
      
      

      ° Node.js: 20.17.0 NPM: 10.8.2
      ° Proxmox, Ubuntu 22.04.3 LTS
      ° Fixer ---> iob fix

      liv-in-skyL 1 Antwort Letzte Antwort
      0
      • NegaleinN Negalein

        @liv-in-sky sagte in Hilfe bei Skripte von request auf httpGet umbauen:

        ist da ein zeilenumbruch vor | awk '{print $2}' | sed -e 's/s/ - das muss in einer zeile stehen

        stimmt, da hats einen Zeilenumbruch reingehaun.

        Aber auch ohne kommt nur:

        pi@raspberrypi:/usr/local/bin $ httptest
        Warning: Failed to read curl-format.txtWarning: Failed to read curl-format.txtcurl: no URL specified!
        curl: try 'curl --help' or 'curl --manual' for more information
        /usr/local/bin/httptest: Zeile 5: http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365: Datei oder Verzeichnis nicht gefunden
        /usr/local/bin/httptest: Zeile 4: iobroker: Kommando nicht gefunden.
        Warning: Failed to read curl-format.txtcurl: no URL specified!
        curl: try 'curl --help' or 'curl --manual' for more information
        /usr/local/bin/httptest: Zeile 7: http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365: Datei oder Verzeichnis nicht gefunden
        /usr/local/bin/httptest: Zeile 6: iobroker: Kommando nicht gefunden.
        Warning: Failed to read curl-format.txtcurl: no URL specified!
        curl: try 'curl --help' or 'curl --manual' for more information
        /usr/local/bin/httptest: Zeile 9: http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365: Datei oder Verzeichnis nicht gefunden
        /usr/local/bin/httptest: Zeile 8: iobroker: Kommando nicht gefunden.
        /usr/local/bin/httptest: Zeile 10: iobroker: Kommando nicht gefunden.
        
        
        liv-in-skyL Offline
        liv-in-skyL Offline
        liv-in-sky
        schrieb am zuletzt editiert von
        #81

        @negalein

        funktioniert der befehl in der console allein

        curl -w "@curl-format.txt" -s 'http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365' | grep time_total -m 1 | awk '{print $2}' | sed -e 's/s//'
        

        nach einem gelösten Thread wäre es sinnvoll dies in der Überschrift des ersten Posts einzutragen [gelöst]-... Bitte benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat. Forum-Tools: PicPick https://picpick.app/en/download/ und ScreenToGif https://www.screentogif.com/downloads.html

        NegaleinN 1 Antwort Letzte Antwort
        0
        • liv-in-skyL liv-in-sky

          @negalein

          kopiere das in die datei

          #!/bin/bash
          dauer=`curl -w "@curl-format.txt" -s 'http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365' | grep time_total -m 1 | awk '{print $2}' | sed -e 's/s//'`
          iobroker state set 0_userdata.0.Tests.htttpget-test $dauer 
          sleep 15 
          tempi=`curl -w "@curl-format.txt" -s 'http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365' | grep time_total -m 1 | awk '{print $2}' | sed -e 's/s//'` 
          iobroker state set 0_userdata.0.Tests.htttpget-test $tempi
          sleep 15
          tempi=`curl -w "@curl-format.txt" -s 'http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365' | grep time_total -m 1 | awk '{print $2}' | sed -e 's/s//'` 
          iobroker state set 0_userdata.0.Tests.htttpget-test $tempi
          sleep 15
          tempi=`curl -w "@curl-format.txt" -s 'http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365' | grep time_total -m 1 | awk '{print $2}' | sed -e 's/s//'`
          iobroker state set 0_userdata.0.Tests.htttpget-test $tempi
          

          es dürfen keine zeilenumbrüche in den befehlen drin sein

          NegaleinN Offline
          NegaleinN Offline
          Negalein
          Global Moderator
          schrieb am zuletzt editiert von
          #82

          @liv-in-sky sagte in Hilfe bei Skripte von request auf httpGet umbauen:

          kopiere das in die datei

          pi@raspberrypi:/usr/local/bin $ httptest
          Warning: Failed to read curl-format.txtWarning: Failed to read curl-format.txtcurl: no URL specified!
          curl: try 'curl --help' or 'curl --manual' for more information
          /usr/local/bin/httptest: Zeile 5: http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365: Datei oder Verzeichnis nicht gefunden
          /usr/local/bin/httptest: Zeile 4: iobroker: Kommando nicht gefunden.
          Warning: Failed to read curl-format.txtcurl: no URL specified!
          curl: try 'curl --help' or 'curl --manual' for more information
          /usr/local/bin/httptest: Zeile 7: http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365: Datei oder Verzeichnis nicht gefunden
          /usr/local/bin/httptest: Zeile 6: iobroker: Kommando nicht gefunden.
          Warning: Failed to read curl-format.txtcurl: no URL specified!
          curl: try 'curl --help' or 'curl --manual' for more information
          /usr/local/bin/httptest: Zeile 9: http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365: Datei oder Verzeichnis nicht gefunden
          /usr/local/bin/httptest: Zeile 8: iobroker: Kommando nicht gefunden.
          /usr/local/bin/httptest: Zeile 10: iobroker: Kommando nicht gefunden.
          pi@raspberrypi:/usr/local/bin $ sudo nano httptest
          pi@raspberrypi:/usr/local/bin $ httptest
          Warning: Failed to read curl-format.txt/usr/local/bin/httptest: Zeile 3: iobroker: Kommando nicht gefunden.
          Warning: Failed to read curl-format.txt/usr/local/bin/httptest: Zeile 6: iobroker: Kommando nicht gefunden.
          Warning: Failed to read curl-format.txt/usr/local/bin/httptest: Zeile 9: iobroker: Kommando nicht gefunden.
          Warning: Failed to read curl-format.txt/usr/local/bin/httptest: Zeile 12: iobroker: Kommando nicht gefunden.
          pi@raspberrypi:/usr/local/bin $
          

          ° Node.js: 20.17.0 NPM: 10.8.2
          ° Proxmox, Ubuntu 22.04.3 LTS
          ° Fixer ---> iob fix

          1 Antwort Letzte Antwort
          0
          • liv-in-skyL liv-in-sky

            @negalein

            funktioniert der befehl in der console allein

            curl -w "@curl-format.txt" -s 'http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365' | grep time_total -m 1 | awk '{print $2}' | sed -e 's/s//'
            
            NegaleinN Offline
            NegaleinN Offline
            Negalein
            Global Moderator
            schrieb am zuletzt editiert von
            #83

            @liv-in-sky sagte in Hilfe bei Skripte von request auf httpGet umbauen:

            funktioniert der befehl in der console allein

            leider nein

            pi@raspberrypi:/usr/local/bin $ curl -w "@curl-format.txt" -s 'http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365' | grep time_total -m 1 | awk '{print $2}' | sed -e 's/s//'
            Warning: Failed to read curl-format.txtpi@raspberrypi:/usr/local/bin $
            

            ° Node.js: 20.17.0 NPM: 10.8.2
            ° Proxmox, Ubuntu 22.04.3 LTS
            ° Fixer ---> iob fix

            liv-in-skyL 2 Antworten Letzte Antwort
            0
            • NegaleinN Negalein

              @liv-in-sky sagte in Hilfe bei Skripte von request auf httpGet umbauen:

              funktioniert der befehl in der console allein

              leider nein

              pi@raspberrypi:/usr/local/bin $ curl -w "@curl-format.txt" -s 'http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365' | grep time_total -m 1 | awk '{print $2}' | sed -e 's/s//'
              Warning: Failed to read curl-format.txtpi@raspberrypi:/usr/local/bin $
              
              liv-in-skyL Offline
              liv-in-skyL Offline
              liv-in-sky
              schrieb am zuletzt editiert von
              #84

              @negalein zeig mal ls -la im verzeichnis -

              nach einem gelösten Thread wäre es sinnvoll dies in der Überschrift des ersten Posts einzutragen [gelöst]-... Bitte benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat. Forum-Tools: PicPick https://picpick.app/en/download/ und ScreenToGif https://www.screentogif.com/downloads.html

              NegaleinN 1 Antwort Letzte Antwort
              0
              • liv-in-skyL liv-in-sky

                @negalein zeig mal ls -la im verzeichnis -

                NegaleinN Offline
                NegaleinN Offline
                Negalein
                Global Moderator
                schrieb am zuletzt editiert von
                #85

                @liv-in-sky sagte in Hilfe bei Skripte von request auf httpGet umbauen:

                ls -la

                pi@raspberrypi:/usr/local/bin $ ls -la
                insgesamt 11072
                drwxrwsr-x  2 root staff    4096 Mai 28 09:21 .
                drwxrwsr-x 11 root staff    4096 Jul  7  2019 ..
                -rwxr-xr-x  1 pi   pi    1909682 Apr  9  2019 composer
                -rw-r--r--  1 root staff       0 Mai 27 22:58 curl-format.txt
                -rwxr-xr-x  1 root staff    1232 Mai 28 09:21 httptest
                -rwxr-xr-x  1 root staff   23084 Apr  9  2019 mbus-serial-request-data
                -rwxr-xr-x  1 root staff   21632 Apr  9  2019 mbus-serial-request-data-multi-reply
                -rwxr-xr-x  1 root staff   23428 Apr  9  2019 mbus-serial-scan
                -rwxr-xr-x  1 root staff   21840 Apr  9  2019 mbus-serial-scan-secondary
                -rwxr-xr-x  1 root staff   20132 Apr  9  2019 mbus-serial-select-secondary
                -rwxr-xr-x  1 root staff   22400 Apr  9  2019 mbus-serial-set-address
                -rwxr-xr-x  1 root staff   15448 Apr  9  2019 mbus-serial-switch-baudrate
                -rwxr-xr-x  1 root staff   21256 Apr  9  2019 mbus-tcp-application-reset
                -rwxr-xr-x  1 root staff   23460 Apr  9  2019 mbus-tcp-raw-send
                -rwxr-xr-x  1 root staff   22248 Apr  9  2019 mbus-tcp-request-data
                -rwxr-xr-x  1 root staff   21420 Apr  9  2019 mbus-tcp-request-data-multi-reply
                -rwxr-xr-x  1 root staff   22272 Apr  9  2019 mbus-tcp-scan
                -rwxr-xr-x  1 root staff   14864 Apr  9  2019 mbus-tcp-scan-secondary
                -rwxr-xr-x  1 root staff   15676 Apr  9  2019 mbus-tcp-select-secondary
                -rwxr-xr-x  1 root staff 9094204 Jul  7  2019 vzlogger
                pi@raspberrypi:/usr/local/bin $
                

                ° Node.js: 20.17.0 NPM: 10.8.2
                ° Proxmox, Ubuntu 22.04.3 LTS
                ° Fixer ---> iob fix

                liv-in-skyL 1 Antwort Letzte Antwort
                0
                • NegaleinN Negalein

                  @liv-in-sky sagte in Hilfe bei Skripte von request auf httpGet umbauen:

                  funktioniert der befehl in der console allein

                  leider nein

                  pi@raspberrypi:/usr/local/bin $ curl -w "@curl-format.txt" -s 'http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365' | grep time_total -m 1 | awk '{print $2}' | sed -e 's/s//'
                  Warning: Failed to read curl-format.txtpi@raspberrypi:/usr/local/bin $
                  
                  liv-in-skyL Offline
                  liv-in-skyL Offline
                  liv-in-sky
                  schrieb am zuletzt editiert von
                  #86

                  @negalein
                  evtl ein rechte thema

                  im verzeichnis sudo chmod 777 curl-format.txt

                  nach einem gelösten Thread wäre es sinnvoll dies in der Überschrift des ersten Posts einzutragen [gelöst]-... Bitte benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat. Forum-Tools: PicPick https://picpick.app/en/download/ und ScreenToGif https://www.screentogif.com/downloads.html

                  1 Antwort Letzte Antwort
                  0
                  • NegaleinN Negalein

                    @liv-in-sky sagte in Hilfe bei Skripte von request auf httpGet umbauen:

                    ls -la

                    pi@raspberrypi:/usr/local/bin $ ls -la
                    insgesamt 11072
                    drwxrwsr-x  2 root staff    4096 Mai 28 09:21 .
                    drwxrwsr-x 11 root staff    4096 Jul  7  2019 ..
                    -rwxr-xr-x  1 pi   pi    1909682 Apr  9  2019 composer
                    -rw-r--r--  1 root staff       0 Mai 27 22:58 curl-format.txt
                    -rwxr-xr-x  1 root staff    1232 Mai 28 09:21 httptest
                    -rwxr-xr-x  1 root staff   23084 Apr  9  2019 mbus-serial-request-data
                    -rwxr-xr-x  1 root staff   21632 Apr  9  2019 mbus-serial-request-data-multi-reply
                    -rwxr-xr-x  1 root staff   23428 Apr  9  2019 mbus-serial-scan
                    -rwxr-xr-x  1 root staff   21840 Apr  9  2019 mbus-serial-scan-secondary
                    -rwxr-xr-x  1 root staff   20132 Apr  9  2019 mbus-serial-select-secondary
                    -rwxr-xr-x  1 root staff   22400 Apr  9  2019 mbus-serial-set-address
                    -rwxr-xr-x  1 root staff   15448 Apr  9  2019 mbus-serial-switch-baudrate
                    -rwxr-xr-x  1 root staff   21256 Apr  9  2019 mbus-tcp-application-reset
                    -rwxr-xr-x  1 root staff   23460 Apr  9  2019 mbus-tcp-raw-send
                    -rwxr-xr-x  1 root staff   22248 Apr  9  2019 mbus-tcp-request-data
                    -rwxr-xr-x  1 root staff   21420 Apr  9  2019 mbus-tcp-request-data-multi-reply
                    -rwxr-xr-x  1 root staff   22272 Apr  9  2019 mbus-tcp-scan
                    -rwxr-xr-x  1 root staff   14864 Apr  9  2019 mbus-tcp-scan-secondary
                    -rwxr-xr-x  1 root staff   15676 Apr  9  2019 mbus-tcp-select-secondary
                    -rwxr-xr-x  1 root staff 9094204 Jul  7  2019 vzlogger
                    pi@raspberrypi:/usr/local/bin $
                    
                    liv-in-skyL Offline
                    liv-in-skyL Offline
                    liv-in-sky
                    schrieb am zuletzt editiert von
                    #87

                    @negalein

                    dann nochmal

                    curl -w "@curl-format.txt" -s 'http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365' | grep time_total -m 1 | awk '{print $2}' | sed -e 's/s//'
                    

                    nach einem gelösten Thread wäre es sinnvoll dies in der Überschrift des ersten Posts einzutragen [gelöst]-... Bitte benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat. Forum-Tools: PicPick https://picpick.app/en/download/ und ScreenToGif https://www.screentogif.com/downloads.html

                    NegaleinN 1 Antwort Letzte Antwort
                    0
                    • liv-in-skyL liv-in-sky

                      @negalein

                      dann nochmal

                      curl -w "@curl-format.txt" -s 'http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365' | grep time_total -m 1 | awk '{print $2}' | sed -e 's/s//'
                      
                      NegaleinN Offline
                      NegaleinN Offline
                      Negalein
                      Global Moderator
                      schrieb am zuletzt editiert von
                      #88

                      @liv-in-sky sagte in Hilfe bei Skripte von request auf httpGet umbauen:

                      dann nochmal

                      pi@raspberrypi:/usr/local/bin $ curl -w "@curl-format.txt" -s 'http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365' | grep time_total -m 1 | awk '{print $2}' | sed -e 's/s//'
                      Warning: Failed to read curl-format.txtpi@raspberrypi:/usr/local/bin $
                      

                      ° Node.js: 20.17.0 NPM: 10.8.2
                      ° Proxmox, Ubuntu 22.04.3 LTS
                      ° Fixer ---> iob fix

                      liv-in-skyL 1 Antwort Letzte Antwort
                      0
                      • NegaleinN Negalein

                        @liv-in-sky sagte in Hilfe bei Skripte von request auf httpGet umbauen:

                        dann nochmal

                        pi@raspberrypi:/usr/local/bin $ curl -w "@curl-format.txt" -s 'http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365' | grep time_total -m 1 | awk '{print $2}' | sed -e 's/s//'
                        Warning: Failed to read curl-format.txtpi@raspberrypi:/usr/local/bin $
                        
                        liv-in-skyL Offline
                        liv-in-skyL Offline
                        liv-in-sky
                        schrieb am zuletzt editiert von
                        #89

                        @negalein aaarghh

                        mach mal sudo httptest

                        nach einem gelösten Thread wäre es sinnvoll dies in der Überschrift des ersten Posts einzutragen [gelöst]-... Bitte benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat. Forum-Tools: PicPick https://picpick.app/en/download/ und ScreenToGif https://www.screentogif.com/downloads.html

                        NegaleinN 1 Antwort Letzte Antwort
                        0
                        • liv-in-skyL liv-in-sky

                          @negalein aaarghh

                          mach mal sudo httptest

                          NegaleinN Offline
                          NegaleinN Offline
                          Negalein
                          Global Moderator
                          schrieb am zuletzt editiert von
                          #90

                          @liv-in-sky sagte in Hilfe bei Skripte von request auf httpGet umbauen:

                          mach mal sudo httptest

                          das ist eine Zicke

                          pi@raspberrypi:/usr/local/bin $ sudo httptest
                          Warning: Failed to read curl-format.txt/usr/local/bin/httptest: Zeile 3: iobroker: Kommando nicht gefunden.
                          Warning: Failed to read curl-format.txt/usr/local/bin/httptest: Zeile 6: iobroker: Kommando nicht gefunden.
                          Warning: Failed to read curl-format.txt/usr/local/bin/httptest: Zeile 9: iobroker: Kommando nicht gefunden.
                          Warning: Failed to read curl-format.txt/usr/local/bin/httptest: Zeile 12: iobroker: Kommando nicht gefunden.
                          pi@raspberrypi:/usr/local/bin $
                          

                          ° Node.js: 20.17.0 NPM: 10.8.2
                          ° Proxmox, Ubuntu 22.04.3 LTS
                          ° Fixer ---> iob fix

                          liv-in-skyL 1 Antwort Letzte Antwort
                          0
                          • NegaleinN Negalein

                            @liv-in-sky sagte in Hilfe bei Skripte von request auf httpGet umbauen:

                            mach mal sudo httptest

                            das ist eine Zicke

                            pi@raspberrypi:/usr/local/bin $ sudo httptest
                            Warning: Failed to read curl-format.txt/usr/local/bin/httptest: Zeile 3: iobroker: Kommando nicht gefunden.
                            Warning: Failed to read curl-format.txt/usr/local/bin/httptest: Zeile 6: iobroker: Kommando nicht gefunden.
                            Warning: Failed to read curl-format.txt/usr/local/bin/httptest: Zeile 9: iobroker: Kommando nicht gefunden.
                            Warning: Failed to read curl-format.txt/usr/local/bin/httptest: Zeile 12: iobroker: Kommando nicht gefunden.
                            pi@raspberrypi:/usr/local/bin $
                            
                            liv-in-skyL Offline
                            liv-in-skyL Offline
                            liv-in-sky
                            schrieb am zuletzt editiert von
                            #91

                            @negalein

                            siehe chat

                            nach einem gelösten Thread wäre es sinnvoll dies in der Überschrift des ersten Posts einzutragen [gelöst]-... Bitte benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat. Forum-Tools: PicPick https://picpick.app/en/download/ und ScreenToGif https://www.screentogif.com/downloads.html

                            OliverIOO 1 Antwort Letzte Antwort
                            0
                            • liv-in-skyL liv-in-sky

                              @oliverio

                              damit scheine ich erfolg zu haben - wie gefällt dir diese lösung

                              //ab hier nix verändern
                              const axios = require('axios');
                              const cheerio = require("cheerio");
                              const tough = require('tough-cookie');
                              const { wrapper } = require('axios-cookiejar-support');
                              
                              const cookieJar = new tough.CookieJar();
                              const client = wrapper(axios.create({
                                jar: cookieJar,
                                withCredentials: true,
                              }));
                               
                              let $;
                              async function main() {
                               
                              const optionsLogin = {
                                method: 'POST',
                                url: 'https://netservice.iqcard.at/de/login',
                                data: `BENUID=${user}&PASSWT=${pass}&login-form-submit=login`,
                                headers: {
                                  'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
                                  'Accept-Encoding': 'gzip, deflate, br',
                                  'Accept-Language': 'de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7',
                                  'Cache-Control': 'no-cache',
                                  'Content-Type': 'application/x-www-form-urlencoded',
                                  'DNT': '1',
                                  'Origin': 'https://netservice.iqcard.at',
                                  'Pragma': 'no-cache',
                                  'Sec-CH-UA': '"Not?A_Brand";v="8", "Chromium";v="108", "Google Chrome";v="108"',
                                  'Sec-CH-UA-Mobile': '?0',
                                  'Sec-CH-UA-Platform': '"Windows"',
                                  'Sec-Fetch-Dest': 'empty',
                                  'Sec-Fetch-Mode': 'cors',
                                  'Sec-Fetch-Site': 'same-origin',
                                  'Upgrade-Insecure-Requests': '1',
                                  'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36',
                                  'Cookie': 'cAccept=true; NETSERVICE=true; IQCARDPASSWT=; IQCARDBENUID= ',
                                  'Referer': 'https://netservice.iqcard.at/de/kunden'
                                },
                                maxRedirects: 5, // Anzahl der zu folgenden Redirects
                                withCredentials: true // für das Cookie-Handling
                              };
                              
                              const optionsPriceinfo = {
                                method: 'GET',
                                url: 'https://netservice.iqcard.at/de/netservice_preisinfo',
                                headers: {
                                  'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
                                  'Accept-Encoding': 'gzip, deflate, br',
                                  'Accept-Language': 'de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7',
                                  'Cache-Control': 'no-cache',
                                  'DNT': '1',
                                  'Origin': 'https://netservice.iqcard.at',
                                  'Pragma': 'no-cache',
                                  'Sec-CH-UA': '"Not?A_Brand";v="8", "Chromium";v="108", "Google Chrome";v="108"',
                                  'Sec-CH-UA-Mobile': '?0',
                                  'Sec-CH-UA-Platform': '"Windows"',
                                  'Sec-Fetch-Dest': 'empty',
                                  'Sec-Fetch-Mode': 'cors',
                                  'Sec-Fetch-Site': 'same-origin',
                                  'Sec-Fetch-User': '?1',
                                  'Upgrade-Insecure-Requests': '1',
                                  'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36',
                                  'Referer': 'https://netservice.iqcard.at/de/netservice'
                                },
                                maxRedirects: 5, // Anzahl der zu folgenden Redirects
                                withCredentials: true // für das Cookie-Handling
                              };
                              
                              // Anmeldung mit POST-Request
                              client(optionsLogin)
                                .then(() => {
                                  // Erfolgreiche Anmeldung, jetzt GET-Request für Preisinfo
                                  return client(optionsPriceinfo);
                                })
                                .then(response => {
                                  // Verarbeitung der Antwort
                                  const data = analyze(response.data);
                                  log(data);
                                  writeDatapoint(data);
                                })
                                .catch(error => {
                                  console.error('Error making the request:', error);
                                });
                              

                              output

                              {
                                 "ÖSTERREICH": {
                                 	"services": {
                                 		"Super Plus": [
                                 			{
                                 				"date": "27.05.2024-02.06.2024:",
                                 				"price": "1,721 EUR"
                                 			},
                                 			{
                                 				"date": "20.05.2024-26.05.2024:",
                                 				"price": "1,731 EUR"
                                 			},
                                 			{
                                 				"date": "13.05.2024-19.05.2024:",
                                 				"price": "1,737 EUR"
                                 			}
                                 		],
                                 		"Super": [
                                 			{
                                 				"date": "27.05.2024-02.06.2024:",
                                 				"price": "1,595 EUR"
                                 			},
                                 			{
                                 				"date": "20.05.2024-26.05.2024:",
                                 				"price": "1,611 EUR"
                                 			},
                                 			{
                                 				"date": "13.05.2024-19.05.2024:",
                                 				"price": "1,617 EUR"
                                 			}
                                 		],
                                 		"Normal": [
                                 			{
                                 				"date": "27.05.2024-02.06.2024:",
                                 				"price": "1,595 EUR"
                                 			},
                                 			{
                                 				"date": "20.05.2024-26.05.2024:",
                                 				"price": "1,611 EUR"
                                 			},
                                 			{
                                 				"date": "13.05.2024-19.05.2024:",
                                 				"price": "1,617 EUR"
                                 			}
                                 		],
                                 		"Diesel": [
                                 			{
                                 				"date": "27.05.2024-02.06.2024:",
                                 				"price": "1,559 EUR"
                                 			},
                                 			{
                                 				"date": "20.05.2024-26.05.2024:",
                                 				"price": "1,571 EUR"
                                 			},
                                 			{
                                 				"date": "13.05.2024-19.05.2024:",
                                 				"price": "1,571 EUR"
                                 			}
                                 		],
                                 		"Premium Diesel": [
                                 			{
                                 				"date": "27.05.2024-02.06.2024:",
                                 				"price": "1,781 EUR"
                                 			},
                                 			{
                                 				"date": "20.05.2024-26.05.2024:",
                                 				"price": "1,781 EUR"
                                 			},
                                 			{
                                 				"date": "13.05.2024-19.05.2024:",
                                 				"price": "1,787 EUR"
                                 			}
                                 		],
                                 		"IQ Motoröle und Chemie": "10 % Rabatt",
                                 		"Autowäsche": "10 % Rabatt"
                                 	},
                                 	"info": "",
                                 	"countryname": "ÖSTERREICH"
                                 },
                                 "BOSNIEN UND HERZEGOWINA": {
                                 	"services": {},
                                 	"info": "Sie tanken zum aktuellen Pumpenabgabepreis",
                                 	"countryname": "BOSNIEN UND HERZEGOWINA"
                                 },
                                 "BELGIEN": {
                                 	"services": {},
                                 	"info": "Sie tanken zum aktuellen Pumpenabgabepreis",
                                 	"countryname": "BELGIEN"
                                 },
                                 "BULGARIEN": {
                                 	"services": {},
                                 	"info": "Sie tanken zum aktuellen Pumpenabgabepreis",
                                 	"countryname": "BULGARIEN"
                                 },
                                 "TSCHECHIEN": {
                                 	"services": {
                                 		"Diesel": [
                                 			{
                                 				"date": "27.05.2024-02.06.2024:",
                                 				"price": "34,122 CZK"
                                 			},
                                 			{
                                 				"date": "20.05.2024-26.05.2024:",
                                 				"price": "34,122 CZK"
                                 			},
                                 			{
                                 				"date": "13.05.2024-19.05.2024:",
                                 				"price": "34,606 CZK"
                                 			}
                                 		]
                                 	},
                                 	"info": "",
                                 	"countryname": "TSCHECHIEN"
                                 },
                                 "DEUTSCHLAND": {
                                 	"services": {},
                                 	"info": "Sie tanken zum aktuellen Pumpenabgabepreis",
                                 	"countryname": "DEUTSCHLAND"
                                 },
                                 "DÄNEMARK": {
                                 	"services": {},
                                 	"info": "Sie tanken zum aktuellen Pumpenabgabepreis",
                                 	"countryname": "DÄNEMARK"
                                 },
                                 "SPANIEN": {
                                 	"services": {},
                                 	"info": "Sie tanken zum aktuellen Pumpenabgabepreis",
                                 	"countryname": "SPANIEN"
                                 },
                                 "FRANKREICH": {
                                 	"services": {},
                                 	"info": "Sie tanken zum aktuellen Pumpenabgabepreis",
                                 	"countryname": "FRANKREICH"
                                 },
                                 "GROßBRITANNIEN": {
                                 	"services": {},
                                 	"info": "Sie tanken zum aktuellen Pumpenabgabepreis",
                                 	"countryname": "GROßBRITANNIEN"
                                 },
                                 "UNGARN": {
                                 	"services": {},
                                 	"info": "Sie tanken zum aktuellen Pumpenabgabepreis",
                                 	"countryname": "UNGARN"
                                 },
                                 "ITALIEN": {
                                 	"services": {},
                                 	"info": "Sie tanken zum aktuellen Pumpenabgabepreis",
                                 	"countryname": "ITALIEN"
                                 },
                                 "LITAUEN": {
                                 	"services": {},
                                 	"info": "Sie tanken zum aktuellen Pumpenabgabepreis",
                                 	"countryname": "LITAUEN"
                                 },
                                 "LUXEMBURG": {
                                 	"services": {},
                                 	"info": "Sie tanken zum aktuellen Pumpenabgabepreis",
                                 	"countryname": "LUXEMBURG"
                                 },
                                 "NIEDERLANDE": {
                                 	"services": {},
                                 	"info": "Sie tanken zum aktuellen Pumpenabgabepreis",
                                 	"countryname": "NIEDERLANDE"
                                 },
                                 "NORWEGEN": {
                                 	"services": {},
                                 	"info": "Sie tanken zum aktuellen Pumpenabgabepreis",
                                 	"countryname": "NORWEGEN"
                                 },
                                 "POLEN": {
                                 	"services": {},
                                 	"info": "Sie tanken zum aktuellen Pumpenabgabepreis",
                                 	"countryname": "POLEN"
                                 },
                                 "RUMÄNIEN": {
                                 	"services": {},
                                 	"info": "Sie tanken zum aktuellen Pumpenabgabepreis",
                                 	"countryname": "RUMÄNIEN"
                                 },
                                 "SCHWEDEN": {
                                 	"services": {},
                                 	"info": "Sie tanken zum aktuellen Pumpenabgabepreis",
                                 	"countryname": "SCHWEDEN"
                                 },
                                 "SLOWENIEN": {
                                 	"services": {},
                                 	"info": "Sie tanken zum aktuellen Pumpenabgabepreis",
                                 	"countryname": "SLOWENIEN"
                                 }
                              }
                              

                              OliverIOO Offline
                              OliverIOO Offline
                              OliverIO
                              schrieb am zuletzt editiert von
                              #92

                              @liv-in-sky

                              sehr gut. das wäre die bibliothek gewesen, die ich auch verwendet hätte.
                              bei den headers könnte man ein paar noch entfernen, aber die stören so ja nicht.

                              Meine Adapter und Widgets
                              TVProgram, SqueezeboxRPC, OpenLiga, RSSFeed, MyTime,, pi-hole2, vis-json-template, skiinfo, vis-mapwidgets, vis-2-widgets-rssfeed
                              Links im Profil

                              1 Antwort Letzte Antwort
                              0
                              • liv-in-skyL liv-in-sky

                                @negalein

                                siehe chat

                                OliverIOO Offline
                                OliverIOO Offline
                                OliverIO
                                schrieb am zuletzt editiert von
                                #93

                                @liv-in-sky

                                warum probiert ihr jetzt noch mit einer curlversion?

                                Meine Adapter und Widgets
                                TVProgram, SqueezeboxRPC, OpenLiga, RSSFeed, MyTime,, pi-hole2, vis-json-template, skiinfo, vis-mapwidgets, vis-2-widgets-rssfeed
                                Links im Profil

                                liv-in-skyL 1 Antwort Letzte Antwort
                                0
                                • NegaleinN Offline
                                  NegaleinN Offline
                                  Negalein
                                  Global Moderator
                                  schrieb am zuletzt editiert von
                                  #94

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

                                  warum probiert ihr jetzt noch mit einer curlversion?

                                  der curl ist ein Test für ein anderes Script, dass alle 10 Minuten einen Timeout hat.

                                  ° Node.js: 20.17.0 NPM: 10.8.2
                                  ° Proxmox, Ubuntu 22.04.3 LTS
                                  ° Fixer ---> iob fix

                                  liv-in-skyL 1 Antwort Letzte Antwort
                                  0
                                  • OliverIOO OliverIO

                                    @liv-in-sky

                                    warum probiert ihr jetzt noch mit einer curlversion?

                                    liv-in-skyL Offline
                                    liv-in-skyL Offline
                                    liv-in-sky
                                    schrieb am zuletzt editiert von
                                    #95

                                    @oliverio

                                    wir haben noch ein andres thema.

                                    wir machen mit dem curtl rum, damit wir die zugriffszeiten mal checken können. das script hatte wohl mit "request" keine probleme, mit hhtpget schon

                                    ich hwollte dieses script nunmal mit axios testen, habe aber das problem, dass ich unterschiedliche antworten-daten bekomme

                                    vorher:

                                    var request = require("request");
                                    function readJson(url, callback) {
                                        request(url, function(err, state, body) {
                                            if (body) {
                                                var json = {};
                                                if (body !== "") {
                                                    try {
                                                        json = JSON.parse(body);
                                                    } catch (ex) {
                                                        json = {};
                                                    }
                                                    if (!json) {
                                                        json = {};
                                                    }
                                                }
                                                callback(null, json);
                                            } else {
                                                var error = "(" + err + ") ERROR bei Abfrage von: " + url;
                                                log(error, "warn");
                                                callback(error, null);
                                            }
                                        });
                                    }
                                    

                                    mit axios:

                                    async function readJson(url, callback) {log("readjson")
                                        await  axios.get(url,{headers:{"Content-Type": "application/json"}}).then(response => {
                                            const contentType = response.headers["application/json"];
                                            const body=response.data;
                                            log(response)
                                            log(response.data);
                                            log(JSON.stringify(response.data));
                                            log(JSON.stringify(response));
                                             log( response.data.join('\n') );
                                            if (!response.err) {
                                                var json = {};
                                                if (body !== "") {
                                                    try {
                                                        json = JSON.parse(body);
                                                    } catch (ex) {
                                                        json = {};
                                                    }
                                                    if (!json) {
                                                        json = {};
                                                    }
                                                }
                                                callback(null, json);
                                            } else {
                                                var error = "(" + Error + ") ERROR bei Abfrage von: " + url;
                                                log(error, "warn");
                                                callback(error, null);
                                            }
                                        });
                                    }
                                    

                                    da sind die antwort.data unterschedlich - hast du da eine idee dazu

                                    nach einem gelösten Thread wäre es sinnvoll dies in der Überschrift des ersten Posts einzutragen [gelöst]-... Bitte benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat. Forum-Tools: PicPick https://picpick.app/en/download/ und ScreenToGif https://www.screentogif.com/downloads.html

                                    1 Antwort Letzte Antwort
                                    0
                                    • NegaleinN Negalein

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

                                      warum probiert ihr jetzt noch mit einer curlversion?

                                      der curl ist ein Test für ein anderes Script, dass alle 10 Minuten einen Timeout hat.

                                      liv-in-skyL Offline
                                      liv-in-skyL Offline
                                      liv-in-sky
                                      schrieb am zuletzt editiert von
                                      #96

                                      @negalein

                                      lasse mal dieses script laufen und poste das log - @OliverIO kann dann den output sehen - wegen dem unterschied

                                      
                                      var url = "http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365";
                                      //url = "http://ip.jsontest.com/?callback=showMyIP"
                                      //url="https://httpbin.org/get"
                                      //url="http://ip.jsontest.com/"
                                      var pfad = "Volkszaehler.";
                                      var idAKTUELLER_VERBRAUCH = pfad + "AKTUELLER_VERBRAUCH";
                                      var idAKTUELLE_ERZEUGUNG = pfad + "AKTUELLE_LIEFERUNG";
                                      // var idAKTUELLE_HEIZUNG = pfad + "AKTUELLE_HEIZUNG";
                                       
                                       const axios=require('axios');
                                      // Vorgegebene Funktion, die nur dazu dient, das JSON einzulesen
                                      // Angelehnt an: http://www.iobroker.net/docu/?page_id=3691
                                      //var request = require("request");
                                      
                                        axios.get(url,{headers:{"Content-Type": "json"}}).then(response => {
                                              const contentType = response.headers["json"];
                                              const body=response.data;
                                              log(response)
                                              log(response.data);
                                              log(JSON.stringify(response.data));
                                              
                                             //  log( response.data.join('\n') );
                                              
                                              }
                                          );
                                      
                                      
                                      var request = require("request");
                                       request(url, function(err, state, body) {
                                           log("---------------------------")
                                           log(body)    
                                          });
                                      

                                      nach einem gelösten Thread wäre es sinnvoll dies in der Überschrift des ersten Posts einzutragen [gelöst]-... Bitte benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat. Forum-Tools: PicPick https://picpick.app/en/download/ und ScreenToGif https://www.screentogif.com/downloads.html

                                      NegaleinN 1 Antwort Letzte Antwort
                                      0
                                      • liv-in-skyL liv-in-sky

                                        @negalein

                                        lasse mal dieses script laufen und poste das log - @OliverIO kann dann den output sehen - wegen dem unterschied

                                        
                                        var url = "http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365";
                                        //url = "http://ip.jsontest.com/?callback=showMyIP"
                                        //url="https://httpbin.org/get"
                                        //url="http://ip.jsontest.com/"
                                        var pfad = "Volkszaehler.";
                                        var idAKTUELLER_VERBRAUCH = pfad + "AKTUELLER_VERBRAUCH";
                                        var idAKTUELLE_ERZEUGUNG = pfad + "AKTUELLE_LIEFERUNG";
                                        // var idAKTUELLE_HEIZUNG = pfad + "AKTUELLE_HEIZUNG";
                                         
                                         const axios=require('axios');
                                        // Vorgegebene Funktion, die nur dazu dient, das JSON einzulesen
                                        // Angelehnt an: http://www.iobroker.net/docu/?page_id=3691
                                        //var request = require("request");
                                        
                                          axios.get(url,{headers:{"Content-Type": "json"}}).then(response => {
                                                const contentType = response.headers["json"];
                                                const body=response.data;
                                                log(response)
                                                log(response.data);
                                                log(JSON.stringify(response.data));
                                                
                                               //  log( response.data.join('\n') );
                                                
                                                }
                                            );
                                        
                                        
                                        var request = require("request");
                                         request(url, function(err, state, body) {
                                             log("---------------------------")
                                             log(body)    
                                            });
                                        
                                        NegaleinN Offline
                                        NegaleinN Offline
                                        Negalein
                                        Global Moderator
                                        schrieb am zuletzt editiert von
                                        #97

                                        @liv-in-sky sagte in Hilfe bei Skripte von request auf httpGet umbauen:

                                        lasse mal dieses script laufen und poste das log - @OliverIO kann dann den output sehen - wegen dem unterschied

                                        javascript.0	16:22:19.541	info	Start JavaScript script.js.common.VolkszaehlerNeuTest (Javascript/js)
                                        javascript.0	16:22:19.549	warn	script.js.common.VolkszaehlerNeuTest: request package is deprecated - please use httpGet (or a stable lib like axios) instead!
                                        javascript.0	16:22:19.551	info	script.js.common.VolkszaehlerNeuTest: registered 0 subscriptions, 0 schedules, 0 messages, 0 logs and 0 file subscriptions
                                        javascript.0	16:22:19.587	info	script.js.common.VolkszaehlerNeuTest: { status: 200, statusText: 'OK', headers: Object [AxiosHeaders] { server: 'nginx/1.14.2', date: 'Tue, 28 May 2024 14:22:19 GMT', 'content-type': 'application/json', 'content-length': '442', connection: 'keep-alive', 'cache-control': 'no-cache, private', 'access-control-allow-origin': '*', 'x-powered-by': 'React/alpha' }, config: { transitional: { silentJSONParsing: true, forcedJSONParsing: true, clarifyTimeoutError: false }, adapter: [ 'xhr', 'http', 'fetch' ], transformRequest: [ [Function: transformRequest] ], transformResponse: [ [Function: transformResponse] ], timeout: 0, xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, maxBodyLength: -1, env: { FormData: [Function], Blob: [class Blob] }, validateStatus: [Function: validateStatus], headers: Object [AxiosHeaders] { Accept: 'application/json, text/plain, */*', 'Content-Type': 'json', 'User-Agent': 'axios/1.7.2', 'Accept-Encoding': 'gzip, compress, deflate, br' }, method: 'get', url: 'http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365', data: undefined }, request: <ref *1> ClientRequest { _events: [Object: null prototype] { error: [Array], abort: [Function (anonymous)], aborted: [Function (anonymous)], connect: [Function (anonymous)], socket: [Function (anonymous)], timeout: [Function (anonymous)], finish: [Function: requestOnFinish] }, _eventsCount: 7, _maxListeners: 100, outputData: [], outputSize: 0, writable: true, destroyed: true, _last: true, chunkedEncoding: false, shouldKeepAlive: true, maxRequestsOnConnectionReached: false, _defaultKeepAlive: true, useChunkedEncodingByDefault: false, sendDate: false, _removedConnection: false, _removedContLen: false, _removedTE: false, strictContentLength: false, _contentLength: 0, _hasBody: true, _trailer: '', finished: true, _headerSent: true, _closed: true, socket: Socket { connecting: false, _hadError: false, _parent: null, _host: null, _closeAfterHandlingError: false, _events: [Object], _readableState: [ReadableState], _writableState: [WritableState], allowHalfOpen: false, _maxListeners: 100, _eventsCount: 6, _sockname: null, _pendingData: null, _pendingEncoding: '', server: null, _server: null, timeout: 5000, parser: null, _httpMessage: null, [Symbol(async_id_symbol)]: -1, [Symbol(kHandle)]: [TCP], [Symbol(lastWriteQueueSize)]: 0, [Symbol(timeout)]: Timeout { _idleTimeout: 5000, _idlePrev: [TimersList], _idleNext: [Timeout], _idleStart: 22210741, _onTimeout: [Function: bound ], _timerArgs: undefined, _repeat: null, _destroyed: false, [Symbol(refed)]: false, [Symbol(kHasPrimitive)]: false, [Symbol(asyncId)]: 12550793, [Symbol(triggerId)]: 12550791 }, [Symbol(kBuffer)]: null, [Symbol(kBufferCb)]: null, [Symbol(kBufferGen)]: null, [Symbol(shapeMode)]: true, [Symbol(kCapture)]: false, [Symbol(kSetNoDelay)]: true, [Symbol(kSetKeepAlive)]: true, [Symbol(kSetKeepAliveInitialDelay)]: 1, [Symbol(kBytesRead)]: 0, [Symbol(kBytesWritten)]: 0 }, _header: 'GET /middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365 HTTP/1.1\r\n' + 'Accept: application/json, text/plain, */*\r\n' + 'Content-Type: json\r\n' + 'User-Agent: axios/1.7.2\r\n' + 'Accept-Encoding: gzip, compress, deflate, br\r\n' + 'Host: 10.0.1.93\r\n' + 'Connection: keep-alive\r\n' + '\r\n', _keepAliveTimeout: 0, _onPendingData: [Function: nop], agent: Agent { _events: [Object: null prototype], _eventsCount: 2, _maxListeners: undefined, defaultPort: 80, protocol: 'http:', options: [Object: null prototype], requests: [Object: null prototype] {}, sockets: [Object: null prototype], freeSockets: [Object: null prototype], keepAliveMsecs: 1000, keepAlive: true, maxSockets: Infinity, maxFreeSockets: 256, scheduling: 'lifo', maxTotalSockets: Infinity, totalSocketCount: 2, [Symbol(shapeMode)]: false, [Symbol(kCapture)]: false }, socketPath: undefined, method: 'GET', maxHeaderSize: undefined, insecureHTTPParser: undefined, joinDuplicateHeaders: undefined, path: '/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365', _ended: true, res: IncomingMessage { _events: [Object], _readableState: [ReadableState], _maxListeners: 100, socket: null, httpVersionMajor: 1, httpVersionMinor: 1, httpVersion: '1.1', complete: true, rawHeaders: [Array], rawTrailers: [], joinDuplicateHeaders: undefined, aborted: false, upgrade: false, url: '', method: null, statusCode: 200, statusMessage: 'OK', client: [Socket], _consuming: false, _dumped: false, req: [Circular *1], _eventsCount: 4, responseUrl: 'http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365', redirects: [], [Symbol(shapeMode)]: true, [Symbol(kCapture)]: false, [Symbol(kHeaders)]: [Object], [Symbol(kHeadersCount)]: 16, [Symbol(kTrailers)]: null, [Symbol(kTrailersCount)]: 0 }, aborted: false, timeoutCb: null, upgradeOrConnect: false, parser: null, maxHeadersCount: null, reusedSocket: false, host: '10.0.1.93', protocol: 'http:', _redirectable: Writable { _events: [Object], _writableState: [WritableState], _maxListeners: 100, _options: [Object], _ended: true, _ending: true, _redirectCount: 0, _redirects: [], _requestBodyLength: 0, _requestBodyBuffers: [], _eventsCount: 3, _onNativeResponse: [Function (anonymous)], _currentRequest: [Circular *1], _currentUrl: 'http://10.0.1.93/middleware.php/data.json?from=now&uuid[]=bc3edcd0-24c4-11ea-b257-bdbd9553c516&uuid[]=deda8550-24c4-11ea-b402-275ee0956365', [Symbol(shapeMode)]: true, [Symbol(kCapture)]: false }, [Symbol(shapeMode)]: false, [Symbol(kCapture)]: false, [Symbol(kBytesWritten)]: 0, [Symbol(kNeedDrain)]: false, [Symbol(corked)]: 0, [Symbol(kOutHeaders)]: [Object: null prototype] { accept: [Array], 'content-type': [Array], 'user-agent': [Array], 'accept-encoding': [Array], host: [Array] }, [Symbol(errored)]: null, [Symbol(kHighWaterMark)]: 16384, [Symbol(kRejectNonStandardBodyWrites)]: false, [Symbol(kUniqueHeaders)]: null }, data: { version: '0.3', data: [ [Object], [Object] ] } }
                                        javascript.0	16:22:19.588	info	script.js.common.VolkszaehlerNeuTest: { version: '0.3', data: [ { tuples: [Array], uuid: 'bc3edcd0-24c4-11ea-b257-bdbd9553c516', from: 1716906055000, to: 1716906115000, min: [Array], max: [Array], average: 0, consumption: 0, rows: 2 }, { tuples: [Array], uuid: 'deda8550-24c4-11ea-b402-275ee0956365', from: 1716906085000, to: 1716906115000, min: [Array], max: [Array], average: 840, consumption: 7, rows: 2 } ] }
                                        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}]}
                                        javascript.0	16:22:34.588	info	Stopping script script.js.common.VolkszaehlerNeuTest
                                        

                                        ° Node.js: 20.17.0 NPM: 10.8.2
                                        ° Proxmox, Ubuntu 22.04.3 LTS
                                        ° Fixer ---> iob fix

                                        1 Antwort Letzte Antwort
                                        0
                                        • OliverIOO Offline
                                          OliverIOO Offline
                                          OliverIO
                                          schrieb am zuletzt editiert von
                                          #98

                                          @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
                                          

                                          Meine Adapter und Widgets
                                          TVProgram, SqueezeboxRPC, OpenLiga, RSSFeed, MyTime,, pi-hole2, vis-json-template, skiinfo, vis-mapwidgets, vis-2-widgets-rssfeed
                                          Links im Profil

                                          liv-in-skyL 1 Antwort Letzte Antwort
                                          0
                                          Antworten
                                          • In einem neuen Thema antworten
                                          Anmelden zum Antworten
                                          • Älteste zuerst
                                          • Neuste zuerst
                                          • Meiste Stimmen


                                          Support us

                                          ioBroker
                                          Community Adapters
                                          Donate

                                          829

                                          Online

                                          32.4k

                                          Benutzer

                                          81.6k

                                          Themen

                                          1.3m

                                          Beiträge
                                          Community
                                          Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen | Einwilligungseinstellungen
                                          ioBroker Community 2014-2025
                                          logo
                                          • Anmelden

                                          • Du hast noch kein Konto? Registrieren

                                          • Anmelden oder registrieren, um zu suchen
                                          • Erster Beitrag
                                            Letzter Beitrag
                                          0
                                          • Home
                                          • Aktuell
                                          • Tags
                                          • Ungelesen 0
                                          • Kategorien
                                          • Unreplied
                                          • Beliebt
                                          • GitHub
                                          • Docu
                                          • Hilfe