The Webhook widget is connected to V0 on the the app side, and it contains a URL that I can successfully use on a browser and get a perfect response about the weather in my location.
The Blynk documentation states what I said about the use of virtualWrite and its relationship to BLYNK_WRITE, but I agree with you that it does not work hence I made this post.
In my code, instead of using a button that I press to send a value of 1 to the Webhook on V0, I built a timer that sends 1 to V0 every 10 seconds as you can see. But of course, since this does not trigger BLYNK_WRITE, even if the Webhook is sending the command to the URL correctly, I won’t be able to read the response.
Okay, now that you’ve explained m,ore about where the webhook widget come in to the equation you can ignore my previous answer.
The BLYNK_WRITE(V0) callback in your code won’t be triggered by a Blynlk.virtualWrite(V0) from your code, but it will be triggered by a response from the weather service API.
My guess is that the app setup is incorrect, so you aren’t getting a response from the server.
I assume that the ** characters at the beginning and end of this line, and other lines in your code, are because you didn’t format your code correctly first time around?
URL returns the expected values when I use a browser to test it
I do seem to be able to read the returned values and print them to serial as you see me trying in the code
I don’t understand how to trigger BLYNK_WRITE(V0) and cant find documentation that tells me to try anything else. All that blynk says is what I mentioned in my original post.
I believe my code is correct and this is the issue:
"#define BLYNK_MAX_READBYTES 1024. Where 1024` - is maximum allowed message size."
The response I am getting from my weather service is 1307 bytes, which exceeds the webhook limit. I tested the same code with another weather service that returns a smaller response and it works as expected.
This means that Blynk.virtualWrite(V0,1) does trigger the function BLYNK_WRITE(V0) as described in the Blynk documentation. And in my case, using a timer to run Blynk.virtualWrite(V0,1) every 10 seconds also works since it’s no different from pressing a button every 10 seconds for example.
No it does not. It seems that 1024 is a hard coded maximum limit defined by Blynk for the webhook. If the response exceeds it, nothing comes through regardless of your sketch setup.
I need to find a free API based weather forecast service that returns up to 1024 bytes, if I am to avoid bringing all the code to the board itself similar to what @Blynk_Coeur posted.
The whole point of the webhook is to move most of that code from your microcontroller to the Blynk servers and keep your sketch small, but with a 1024 bytes limit it rules out several potential use cases.
@murilopicanco Hi may i know how to solve this issue. My serial monitor shows buffer overflow after I include the BLYNK_MAX_READBYTE. My sketch no issue just the openweathermap info doesnt print out.
@Kyle_Gee please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```