Generic - Pulse counter and /json?tasknr=1

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Normal user
Posts: 2
Joined: 03 Mar 2020, 14:19

Generic - Pulse counter and /json?tasknr=1

#1 Post by petekeegan » 03 Mar 2020, 15:03

What a fantastic effort you have made with the ESPEasy.

I have been working on a water meter project for over a year and the ESPEasy is perfect for my needs.
Since I do not have internet at the properties I am metering I am using a SIM7000a LTE module to send UDP Packets to my IOT Server.
The LTE module is on a second ESP-12E.

When I query the Generic - Pulse counter Count,Total,Time values using "" <-- ESPEasy from my LTE-ESP
it returns the values from the last "Interval" not the current values that show on the Devices page. returns for the first task

Code: Select all

Time:11233 returns

Code: Select all

"TaskValues": [

I would like to query the current value of Count and Total then zero Count.
I would zero Total and Time every 24 hours.

I there a way to remotely trigger my Device/Task to use a Generic HTTP Controller every 15 minutes?

Help would be appreciated.

Core team member
Posts: 3929
Joined: 01 Sep 2017, 22:13
Location: the Netherlands

Re: Generic - Pulse counter and /json?tasknr=1

#2 Post by TD-er » 03 Mar 2020, 15:20

Sending every N minutes can be done in the rules. You can set a timer and then perform a SendToHttp command.
See: ... nd-publish

You can also store the current count in a variable and then subtract that value from the current value.
This way you have the difference since last time you sent.
You can either store values in a variable using the let command ( ... nds-listed ) or use a dummy plugin.

The values stored in tasks will be kept if the node reboots (as long as the node remains powered).
Using a dummy plugin also protects you from receiving strange values in the occasion the node crashes or reboots, because the counter values and the dummy values will be kept during reboot.

Normal user
Posts: 2
Joined: 03 Mar 2020, 14:19

Re: Generic - Pulse counter and /json?tasknr=1

#3 Post by petekeegan » 03 Mar 2020, 17:18

Thanks for the direction.
I did not know about the site.

I think I have solved the issue.
By issuing ",1" the Count, Total and Time are updated and Count is zeroed.
I then can issue the command and the value are current.
So from what I see the /json?tasknr= returns the last values from running the task and not the current values of the counters.

I do not have any of the "Send to Controllers" enabled and have set the Interval to 65535 on my Device/Task.

I am running ESPAsyncWebServer on the ESP-12E/LTEmodem so when a http:// request is received it interrupts whatever is running.
I do not like to have the ESPEasy decide when to send the values because it interrupts the SIM7000a LTE modem post routine which takes about 20 seconds.
I will also have additional meters on the ESPEasy, therefore I want the ESP-12E/LTE modem controller to ask for the meter values at set intervals.

My next task will be to zero Total and Time every 24 hours.
The ESPEasy will not have the ability to connect to a time server so I will need to issue a command from the ESP-12E/LTEmodem to clear those values.

Thanks again for your help. What a great piece of work.


Normal user
Posts: 307
Joined: 06 Nov 2016, 13:45

Re: Generic - Pulse counter and /json?tasknr=1

#4 Post by Domosapiens » 05 Mar 2020, 00:18

My next task will be to zero Total and Time every 24 hours.
A rule:

Code: Select all

On Clock#Time=All,00:00 do
will do a reset of the first pulsecounter task.
30+ ESP units for production and test. Ranging from control of heating equipment, flow sensing, floor temp sensing, energy calculation, floor thermostat, water usage, to an interactive "fun box" for my grandson. Mainly Wemos D1.

Post Reply

Who is online

Users browsing this forum: No registered users and 25 guests