A little direction

Just after some advice as am totally stuck. Am wanting to implement a user input that sets a time window (like in the time input widget), that will then simply check to see if it’s within that window and write to a variable (on/off). This allows something to run during that time.

Have taken a look at the time input widget but am completely stuck as can only find old examples and nothing I try works. Have looked into automations but is also confusing me as I’ve no idea how I’d do the user input side.

Ideally I’d love an example of any type of code that uses the new Blynk IOT app and achieves a similar thing. Or even someone’s working code using the time input widget and new app.

This thread looked promising but uses RTC widget instead

Any direction is great! Thanks

If you’re using the Time Inputbwidget then you need the RTC widget too.
Time input tells you the start and stop time in elapsed seconds since midnight.
The RTC widget will give you the time, so you know the elapsed seconds since midnight and can do the comparison.
RTC works slightly differently in Blynk IoT, but it’s explained in the documentation.

Automations are inputted in the app, but you need to have datastreams configured as being available to automations, and additional ones as being available for actions, before the options appear in the app (at the bottom of the screen).

Give automations a try first.


Thanks Pete. This does clear things up a little as all examples used RTC widget but I cannot find it anywhere. I can get the time from the server using
Blynk.sendInternal("utc", "iso");
I assume this is no longer required?
#include <WidgetRTC.h>
I then take the sting I can get from the server and compare it to the time input widget?

As for Automations, I’m lost as to how you’d get a user input and write to a variable based on their input. Could you give a brief overview of steps one would generally use for such a thing?


[EDIT] Re-reading the Automations docs I see it is for end users. Perhaps I’m thinking of this the wrong way and should instead be thinking about exposing the right info to the end user so they can achieve such a task? This would mean making datastreams available with clear descritions of what they are/do. Then an Automation could be created. Am I barking up the right tree?

There’s more to it than that. Take a look at the time input examples in the sketch builder.

You’ve lost me here I’m afraid. I thought you wanted a simple on/off timer. If so then just set up two automations and if the user wants to change the on/off times then they edit the automation.

I’d suggest that you give it a try rather than approaching it from a theoretical perspective.


This is useful! Thanks

Yeah, probably lost myself too :sweat_smile: . I’m approaching it in an over complicated way. Checked out Automations again and I see it seems very simple to achieve what I want. One question however. What happens with loss of connection to the internet?

Automations don’t work.
There is talk of introducing offline functionality in future, but I don’t know when, or whether it will be available for all plans.

If you need full offline functionality then you probably need to use the time input widget and use a hardware RTC too, and sync it to the Blynk server or NTP server when a connection is available.