Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. [Frage] Wie kann ich auf einen Discovergy-Zähler zugreifen

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    [Frage] Wie kann ich auf einen Discovergy-Zähler zugreifen

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

      Würde mich freuen wenn du dann berichten würdest.

      Gruss Danyel

      1 Reply Last reply Reply Quote 0
      • Dutchman
        Dutchman Developer Most Active Administrators last edited by

        hi,

        wir probieren auch gerade die ersten schritte mit der api, mit diesem code bekommen wir ein token :

        var form =
            { "Accept": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2",
              "Content-Type": "application/x-www-form-urlencoded",
              "client": "MyIoBroker"
            };
        
        url = "https://api.discovergy.com/public/v1/oauth1/consumer_token";
        
        request.post({url:url, form:form}, function (e, r, body) {
           log(body);
        });
        
        

        Dan kommt

        {"key":"xxxxxxxxxx","secret":"xxxxxxxxxx","owner":"MyIoBroker","attributes":{},"principal":null}
        
        

        soweit so gut, jetzt scheiteren wir aber beim aufbau des naesten befehls. Das script hier oben isrt laut docu aufgebaut :

        POST /public/v1/oauth1/consumer_token
          Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
          Content-Type: application/x-www-form-urlencoded
        
        client=MyOwnClient
        
        

        als naestes muesste laut docu dieser schritt folgen :

        POST /public/v1/oauth1/request_token
          Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
          Authorization: OAuth
            oauth_consumer_key="btgd2cg2bm3lbjqsfv150fj9q8",
            oauth_signature_method="HMAC-SHA1",
            oauth_timestamp="1467792887",
            oauth_nonce="9fd50a6f-40e0-41be-8809-34aa832b688e",
            oauth_callback="oob",
            oauth_signature="hcE6Q3boTytkHmM72xegCP1Y3W4%3D"
        
        

        https://api.discovergy.com/docs/

        probiert haben wir :

        var form =
            { "Accept": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2",
            "Authorization": "OAuth",
                "oauth_consumer_key": "xxxxxxxxxx",
                "oauth_signature_method": "HMAC-SHA1",
                "oauth_timestamp": "1467792887",
                "oauth_nonce": "9fd50a6f-40e0-41be-8809-34aa832b688e",
                "oauth_callback": "oob",
                "oauth_signature": "hcE6Q3boTytkHmM72xegCP1Y3W4%3D"       
        
            };
        
        url = "https://api.discovergy.com/public/v1/oauth1/request_token";
        
        request.post({url:url, form:form}, function (e, r, body) {
           log(body);
        });
        
        

        leider kommt dan aber :

        HTTP ERROR 400
        
        Problem accessing /public/v1/oauth1/request_token. Reason:
        
            Bad Request
        
        

        seit ihr weiter gekommen ?

        1 Reply Last reply Reply Quote 0
        • Dutchman
          Dutchman Developer Most Active Administrators last edited by

          Hab jetzt mal probiert die anderen werte als header zu uebergeben leider auch ohne erfolg:

          var req = require('request');
          
          req.post({
             url: 'https://api.discovergy.com/public/v1/oauth1/request_token',
             form: { "Accept": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"},
             headers: { 
                  "oauth_consumer_key": "xxxxxxx",
                  "oauth_signature_method": "HMAC-SHA1",
                  "oauth_timestamp": "1467792887",
                  "oauth_nonce": "9fd50a6f-40e0-41be-8809-34aa832b688e",
                  "oauth_callback": "oob",
                  "oauth_signature": "hcE6Q3boTytkHmM72xegCP1Y3W4%3D"  
             },
             method: 'POST'
            },
          
            function (e, r, body) {
                console.log(body);
            });
          
          
          1 Reply Last reply Reply Quote 0
          • apollon77
            apollon77 last edited by

            Also wenn ich es korrekt verstehe müsste

            var req = require('request');
            
            req.post({
               url: 'https://api.discovergy.com/public/v1/oauth1/request_token',
               headers: { 
                    "Accept": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2",
                    "Authorization: "OAuth"
               },
               headers: { 
                    "oauth_consumer_key": "xxxxxxx",
                    "oauth_signature_method": "HMAC-SHA1",
                    "oauth_timestamp": "1467792887",
                    "oauth_nonce": "9fd50a6f-40e0-41be-8809-34aa832b688e",
                    "oauth_callback": "oob",
                    "oauth_signature": "hcE6Q3boTytkHmM72xegCP1Y3W4%3D"  
               },
               method: 'POST'
              },
            
              function (e, r, body) {
                  console.log(body);
              });
            
            

            Generell gehen, ABER die Signatur muss für den Request berechnet werden!!

            Vllt hilft ja eine Library wie https://www.npmjs.com/package/oauth um hier etwas komplexität rauszunehmen!

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

              Schon irgendwie weiter gekommen wer?

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

                Ich hänge noch an Schritt 2 fest. Ich habe den Key bisher in eine Varable geschrieben. Wird benötigt für den nächsten Schritt.

                Ich bin da hartnäckig und geb nicht auf. Melde mich.

                1 Reply Last reply Reply Quote 0
                • ?
                  A Former User last edited by

                  Ich bin schon etwas weiter…mit der Library https://github.com/Kong/mashape-oauth komme ich bis zum Abruf der Meterdaten.

                  Es gib aber oft einen Fehler 400 bei AuthToken.

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

                    Hast du die Abfrage über Javascript gemacht? Wenn ja dann poste doch mal den Code. Wäre klasse.

                    Grüße

                    1 Reply Last reply Reply Quote 0
                    • Dutchman
                      Dutchman Developer Most Active Administrators last edited by

                      Würde mich auch interessieren

                      Sent from my iPhone using Tapatalk

                      1 Reply Last reply Reply Quote 0
                      • Dutchman
                        Dutchman Developer Most Active Administrators last edited by

                        [Aufruf] Neuer Adaper Discovergy

                        viewtopic.php?f=36&t=19193

                        :mrgreen: :mrgreen: :mrgreen:

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

                        Support us

                        ioBroker
                        Community Adapters
                        Donate

                        722
                        Online

                        31.9k
                        Users

                        80.2k
                        Topics

                        1.3m
                        Posts

                        7
                        14
                        1980
                        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