Simple time rule to reset a value every 1h

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
ciscomike
Normal user
Posts: 28
Joined: 20 Jan 2021, 10:07

Simple time rule to reset a value every 1h

#1 Post by ciscomike » 10 Feb 2021, 18:27

Hi everyone,
I'm looking for a simple rule to reset a total counter of a pulse sensor to zero every one hour.
I've tried different way to write the rule using for example TaskValueSet etc, also tried to find a solution through the wiki but I couldn't.
The Task No. is 4 and the Value 2 OR Wind_Speed and Wind_Total.
Any help would be really appreciated

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

Re: Simple time rule to reset a value every 1h

#2 Post by TD-er » 10 Feb 2021, 18:55

The command to reset the pulse counter is resetpulsecounter, with an optional parameter for task index.

So your rules will be something like this:

Code: Select all

on Clock#Time=All,**:00 do 
  resetpulsecounter,4
endon
N.B. not tested code.

See: https://espeasy.readthedocs.io/en/lates ... Rules.html (Ctrl-F for "Clock#Time")

ciscomike
Normal user
Posts: 28
Joined: 20 Jan 2021, 10:07

Re: Simple time rule to reset a value every 1h

#3 Post by ciscomike » 10 Feb 2021, 19:01

That worked GREAT for me!
Thank you @TD-er

Post Reply

Who is online

Users browsing this forum: No registered users and 24 guests