Page 1 of 1

Timers...!?

Posted: Sunday 14 October 2018 23:50
by Ricard1
Hi,

I use timers here and there in Domoticz, however I experience them unreliable many times. I guess Timer, as it named, is a function that counts down the set number of seconds and then fires. Yes that's fine, however under an active Timer session Domoticz may run into troubles like power loss, crash or a user update of Domoticz! Yes more or less that may happen. So in that situation the Timer function is altered and a 2KW heater for example that was meant to turn off after some time will keep being on forever or until the user notice and turn of it manually... can be expensive, and hot! ;)

My suggestion to a big improvement is that Timers method is redesigned in the way that when a Timer is activated the "Time" it would fire is calculated and stored in the Database instead of "counting to zero", and as soon it is fired/time have passed that Time is removed from the Database. A "Time" based Timer instead of keep counting would be best in stability, reliability and even less in CPU time I guess?

I experience also an electric towel heater I set to start at 06:00 every with Timer delay OFF of 32400 seconds (9 hours) don't turn off next day after upgrade of Domoticz, even at 11 hours it is on, some kind of bug.

Maybe I am wrong in my conclusion in system functions? I am not a programmer so I am not able to revive actual code methods :)

Thanks for listening!

Re: Timers...!?

Posted: Monday 12 November 2018 15:48
by syrhus
Hi Ricard

Timers are used to trigger something when state change on a specific time event.
Using a timers with a delay off of 9 hours is not the right way to plan your heater.

Create a timer to turn on at 6:00 and another to turn off a 15:00 ... so if something is crashing between 6:00 and 15:00 , Domoticz will stop your heater at 15:00.

If you want, I made a tool to create an "easy" weekly planning :
viewtopic.php?f=31&t=20868

Regards

Re: Timers...!?

Posted: Monday 26 November 2018 20:10
by Ricard1
Hi @syrhus,

No you are wrong here and I also know how to make a schedule time on and off :)

I want as well the option to start a 9 hour timer "as wish", i.e if a family member takes a evening shower it should as well be possible to manually star a 9hour delay off timer...

And again, it is a serious issue if the automation system cannot "keep in mind" a timer even if the system crash, reboot etc..

Actually I just discovered that my towel heater been on since Saturday 06:00 because I did an update of Domoticz beta during the timer was active and I did not manually turn it off. I could make an extra function to always turn it off at 05:55 but it is not making the Domoticz Timer function better... ;)

So, the smart way (right way) of designing a better timer system would be as I suggested.

Unfortunately I am not a programmer to design this "upgrade" however maybe someone else would like to lift Domoticz another level :P

Kind regards,
Ricard

Re: Timers...!?

Posted: Monday 26 November 2018 21:52
by syrhus
Hi Ricard

I really do not understand why you prefer to use a so huge countdown of 34000 seconds instead of an Off event at 15:00.
If you have a reboot, an electrical failure, a crash or anything else, your countdown is lost, you are right.
With an Off event, if a crash, or another issue, happened between 6:00 and 15:00 , domoticz will set Off your heater tower at 15:00 and the "only" problem would be a crash at 14:59 and you really would not be lucky in this case :D

For my point of view, it would be more important to initialize your switches to a default state on startup and in your case set your heater tower to Off.

But may be someone would be happy to code a "keep in mind"/"missing events" solution.
Regards

Re: Timers...!?

Posted: Tuesday 27 November 2018 0:44
by Ricard1
Hi syrhus,

I did write towel heater, not tower heater! If that make you more understanding of the long delay, to dry the towels from morning shower :)

And it would not be a problem if having a crash at 14:59 (or any second) if the code is well designed, its the difference between anything less good and real stuff! 8-)

Best,
Ricard