🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    http request to netatmo fails with error (solved!)

    UIFlow
    5
    11
    21.1k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • dblooomD
      dblooom
      last edited by dblooom

      Hi, can anyone help me with connection to the Netatmo API?
      https://dev.netatmo.com/resources/technical/samplessdks/codesamples

      I tried it with the new http request block but I get the error "invalid_request, Invalid grant_type parameter or parameter missing"

      What could be the problem?

      alt text

      1 Reply Last reply Reply Quote 0
      • ajb2k3A
        ajb2k3
        last edited by

        May sound stupid but have you tried

        payload = {'grant_type': 'authorization_code', 
        

        Perhaps your code should be key "grant_type" value authorization_code

        UIFlow, so easy an adult can learn it!
        If I don't know it, be patient!
        I've ether not learned it or am too drunk to remember it!
        Author of the WIP UIFlow Handbook!
        M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

        1 Reply Last reply Reply Quote 0
        • dblooomD
          dblooom
          last edited by

          thx, but this seems not to be the solution (I tested it anyway). Grant-Type "password" is correct afik.

          ozbkO 1 Reply Last reply Reply Quote 0
          • ozbkO
            ozbk @dblooom
            last edited by

            @dblooom The header option should be like it.
            0_1571103340077_88972a6c-1ea7-4b6c-aaa4-b850a504b119-image.png

            1 Reply Last reply Reply Quote 0
            • dblooomD
              dblooom
              last edited by

              oh, that was wrong, thx. But still get the same error...

              1 Reply Last reply Reply Quote 0
              • dblooomD
                dblooom
                last edited by

                Ok, could figure it out. The http-req sends data as JSON but Netatmo needs it as "data". So I could change it in Phyton code but can't do it in blocky.

                @devs: So it would be nice to have two different slots in the http-reqthing: one for json-data and one for data. Or an option to switch it.

                ajb2k3A P 2 Replies Last reply Reply Quote 0
                • ajb2k3A
                  ajb2k3 @dblooom
                  last edited by

                  @dblooom please post this as a bug report on the UIFlow github page as this is important enough for immediate attention

                  UIFlow, so easy an adult can learn it!
                  If I don't know it, be patient!
                  I've ether not learned it or am too drunk to remember it!
                  Author of the WIP UIFlow Handbook!
                  M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

                  1 Reply Last reply Reply Quote 0
                  • dblooomD
                    dblooom
                    last edited by

                    @ajb2k3 hm thx. But I'm not familiar with github. Maybe you can submit it for me?

                    ajb2k3A 1 Reply Last reply Reply Quote 0
                    • ajb2k3A
                      ajb2k3 @dblooom
                      last edited by

                      @dblooom said in http request to netatmo fails with error (solved!):

                      @ajb2k3 hm thx. But I'm not familiar with github. Maybe you can submit it for me?
                      Done.

                      UIFlow, so easy an adult can learn it!
                      If I don't know it, be patient!
                      I've ether not learned it or am too drunk to remember it!
                      Author of the WIP UIFlow Handbook!
                      M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

                      1 Reply Last reply Reply Quote 0
                      • P
                        PacQ @dblooom
                        last edited by

                        @dblooom Hi. Sorry for resurrecting this topic, but I can't figure it out at all and haven't found any other resources regarding "Netatmo" and M5Stack on the web. I've tried to fix this issue by replacing "json={'grant_type':'password', ...}" with "data={'grant_type':'password', ...}" and also "data=[('grant_type','password'), ... ] and still had lo luck with it.
                        I have no problem getting a correct response when working with Postman or directly with Python, but I'm not able to figure out what's wrong in UiFlow.
                        Would you perhaps have time to elaborate on how you have managed to fix it in "python portion" of the UiFlow if you still remember?
                        Sorry again for the inconvenience.
                        Best regards.

                        1 Reply Last reply Reply Quote 0
                        • A
                          amn
                          last edited by

                          Hi
                          is it possible to share you code ? interest by this code.
                          for me the UIFlow not work with my M5 stack so I use only arduino ide interface.
                          Thx

                          amn

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