Json Data Question to a ESP32 Controller?

Annex for ESP32
Post Reply
Helmut_number_one
Posts: 194
Joined: Fri Dec 09, 2022 10:03 am
Location: Flensburg Deutschland
Has thanked: 149 times
Been thanked: 30 times

Json Data Question to a ESP32 Controller?

Post by Helmut_number_one »

I found nothing in Help File :
So if I send something like this to an ESP32 Annex Basic Controller: http://192.168.0.44/sensorList.json
That he sends me such an answer?
{"sensors":[
{"ID":"Untitled","Disp":0,"P1":0,"P2":0,"Val":0.00,"Min":-20,"Max":85,"U": "°C"}
]}
Is this possible?
User avatar
cicciocb
Site Admin
Posts: 3084
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 632 times
Been thanked: 2217 times
Contact:

Re: Json Data Question to a ESP32 Controller?

Post by cicciocb »

Is no very clear for me but, is you want get the result of this url (http://192.168.0.44/sensorList.json) inside Annex you can simply use

Code: [Local Link Removed for Guests]

a$ = WGET$("http://192.168.0.44/sensorList.json")
If you want do the opposite (the url is an annex module), is possible too but not exactly with the same url.

In this case you can use the [Local Link Removed for Guests]event and use the url http://192.168.0.44/mgs

You have an example inside the help
User avatar
PeterN
Posts: 774
Joined: Mon Feb 08, 2021 7:56 pm
Location: Krefeld, Germany
Has thanked: 360 times
Been thanked: 439 times
Contact:

Re: Json Data Question to a ESP32 Controller?

Post by PeterN »

Hi Helmut,

not exactly what you requested .... but take a look at the OnUrlMessage event and UrlMsgReturn


[Local Link Removed for Guests]

That give a way to return a string with almost any wanted contend as a reply to for example http://esp_local_ip/msg?x=1



EDIT: I was not really as fast as lightning .... but Francesco was faster than lightning :-)
Post Reply