What are the timings to collect dat aand send MQTT update ?

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
tparvais
Normal user
Posts: 99
Joined: 28 Oct 2015, 23:13

What are the timings to collect dat aand send MQTT update ?

#1 Post by tparvais » 17 Feb 2020, 08:54

Hello

I was looking to find the following info on wiki, but didn't get it.

I was wondering when exactly the measurements timing is done and when the data is sent over MQTT for different kind of sensors ?

I'm using last release on all my modules, with OpenHab MQTT. Can you confirm the following

1/ depending on "interval" value defined for each sensor ?
If I set Temprature measurement to 15s, the temp will me measured every 15s and dat sent over MQTT.

2/ depending on 'interrupt' for "pulse measurements":

Same thing, when interval set in sensor parameter, the 3 values (count, total, time) are sent via MQTT. It seems that data are sent earlier.
what is the 'time' value ? what does it represent ?
The count represent the delta pulse (if delta is configured) in the period of time configured in 'interval' parameter ?
example to check: if a I set interval = 60s, it will sent every minute the number of pulse counted in that period ?

3/ depending on rule
if a rule change a dummy variable/task, is this new value sent over MQTT immediately or only when this dummy task is read depending on its interval parameter ?

Thank you

Thomas

GravityRZ
Normal user
Posts: 206
Joined: 23 Dec 2019, 21:24

Re: What are the timings to collect dat aand send MQTT update ?

#2 Post by GravityRZ » 17 Feb 2020, 17:14

not an expert but recently figured this out

1/ depending on "interval" value defined for each sensor ?
If I set Temprature measurement to 15s, the temp will me measured every 15s and dat sent over MQTT.
Correct, if interval is set to 15s it will send a message every 15 seconds

2/ depending on 'interrupt' for "pulse measurements":

Same thing, when interval set in sensor parameter, the 3 values (count, total, time) are sent via MQTT. It seems that data are sent earlier.
should not be the case, it should send in the time interval. maybe the first time it is send earlier

what is the 'time' value ? what does it represent ?
that is a nice one, it is the time between pulses. i use this to send real time flow information

The count represent the delta pulse (if delta is configured) in the period of time configured in 'interval' parameter ?
example to check: if a I set interval = 60s, it will sent every minute the number of pulse counted in that period ?
Correct, also the delta gets reset every 60 seconds and the delta is added to the total
eg when you set the time to 1 second(like i do) you see it hardly count because it gets reset to 0 the moment is going to 1



3/ depending on rule
if a rule change a dummy variable/task, is this new value sent over MQTT immediately or only when this dummy task is read depending on its interval parameter ?
the rule is still triggered on an interval base. i thought the interval was only used when send to controller is activated but it is always used. i rather have a rule triggered once a change is detected but it is only triggered on the interval base

i use rules for my watermeter and have set the pulsecounter to a 1 second interval so every second the rule is checked and if there is a pulse it is send
this is as good as send immediately. this works because the fastest pulse(waterflow per second is 25 liter(2,4 seconds) in my setup

for pulses faster then 1 second we do not have a solution

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

Re: What are the timings to collect dat aand send MQTT update ?

#3 Post by TD-er » 17 Feb 2020, 23:02

In short, when the internal function PLUGIN_READ is called for a task, it will output a new value and that one also calls the functions to send out data.

There are 2 ways to trigger this function call:
- via the interval timer
- via rules calling the "taskrun" command.

The first one (interval timer) can get out of sync with other tasks after a while as some plugins do sometimes reschedule their own call to PLUGIN_READ.
A particular example is the GPS plugin, which always reads its positional data and can be set to also output a value after N meters traveled.

So if you need to sample multiple sensor values as close as possible to the same moment, you can set up rules that trigger on a timer or on a sample value and then call taskrun on each other task you want to collect data from.

These samples are then stored in the controller buffer and that will send out the data at the set pace based on "minimal send interval".
The controller parameters are very well documented by the way: https://espeasy.readthedocs.io/en/lates ... parameters

So you may not receive the samples immediately when they are taken, as they may be buffered and the send interval may introduce some latency before you see the values on the other end.

tparvais
Normal user
Posts: 99
Joined: 28 Oct 2015, 23:13

Re: What are the timings to collect dat aand send MQTT update ?

#4 Post by tparvais » 07 Apr 2020, 12:26

GravityRZ wrote: 17 Feb 2020, 17:14 not an expert but recently figured this out


what is the 'time' value ? what does it represent ?
that is a nice one, it is the time between pulses. i use this to send real time flow information

The count represent the delta pulse (if delta is configured) in the period of time configured in 'interval' parameter ?
example to check: if a I set interval = 60s, it will sent every minute the number of pulse counted in that period ?
Correct, also the delta gets reset every 60 seconds and the delta is added to the total
eg when you set the time to 1 second(like i do) you see it hardly count because it gets reset to 0 the moment is going to 1

Hello

So for all you pulse counters, you use an interval of 1s to send delta ? you can obtain an accurate measurement of your consummation/production ? and so you don't use time period sent from esp to evaluate total energy ?

I use pulsecount to count pulses from energy (Wh) counter to measure my electric production (solar panel) and consummation. interval is set to 10s today. I'll change it to 1s

Do you think I shall use debounce option ? It's open collector S0+/S0- from energy counter.

In my case, Time is becoming really big (1750) and Total=12390, despite the fact I've pulses every few seconds. What the time units ?

On MQTT, I see values are updated every second, so ti seems ok from ESP point of view.

Thomas

GravityRZ
Normal user
Posts: 206
Joined: 23 Dec 2019, 21:24

Re: What are the timings to collect dat aand send MQTT update ?

#5 Post by GravityRZ » 07 Apr 2020, 19:41

tparvais wrote: 07 Apr 2020, 12:26
GravityRZ wrote: 17 Feb 2020, 17:14 not an expert but recently figured this out


what is the 'time' value ? what does it represent ?
that is a nice one, it is the time between pulses. i use this to send real time flow information

The count represent the delta pulse (if delta is configured) in the period of time configured in 'interval' parameter ?
example to check: if a I set interval = 60s, it will sent every minute the number of pulse counted in that period ?
Correct, also the delta gets reset every 60 seconds and the delta is added to the total
eg when you set the time to 1 second(like i do) you see it hardly count because it gets reset to 0 the moment is going to 1

Hello

So for all you pulse counters, you use an interval of 1s to send delta ? you can obtain an accurate measurement of your consummation/production ? and so you don't use time period sent from esp to evaluate total energy ?

I use pulsecount to count pulses from energy (Wh) counter to measure my electric production (solar panel) and consummation. interval is set to 10s today. I'll change it to 1s

Do you think I shall use debounce option ? It's open collector S0+/S0- from energy counter.

In my case, Time is becoming really big (1750) and Total=12390, despite the fact I've pulses every few seconds. What the time units ?

On MQTT, I see values are updated every second, so ti seems ok from ESP point of view.

Thomas
Hi Thomas.
i use the pulsecounter for my watermeter which send out 1 pulse(1 liter)
for me that works with an 1 second interval because i get max 1 pulse every 2 seconds

in your case you measure pulses (the same as a blinking led) from your energy meter which basically does the same thing.
if you only want to calculate the usage then 1 second is fine.

you measure with an open collector and assuming this has a digital output(not mechanical) there should not be any jitter.
however using a debounce time of 100/200ms will not hurt

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 73 guests