BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

BLYNK_READ(vPIN) in Device Tile Widget

I all,

short question to the community. I am using a lot BLYNK_READ(V0) with reading rate of 5-30s for Labled Value widget on V0 for displaying different things like upTime and so on when APP is active.

If I am using BLYNK_READ(V0) in Device Tile Widget with same setup like in other projects, Labled Value widget on V0 with reading rate of 30s, it always reads every second. It doesn’t matter which reading rate I choose it always refreshes once a second.

Does anybody have a similar setup and it works? Or do you have the same issue?

I know a work around with BLYNK_APP_CONNECTED() but want to clarify the possibility of using BLYNK_READ(V0) in Device Tile Widget.

Thanks to you all.

I’m really confused by what you’ve written.

Exactly why are you using BLYNK_READ(V0) ?
What data are you extracting from the app using this process?

Pete.

I am getting upTime of hardware in seconds from hardware via BLYNK_READ(V0).

I am using the approach with BLYNK_READ(V0) to reduce traffic between hardware and blynk server. Only want to send data to Blynk when APP is online.

So your hardware is writing the uptime in seconds to the Blynk server, then you’re using the hardware to pull this value back again?

Are these two different hardware devices, using different Blynk Auth codes and Bridge?

Is one of the hardware devices running on a metered connection, such as a GSM modem? Is that why you’re interested in reducing traffic?

Pete.

only this:

BLYNK_READ(V0) {
  long days = 0, hours = 0, mins = 0, secs = 0;
  String secs_o = ":", mins_o = ":", hours_o = ":";
  secs = millis() / 1000; //convert milliseconds to seconds
  mins = secs / 60; //convert seconds to minutes
  hours = mins / 60; //convert minutes to hours
  days = hours / 24; //convert hours to days
  secs = secs - (mins * 60); //subtract the coverted seconds to minutes in order to display 59 secs max
  mins = mins - (hours * 60); //subtract the coverted minutes to hours in order to display 59 minutes max
  hours = hours - (days * 24); //subtract the coverted hours to days in order to display 23 hours max
  if (secs < 10) secs_o = ":0";
  if (mins < 10) mins_o = ":0";
  if (hours < 10) hours_o = ":0";
  Blynk.virtualWrite(V0, days + hours_o + hours + mins_o + mins + secs_o + secs);
}

Hardware could be on GSM and WiFi. With both I have the behavior mentioned above.

Pete have you tried BLYNK_READ in Device Tile Widget and change reading rate? Will change of reading rate have any effect? In general BLYNK_READ, also with changing reading rate. Only in Device Tile widget change of reading rate has no effect.

I don’t know what you mean by Reading Rate in the Device Tile Widget. Are you referring to the Refresh Interval on a Labelled Value Widget?

Personally, if I only wanted push the uptime in seconds to labelled value widget when the app is active then I’d do the following:

Use the BLYNK_APP_CONNECTED and BLYNK_APP_DISCONNECTED callbacks set a flag which tells me if the app is currently connected or not.

I’d then have a timer set to the frequency I wanted, which called a function that included an if statement and only do a Blynk.virtualWrite if the flag is true.

Whether this will save you much traffic is questionable though, as Blynk is constantly communicating between the hardware and the server in the background anyway.

Pete.

Yes, Refresh Rate of the Labeled Value Widget. Is called in the APP as reading rate, where you can select between PUSH, 1 sec, 2 sec, …

As I have written above, I know about possible alternatives. I want to know if someone as similar setup with success or has the same issue.

Pete:
Are you willing to try BLYNK_READ for a Labeled Value Widget in Device Tile APP and check if it works with different reading rates?

I take it that you’re expecting the widget to trigger the BLYNK_READ callback at the frequency set in the refresh interval of the widget?

I don’t think that’s how these two pieces of functionality are meant to work, but are you saying that this has worked successfully for you in the past when the widget wasn’t part of a device tile?

Pete.

Yes that’s what I expecting and it works perfectly outside the Device Tile widget.

That’s even how it is explained in the info box of labeled value widget inside the APP.

Okay, are you using Android or iOS?
What version of the app and the Blynk library are you using?

Pete.

Android Version 2.27.11 and local server 0.41.11

Okay, maybe one for @BlynkAndroidDev then.

Pete.

@Dmitriy can you check this issue? Does server checks for frequency field on tiles’ widgets?

Hi,
has this been checked? Same with local Server 0.41.12.