Best way to implement multitimer for relay

Dear Sirs,
I am planning to do a new project and I need your suggestions for what is the best way to implement it.
Giving more info, I want to control a relay ( actually two independent relays but that is easy if I found the way for one ). For this relay, I want to have many programmable on off “events” during the day, and during the week.
Also it could be great to have repeated “events”, let’s say relay on for xx minutes and then off for zz minutes repeated y times…
Ideally the number of there “events” should be not prescribed in the sketch and can be expanded by the user according his needs, at the run time using Blynk apps user interface.
In my previous project, I used four time input widgets, but using this, I can have only four “events”. I don’t want to implement it using multiple time input widgets due to real estate they need etc ( think to have 15 t.i.w. ! )

What do you think about? What is the best way to achieve this?

Thanks in advance.
Best Regards,
Mike Kranidis

Use terminal to ask questions about timer number, durations, etc. Stored in arrays or just vPins and fed into appropriate timer for each relay?

If you didn’t know, timers can be set for repeatable times…

int setTimer(long d, timer_callback f, int n)

Call function f every d milliseconds for n times. The callback function must be declared as void f(). After f has been called the specified number of times, the interval is deleted, therefore the value timerId is no longer valid.

void repeatMeFiveTimes() {
// do something

timerId = timer.setTimer(1000, repeatMeFiveTimes, 5);

@Gunner dear Gunner, thanks a lot for your guidance. I already have this implemented using the terminal but I think this is not user friendly at all. That’s why I asked this question here.
Again thanks for your help.

Best Regards,
Mike Kranidis

I had put this in as a widget improvement idea. Time as an object is attached to a button. As many timer objects as one wants.can be attached. In the UI, the button click will allow us to attach such objects. Objects can be individual time based on and off with day selection or a stopwatch timer to change state.

1 Like

@mikekgr roughly how many ON / OFF transitions would you expect your system to need in a day, without human interaction?

Dear @Costas, I have not a defined number, let’s say 100 programmable daily events will be good, and 5-6 daily repeated timers in the sense do xx seconds relay on and zz seconts relay off for yy repeated times

Just to clarify better, I need user interaction when he programming the relay on off transitions, the repeated timers and of course when change them. Otherwise the system will be auto functional…

Dear friends,
almost 11 days after the posting of my question, help asking and I did not found the way to go…
Is there any good suggestion left?

Best Regards,
Mike Kranidis