arduino-libraries / ArduinoHttpClient

Arduino HTTP Client library
282 stars 170 forks source link

code 3 response after request for temperature api.ecobee.com: wifinina ArduinoHttpClient #82

Closed andrewjohnsen31 closed 4 years ago

andrewjohnsen31 commented 4 years ago

I have been stuck on this awhile. Posting to API.ecobee.com I can refresh tokens. When I use the tokens provided, a code 3 communications error is received. If I use an outdated token, a clear outdated token message is the response.

Using Postman always works, here is the working curl command:

Screen Shot 2020-02-05 at 5 11 01 PM

Please provide any comments I could use to debug this. I did not see a way to link my code. I will keep looking

Here is the error response:

Screen Shot 2020-02-05 at 5 04 34 PM

Here is the code using ArduinoHttpClient:

Screen Shot 2020-02-05 at 5 04 56 PM
andrewjohnsen31 commented 4 years ago

I hate to answer my own post, but I am really happy I got it to work. I used https://curl.trillworks.com/#elixir to help decode the curl command. It turns out, there was no need to send a body. I just moved this postData string appending to the Endpoint in the GET command (See Below).

Here is the working modified code:

Screen Shot 2020-02-06 at 2 39 45 PM

There is no issues accessing Ecobee using the Arduino UNO WiFi Rev2 with released libraries: wifinina, Arduinohttpclient #

Screen Shot 2020-02-06 at 2 57 27 PM

I am sharing because all the examples I found do not match what is needed with Ecobee. I will make this my first Arduino Project, incase someone else want to access Ecobee data.