I thought that there is some built in blynk library method for checking connection status of a blynk device using a different blynk device, but is not. The SmartPhone application monitors that through the server, so the info exists but only the app can get it.
At the moment, as Gunner thought me, we can use an extra vpin as heartbeat so the master device can monitor its activity, which is not bad.
Probably it will reduce the activity of both devices by not having to check eachother and letting the server use the info that already has and use it to trigger a pin only if its the case.
You can do it with an API call:
It obviously needs each device to have it’s own
auth_token and if the two devices are geographically separate then you should replace
blynk-cloud.com with the IP address of the Blynk cloud server where your project is stored.
You also need to poll the server on a frequent basis to know when the on/offline status has changed.
Full API documentation here:
you can do that with bridge widget
I am using bridge to monitor the heartbeat. If the monitored device gets offline the value remains the same which would be detected by the master device. At least this is what i am working on at the moment.
I had a look on the Api call, but the bridge + heartbeat thing looks easier.
LE: i just realised how the bridge works. it ONLY allows to SEND data, or to alter a Vpin on a different device, and NOT request. Am i right?
I use 2 timers and I compare T to T-1
Correct… A bridge command only needs to be setup and processed on the SENDER side… It is a One-Way process, if you want data back, you need to setup and process bridge commands on the other device heading back.
Think of two people communicating across a valley with megaphones (conical devices which amplify your voice)… the megaphone is only needed for the one doing the talking… 2 megaphones = full 2 way communication… 3 megaphones = the makings of a party
O.T. after your tooth ( self ) extraction, your humor improved a lot!
Hello Pete, I’m doing this, with http request on esp8266, in a local server. But when i try to request more than 2 devices in sequency (this took an average os 4s for two devices only) then I get errors, sometimes HEARTBEAT, and the connections resets. Any tips?
Sounds like you’re starving Blynk of processor time. Try adding a Blynk.run() between your API calls.
Hi, the HTTP request usually have a
readStringUntil(), because this, the task took an average of 5s sometimes until the timeout. So I’m using just
read() function. I will test later, but I think this solves the problem