WGET Annex

Annex for ESP32
Post Reply
Michael S
Posts: 6
Joined: Mon May 17, 2021 7:09 pm
Location: Delbrück-Germany
Has thanked: 1 time

WGET Annex

Post by Michael S »

Hello community, Hello cicciocb

I have a problem and I don't know if I didn't understand something or there is a bug here.
The code works with
ANNEX 1.42 and Esp 8266
but unfortunately not with
ANNEX 32 and ESP 32
There were tested 2 boards each.
I hope someone understands what I write here
Kind regards
Michael S


---------Code----------
let result$=""
onwgetasync syncload
gosub refresh_price
timer0 60000,refresh_Price
wait

Refresh_Price:
wgetasync "creativecommons.tankerkoenig.de/json/detail.php?id=cd8ba6a6-xxxxxxxx-a3ae-d31280b2585f&apikey=ccd8c3ca-f8ae-a0ac-441a-
fb7aexxxxxxx",443,1
name$ = json$(result$, "name"):name$=left$(name$,4)

rem ONWGETASYNC OFF
return
' --------------------------------------------------------------------------------------------------
syncload:
wlog "jmp to sub"
result$=wgetresult$
return
cicciocb
Site Admin
Posts: 309
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 85 times
Been thanked: 197 times
Contact:

Re: WGET Annex

Post by cicciocb »

HI Michael,
what is exactly your problem ?

I tried your code and seems to work, even if I receive an invalid answer probably because the parameters are not correct.
However, copying and pasting your code I found that the line 8 is separated in 2 parts going on the next line; this is invalid !

This is the answer that I receive.

Code: [Local Link Removed for Guests]

HTTP/1.1 200 OK
Server: nginx/1.10.3 (Ubuntu)
Date: Mon, 17 May 2021 20:15:18 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: origin, x-requested-with, content-type, accept
Access-Control-Allow-Methods: GET

{"status":"error","ok":false,"message":"parameter error"}
For info, typing the same url in the browser, I have exactly the same json answer
Michael S
Posts: 6
Joined: Mon May 17, 2021 7:09 pm
Location: Delbrück-Germany
Has thanked: 1 time

Re: WGET Annex

Post by Michael S »

Halllo cicciocb
Maybe you can read the code better now.
The problem is that it works with ANNEX 1.42 on a 8266.
But not on a ESP32.
There it does not jump into the sub "syncload".
As said
ANNEX 32 does not work
Annex 1.42 works perfectly
Many greetings
Michael S

Code: [Local Link Removed for Guests]

let result$=""

onwgetasync syncload
gosub refresh_price
timer0 60000,refresh_Price
wait
Refresh_Price:
            wgetasync "creativecommons.tankerkoenig.de/json/detail.php?id=cd8ba6a6-XXXX-1ed5-a3ae-d3XXXX2585f&apikey=ccd8c3ca-f8ae-a0ac-441a-fb7ae9bf2c91",443,1         
               name$ = json$(result$, "name"):name$=left$(name$,4)

'                   ONWGETASYNC OFF     
 return
' --------------------------------------------------------------------------------------------------                        
syncload:
wlog "jmp to sub"
  result$=wgetresult$
     return  
Michael S
Posts: 6
Joined: Mon May 17, 2021 7:09 pm
Location: Delbrück-Germany
Has thanked: 1 time

Re: WGET Annex

Post by Michael S »

...It works perfectly in the browser window.
I get the correct JSON file.
I had to make the ID unrecognizable, of course
User avatar
Fernando Perez
Posts: 106
Joined: Mon Feb 15, 2021 10:09 pm
Location: Santander (Spain)
Has thanked: 55 times
Been thanked: 54 times

Re: WGET Annex

Post by Fernando Perez »

I am a bit lazy to give my email address to more companies to obtain a real API, but I have tried with the test API that they provide and, for me, your program works perfectly on an ESP32 loaded with "Annex32 Wifi 1.43 CAN BLE".

Code: [Local Link Removed for Guests]

onwgetasync syncload
gosub refresh_price
timer0 60000, refresh_Price
wait

Refresh_Price:
  wgetasync "https://creativecommons.tankerkoenig.de/json/list.php?lat=52.521&lng=13.438&rad=1.5&sort=dist&type=all&apikey=00000000-0000-0000-0000-000000000002"
return

' --------------------------------------------------------------------------------------------------                        
syncload:
  result$ = wgetresult$
  wlog result$
  wlog
  name$ = json$(result$, "name")
  wlog name$
return

cicciocb
Site Admin
Posts: 309
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 85 times
Been thanked: 197 times
Contact:

Re: WGET Annex

Post by cicciocb »

I confirm what said by Fernando, it works well for me too.

What version of Annex32 are you using ?
Michael S
Posts: 6
Joined: Mon May 17, 2021 7:09 pm
Location: Delbrück-Germany
Has thanked: 1 time

Re: WGET Annex

Post by Michael S »

Thank you both for the support
On the board is Annex32 Wifi 1.43 CAN BLE
I'll keep trying...

Many greetings

Michael S
Michael S
Posts: 6
Joined: Mon May 17, 2021 7:09 pm
Location: Delbrück-Germany
Has thanked: 1 time

Re: WGET Annex

Post by Michael S »

Nachtrag....Nach 3 Versuche die Firmware hochzuladen hat es jetzt auch gelappt.....Danke :D :D :D
Post Reply