max lengh of a timer on mega-20191208

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
domosc
New user
Posts: 2
Joined: 19 May 2023, 11:33

max lengh of a timer on mega-20191208

#1 Post by domosc » 19 May 2023, 11:52

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

TD-er
Core team member
Posts: 8756
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: max lengh of a timer on mega-20191208

#2 Post by TD-er » 19 May 2023, 12:04

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

domosc
New user
Posts: 2
Joined: 19 May 2023, 11:33

Re: max lengh of a timer on mega-20191208

#3 Post by domosc » 20 Jun 2023, 19:38

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

User avatar
Ath
Normal user
Posts: 3521
Joined: 10 Jun 2018, 12:06
Location: NL

Re: max lengh of a timer on mega-20191208

#4 Post by Ath » 20 Jun 2023, 19:52

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.
/Ton (PayPal.me)

Post Reply

Who is online

Users browsing this forum: No registered users and 25 guests