Time Input only resets the values coming from device if I move the app to edit mode and run it again

I struggled long with the same problem Fradera reported (all widget easily reset to values stored on the device by virtualWrite+syncWirtual, except TimeInput), and went stripping down my application to pinpoint the issue, till I discovered that TimeInput is only reset to the values coming from device if I move the app to edit mode and run it again. In other words, it looks that TimeInput is receiving inputs but not adopting them till restarted.
I know I lack understanding of how the relationship between my device, my app and the server runs. To my eyes the server is “transparent”, in the sense that I am concerned by the app-to-hardware relationship only - a hop only, not two - and this is most probably the source of this behavour. Nevertheless, if ever possible I’d like a change in the ways TimeInput works now, by ensuring that its data are changed in push-mode like those of all other widgets. Otherwise, there might be the case where my hardware resets to default start/stop time, I am happy of the start/stop time I see on my screen, and keep going out of sync.

Btw: all the above with iOS 10.1.1 on iPhone; Blynk 0.6.1; Wemos D1 and WiFi connection; and any code including the example sketch referred.

Hello, I moved your post to your own topic.

Please supply further details and (properly formatted) code that is showing the issue.

To clarify, your issue is not the Widget sending new data to the device, but the other way around… from the device’s code??? I don’t think that is how the widget is meant to work.

Sorry, this was my first post and I’m not well aware of the way to go.
Yes the problem occurs when the hardware tries to sync the app to the same values it has stored internally, to restore synchronisation.

#define BLYNK_PRINT Serial
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <Blynk.h>
#include <BlynkSimpleEsp8266.h>

char auth[] = "********************************"; // ESP-01 relay "Termostato"
char ssid[] = "***********";
char pass[] = "***********";

void setup() {
  Blynk.begin(auth, ssid, pass);

//as soon as connected update TimeInput widget state
  //seconds from the start of a day. 0 - min, 86399 - max
  int startAt = 5 * 60; //00:05
  //seconds from the start of a day. 0 - min, 86399 - max
  int stopAt = (60 + 5) * 60; //01:05
  char tz[] = "Europe/Kiev";
  Blynk.virtualWrite(V1, startAt, stopAt, tz);

void loop(){

The above is the library example (only modified for WiFi, and by removing comments). It also fails in updating the start/stop times in the app. To verify, create a project with one TimeInput widget only, set the start&stop times arbitrarily, load the sketch into a device and wait - your times remain undisturbed till the moment you switch the app to edit mode and back.
On the contrary, all other widgets change immediately as soon as the hardware issues the virtualWrite+syncVirtual commands to the relevant pins.
Apologies if I’m missing something, I’m an old guy coming back to coding since my university days… and when I stopped all was Pascal at the best, with C (not ++!) still to come

There should be no need to “restore” the widget info by writing to it. It is designed to take the info once, from the user on the App when they press OK, then it sends that info to the server/device function for your code to process.

Then, assuming your device needed to reboot, whenever your code synchronises that vPin Blynk.syncVirtual(vPin) the associated function again pulls that preset info from the server so your code can again work with it.

Here is a long topic all about that widget.

Wait a minute… “pulls that preset info from the server”? that leads me into the idea I completely misunderstood the mechanism.
Are you saying that the execution of virtualWrite+syncVirtual functions by the device code pulls the data existing in the server into the device? if so, by restarting the device would be sync’ed to the server, not the other way around as I thought.
I had assumed that the two functions would rather move the data existing in the device (through the server) into the app - which is, by the way, what the other widgets do (changing the values in the app to reflect those in the device) and what the documentation also explains.

I’m rather confused now!

The mechanism is as follows:

  • The server stores all the data
  • All data goes via the server
  • Data can be pushed to the server from an MCU device using Blynk.virtualWrite. This is then pushed to the app if appropriate.
  • Data from the app (such as button widget presses, slider widget values etc) are pushed to the server.

The Blynk library running on an MCU device is constantly talking to the server. When an even occurs on the app - lets say a button widget attached to a virtual pin changes from off (0) to on (1) - this is pushed to the server.
This is then pushed from the server to the Blynk library on the MCU. The Blynk library running on the MCU will fire the BLYNK_WRITE(VPin) function so that the cha ge in value of the widget can be processed by the user’s code.

Does this help?


Thank you Pete.
This is what I have been supposing, however in this case I still find a difference in the behaviour of different widgets.
I start from your phrase “this (the data) is then pushed (from the server) to the app if appropriate”.
If wihout my intervention the code in the MCU is changing the value of a labeled value or the selection of a segmanted switch by virtualWrite+syncVirtual commands, I immediately see the change in the app.
If the change is in the start or stop time of a time input, conversely no change - until I move the app in edit mode and back.
I can’t see a reason for this inconsistence, so wonder if I’m missing something…!


There is a known issue with the Timer Widget not sending active or even edit mode changes to the Local Server… perhaps there is similar issue with the Timer Input Widget? Are you also running a Local Server?

If it concerns opening widget’s settings, it is possible an app’s bug. I’ll check. We usually clear widget’s value if the pin has been changed or some changes has been made (min/max edited or etc).

No, I’m working with the remote server. I am interested in implementing a local server, but that is still well ahead, say, beyond line of sight in my learning path :wink:

In next beta/release there will be fix to this issue

1 Like

Thank you. I’m glad if I could be of any help for the improvement of Blynk.

I’ve uploaded 2.27.5 release with a fix to Time Input widget’s issues - it should be available to download in several hours

1 Like

Thank you - however I understand that’s for Android.
I’m on iOS… any hope?