Description
From https://forum.mysensors.org/topic/10043/water-pulse-meter-value-not-reported-automatically/7
the counter seem to be reset and there is always a zero value reported after the true value. E.g. after creating a few pulses, I get the log:
27027 NM:LOOP:WATER(1):SET t=35 v=0.0190
35086 NM:MSG:SEND(1) t=35 p=0.01
35090 TSF:MSG:SEND,11-11-0-0,s=1,c=1,t=35,pt=7,l=5,sg=0,ft=0,st=OK:0.0190
35098 NM:MSG:SEND(1) t=35 p=0.00
35104 TSF:MSG:SEND,11-11-0-0,s=1,c=1,t=35,pt=7,l=5,sg=0,ft=0,st=OK:0.0000
65099 NM:MSG:SEND(1) t=35 p=0.00
65103 TSF:MSG:SEND,11-11-0-0,s=1,c=1,t=35,pt=7,l=5,sg=0,ft=0,st=OK:0.0000
65112 NM:MSG:SEND(1) t=35 p=0.00
65118 TSF:MSG:SEND,11-11-0-0,s=1,c=1,t=35,pt=7,l=5,sg=0,ft=0,st=OK:0.0000
I've digged a bit in the NodeManager code on my own and is far from certain, but isn't it a problem that reset() is called when the value has been reported by the child (line 199)
If I get it correctly:
When waterSensor calls setValue, it in turn calls setValueNumber which adds the pulse to _total. That's fine.
But when sendValue is called at a later time, both _value and _total are reset to 0 as _value_processingis SUM.So the pulse count will restart from zero.
Wouldn't we want to keep at least _total at its current value, to keep the accumulated number of pulses over time?