Change part of sketch via Blynk

I’m migrating an automatic sprinkler from the old blynk to 2.0. But in the old one, I changed the watering schedule by the Timer Widget, setting start and end. In 2.0 does not have this widget. So I did it via code.

  if (time >= "08:00:00" && time <= "08:10:00") //If the current time is the same as what we set, it will water

But if I want to change the time, I have to change the code and via old Blynk it was extremely easy.

I thought about putting a Slider Widget to change at least the end time… but I don’t know how to insert this data in the code. Can anyone help?

Type:


BLYNK_WRITE(V1){
  HR = param.asInt();

if (time >= "08:00:00" && time <= "HR:10:00") ...

I know this must be able to be done via automations but I read about it and didn’t find a solution. The point is that there are up to 3 conditions to turn on the pump relay and the time is just one of them.

Timer widget has been replaced with automation, you can try automation which is the easiest way possible.
https://docs.blynk.io/en/getting-started/notification-management/use-automations-to-send-notifications-no-code#2.-create-automation

I’ve tried via automation but haven’t figured out how to do this:

When the humidity is less than 50% and only between 08:00 and 08:10, activate the relay

EDIT
In the App, doesn’t work automations with more or less than x%. Only in the Blynk Web. But only one condition and I need two


You should choose a double type datastream.

@mvrinaldi you don’t need to do all of the logic tests in the automation. You can use the time selection to set a datastream high, then use your existing code to do the rest.

Pete.

1 Like

Thanks Pete and John… It took me a while but I understood!! I configured the automation and it worked!