Page 1 of 1

max lengh of a timer on mega-20191208

Posted: 19 May 2023, 11:52
by domosc
Hello
Sorry to post this simple question but i encounter a problem on a esp (sonoff th10) who is managing my water heater since 2019. It has the mega-20191208 as firmware.
I've searched for the documentation of this version, but i only find the latest one.
My question is: what is the maximum duration of a timer in mega-20191208 ?
I try to set it as one hour, but it seems to not functionning. If i test with a timer of 10 ou 30 seconds, it seems to work. On other esp that i have (much newer: 2022xxx), 1 hour is ok.
Eventually, i can update the firmware, but i prefer not. It would be advisory to disconnect my water heater an it is not in a easy place in my home.
Thank you for your answer.
Sylvain

########
// here my code
on forcer do
event,stop
taskvalueset 6,3,1 //chauffe_forcee
gpio,12,1
timerset,1,3600
endon

on Rules#Timer=1 do
event,stop
endon

Re: max lengh of a timer on mega-20191208

Posted: 19 May 2023, 12:04
by TD-er
I would have to dig through the code, which has changed a lot since then.
But you could simply bypass this by either calling several timers, or (if it was already present then) use variables to count the nr of calls to this timer.

Example to let it run for 42 times your set timer: (just a number to help you find it in the code :) )

Code: Select all

on forcer do
  event,stop
  taskvalueset 6,3,1 //chauffe_forcee
  gpio,12,1
  timerset,1,30
  
  let,1,0
endon

on Rules#Timer=1 do
  if [int#1] < 42
    let,1,[int#1]+1
    timerset,1,30
  else
    let,1,0
    event,stop
  endif
endon

Re: max lengh of a timer on mega-20191208

Posted: 20 Jun 2023, 19:38
by domosc
Thank you for your answer, my problem is solved.
I liked your bypass and apply a similar technique and it's fine. I used :
#########
# taskvalueset 7,1 <-> dummy3#duree
On Clock#Time=All,**:** do
if [dummy3#duree]<=60 and [dummy2#chauffe_forcee]=1
taskvalueset 7,1,[dummy3#duree]+1 //duree=duree+1
endif
.....
##########

I don't answered quickly and i don't use your code "as is" because i have seen i was wrong. The timer, even for a few seconds, is not ok...
I read somewhere that the timer / the clock system is using gpio 14 (is it true ?), and i use also gpio 14 for a temperature sensor.
Is it possible that the timer isn't working because an "interference" on gpio 14 ?

regards

Re: max lengh of a timer on mega-20191208

Posted: 20 Jun 2023, 19:52
by Ath
domosc wrote: 20 Jun 2023, 19:38 I read somewhere that the timer / the clock system is using gpio 14 (is it true ?), and i use also gpio 14 for a temperature sensor.
Is it possible that the timer isn't working because an "interference" on gpio 14 ?
The timers and GPIO 14 are not related to each other.