Multiple timers running simultaneously?

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
boolie
Normal user
Posts: 20
Joined: 23 May 2018, 21:35

Multiple timers running simultaneously?

#1 Post by boolie » 05 Aug 2018, 21:35

Hi All,

I assume that one reason for having 8 separate timers, is that one can have them running simultaneously to cause things to happen at different intervals. However, it's not working for me if so.

In my boot code, I set two timers: T1 @ 5secs to update a displayed sensor value and T3 @ 60 secs to send the sensor values to a remote server using a HTTP request. When I watch the log, T1 is being set and the event is occurring as expected. There's never any mention of T3 in the log at all and the remote server is not being updated.

Am I doing something wrong, or is ESPEasy not capable of using multiple timers simultaneously?

Full rules code below...

Code: Select all

On system#boot
//start timer for temp/hum display cycle
   event,timerstart
endon

On timerstart do
//start timer for temp/hum display cycle
    timerSet,3,60
    timerSet,1,5
    TaskValueSet,12,1,1
endon

On timerstop do
//stop timer
    timerSet,1,0
    timerSet,3,0
endon

On Rules#Timer=1 do
//show temp or hum as determined by "cycle" value of dummy device MyVars
    if [MyVars#cycle] = 1
        7dt,[DHT#Temperature]
    endif
    if [MyVars#cycle] = 2
	7dn,[DHT#Humidity]
    endif
    if [MyVars#cycle] = 3
	7dt,[DA#Temperature]
    endif
    if [MyVars#cycle] = 4
	7dt,[DB#Temperature]
    endif

    TaskValueSet,12,1,[MyVars#cycle]+1
    if [MyVars#cycle] = 5
        TaskValueSet,12,1,1
    endif
    timerSet,1,5	
endon

On Rules#Timer=3
    event,sendtovera
    timerSet,3,60
endon

On sendtovera
    SendtoHTTP 192.168.8.200,80,/port_3480/data_request?id=variableset&DeviceNum=143&serviceId=urn:upnp-org:serviceId:TemperatureSensor1&Variable=CurrentTemperature&Value=[DHT#Temperature]
    SendtoHTTP 192.168.8.200,80,/port_3480/data_request?id=variableset&DeviceNum=144&serviceId=urn:micasaverde-com:serviceId:HumiditySensor1&Variable=CurrentLevel&Value=[DHT#Humidity]
    SendtoHTTP 192.168.8.200,80,/port_3480/data_request?id=variableset&DeviceNum=145&serviceId=urn:upnp-org:serviceId:TemperatureSensor1&Variable=CurrentTemperature&Value=[DA#Temperature]
    SendtoHTTP 192.168.8.200,80,/port_3480/data_request?id=variableset&DeviceNum=146&serviceId=urn:upnp-org:serviceId:TemperatureSensor1&Variable=CurrentTemperature&Value=[DB#Temperature]
endon

On wifi#disconnected
    7dn,0
    event,timerstop
endon

On wifi#connected
    event,timerstart
endon

//EOF
Various D1 & Sonoffs with ESPEasy, some Tasmota. Domoticz, Z-wave.
ESPEasy Patreon - keep up the good stuff, guys!

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

Re: Multiple timers running simultaneously?

#2 Post by TD-er » 05 Aug 2018, 21:52

You're missing a "do" at the "On Rules#Timer=3"
See: https://www.letscontrolit.com/wiki/inde ... ules#Timer

boolie
Normal user
Posts: 20
Joined: 23 May 2018, 21:35

Re: Multiple timers running simultaneously?

#3 Post by boolie » 07 Aug 2018, 17:04

D'oh! How did I miss that? :oops: Thanks TD-er :D
Various D1 & Sonoffs with ESPEasy, some Tasmota. Domoticz, Z-wave.
ESPEasy Patreon - keep up the good stuff, guys!

Post Reply

Who is online

Users browsing this forum: No registered users and 32 guests