How to get timer value

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
neoseb
New user
Posts: 3
Joined: 01 Oct 2018, 19:36

How to get timer value

#1 Post by neoseb » 16 Oct 2018, 15:59

Hi dear experts...

To improve one of my applications I'd need to be able to get the remaining value of a timer if it's cancelled before the inital value is over, for it to be piblished.

I spend hours in the forum and elsewhere in the internet, reading many interesting things but without finding a smart way to perform this.

Hope you'd be able to give me some tricks.

Thanks
SG

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: How to get timer value

#2 Post by grovkillen » 16 Oct 2018, 16:06

I use multiple timers for that and have one that is reporting the time elapsed by publishing and updating a dummy variable. It's not super accurate but within 1-2 seconds of the correct time.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

neoseb
New user
Posts: 3
Joined: 01 Oct 2018, 19:36

Re: How to get timer value

#3 Post by neoseb » 16 Oct 2018, 16:24

Good. I think I tried something similar, but to make sure could you please post an example of your rule ?

Thanks for your help.

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: How to get timer value

#4 Post by grovkillen » 17 Oct 2018, 22:04

neoseb wrote: 16 Oct 2018, 16:24 Good. I think I tried something similar, but to make sure could you please post an example of your rule ?

Thanks for your help.
Something like this (dummy on task number 12, named dummy#value1)

Code: Select all

On TimerStart Do
 TaskValueSet,12,1,%eventvalue%
 TimerSet,1,%eventvalue%
 TimerSet,2,1
EndOn

On Rules#Timer=2 Do
  TaskValueSet,12,1,([Dummy#Value1]-1)
  Publish,%sysname%/Timer,[Dummy#Value1]
EndOn
And using MQTT I'd start the timer using
... Unit... /cmd
Message "event,TimerStart=200 (or what period I want).

This is written on my phone, typos may exist ;)
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 31 guests