What’s new :
Less dependencies and less size;
Websockets code simplified;
Eventor setPin action doesn’t change pin state on server fix;
Webhook now can return response to hardware from GET requests;
Logging refactored for less garbage allocation;
Deploy is planned for tomorrow. So all this features will be available from tomorrow.
Download link.
4 Likes
Costas
October 1, 2016, 6:18pm
3
Tried Webhook GET from http://api.sunrise-sunset.org/json?lat=33.3823&lng=35.1856&date=2016-10-01 on a local server and tied it to a button on a virtual pin. Virtual pin is coded as:
BLYNK_WRITE(V0){
String webhookdata = param.asStr();
Serial.println(webhookdata);
}
Pressing the button gives:
1
0
then disconnects Blynk. Is this because I haven’t set it up correctly or it’s not available yet?
Costas:
then disconnects Blynk
What do you mean? Response from webhook widget may be not instant as server queries 3-d party server. Do you see some errors in log?
Costas
October 1, 2016, 6:40pm
5
I will check the log but basically the WeMos drops the connection to the server.
The full Serial Monitor output when the button is pressed is as follows:
1
0
[1475010] Connecting to 192.168.10.229:8442
Hm. That’s interesting. Let me check on my hardware. @vshymanskyy do we have some limits on incoming message size for hardware?
Costas
October 1, 2016, 6:47pm
7
@Dmitriy is the following guess ok to get the data?
BLYNK_WRITE(V0){
String webhookdata = param.asStr();
Serial.println(webhookdata);
}
For reference the size of the json data is around 353 characters.
@Costas yeap… In debug
Packet too big: 357
@vshymanskyy please advise.
@Costas there also was a bug in server related to webhooks and your scenario so please update jar file just in case you are using it.
Costas
October 1, 2016, 7:58pm
11
Ok I’ll pull down another copy.
What do we do with the 357 characters when we do get them?
Please use
#define BLYNK_MAX_READBYTES 512
@Costas I’ll update docs accordingly.
Costas
October 1, 2016, 8:10pm
14
That’ll go nicely with the #define BLYNK_MAX_SENDBYTES 1400
I already have in the sketch.
Do I have to parse the 357 characters myself?
@Costas If you have some ideas how it could be simplified further - you are welcome.
Costas
October 1, 2016, 8:15pm
17
Dmitriy:
Yes
you know how bad my parsing is.
Confirming system doesn’t crash now I have 512 READBYTES but I don’t have anything to parse, just a 1 followed by a 0? Maybe it’s because I haven’t uploaded the new, new 0.18.3 server. Will try now.
1 Like
Costas
October 1, 2016, 8:30pm
19
Working now:
1
0
{“results”:{“sunrise”:“3:34:07 AM”,“sunset”:“3:23:09 PM”,“solar_noon”:“9:28:38 AM”,“day_length”:“11:49:02”,“civil_twilight_begin”:“3:09:26 AM”,“civil_twilight_end”:“3:47:50 PM”,“nautical_twilight_begin”:“2:40:40 AM”,“nautical_twilight_end”:“4:16:36 PM”,“astronomical_twilight_begin”:“2:11:47 AM”,“astronomical_twilight_end”:“4:45:29 PM”},“status”:“OK”}
When I parse I will have to remember it is UTC.
1 Like
@Costas we will gather statistics of 3-d party service usages and for most popular we will create some wrappers so users don’t have to parse. However seems like webhook is rarely used feature so very unlikely this will happen.