Pulse Counter not send state 0 to mqtt

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
acidsubway
Normal user
Posts: 14
Joined: 02 Jan 2021, 16:44

Pulse Counter not send state 0 to mqtt

#1 Post by acidsubway » 05 Jan 2025, 14:58

Hello everyone,

I have several ESPEasy running, now I noticed something because my script in the iobroker no longer worked.
The pulse counter sends the pulses to the iobrooker with mqtt, but it no longer sends the zero when counting.
What could be the reason for this? In the past it only sent 1, 0, 4, 0, 1, 1, 2, 0, as an example, and also shows the 0 in the webif.
Now it no longer sends the zero but only 1, 4, 1, 1, 2 as an example. What am I doing wrong?
When it is restarted, it sends the initial counter 0 and is also written in the iobroker.

please help :>
Attachments
TW
TW
2025-01-05 14_43_24-WaterJet.png (32.09 KiB) Viewed 4864 times
TW2
TW2
2025-01-05 14_43_55-WaterJet.png (29.36 KiB) Viewed 4864 times
TW3
TW3
2025-01-05 14_44_17-.png (25.9 KiB) Viewed 4864 times

User avatar
Ath
Normal user
Posts: 4330
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Pulse Counter not send state 0 to mqtt

#2 Post by Ath » 05 Jan 2025, 15:08

Hm, possibly there's some unexpected data in the setting for "Ignore multiple Delta = 0".
What exact ESP8266 build are you running?, so I can upload a test-build here.
/Ton (PayPal.me)

acidsubway
Normal user
Posts: 14
Joined: 02 Jan 2021, 16:44

Re: Pulse Counter not send state 0 to mqtt

#3 Post by acidsubway » 05 Jan 2025, 15:11

Build: ESP_Easy_mega_20241222_normal_ESP8266_4M1M Dec 22 2024

always the latest :)

User avatar
Ath
Normal user
Posts: 4330
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Pulse Counter not send state 0 to mqtt

#4 Post by Ath » 05 Jan 2025, 15:31

Here's a testbuild that you can upgrade via Update Firmware on the Tools page:
ESP_Easy_mega_20250105_normal_ESP8266_4M1M.zip
(1.29 MiB) Downloaded 156 times
/Ton (PayPal.me)

acidsubway
Normal user
Posts: 14
Joined: 02 Jan 2021, 16:44

Re: Pulse Counter not send state 0 to mqtt

#5 Post by acidsubway » 05 Jan 2025, 15:41

I have installed it, but it is still the same, only on reboot the state 0 was sent.

User avatar
Ath
Normal user
Posts: 4330
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Pulse Counter not send state 0 to mqtt

#6 Post by Ath » 05 Jan 2025, 16:29

Hm, that's somewhat unexpected :?

Can you enable the "Ignore multiple Delta = 0" checkbox, save the page (Submit button), then uncheck that setting and save again? This could change the behavior.
/Ton (PayPal.me)

acidsubway
Normal user
Posts: 14
Joined: 02 Jan 2021, 16:44

Re: Pulse Counter not send state 0 to mqtt

#7 Post by acidsubway » 05 Jan 2025, 16:54

nothing changes, no 0s are sent.
:>

User avatar
Ath
Normal user
Posts: 4330
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Pulse Counter not send state 0 to mqtt

#8 Post by Ath » 05 Jan 2025, 16:59

Does that checkbox get saved properly? I.e. is it still checked after closing the page and re-entering the settings?
/Ton (PayPal.me)

User avatar
Ath
Normal user
Posts: 4330
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Pulse Counter not send state 0 to mqtt

#9 Post by Ath » 05 Jan 2025, 17:24

Ah, now I see the issue.
Your "Liter_in_der_Minunte" value is showing "inf" (infinite), which is not numeric (invalid), and MQTT controllers don't send any data if one of the values is invalid (either "inf" or "NAN").
/Ton (PayPal.me)

acidsubway
Normal user
Posts: 14
Joined: 02 Jan 2021, 16:44

Re: Pulse Counter not send state 0 to mqtt

#10 Post by acidsubway » 05 Jan 2025, 18:52

Oh yes, because I am calculating the flow rate, I have a formula in here [1/(%value%/1000)*60]
How can I solve this?

User avatar
Ath
Normal user
Posts: 4330
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Pulse Counter not send state 0 to mqtt

#11 Post by Ath » 05 Jan 2025, 19:31

acidsubway wrote: 05 Jan 2025, 18:52 Oh yes, because I am calculating the flow rate, I have a formula in here [1/(%value%/1000)*60]
How can I solve this?
I've tried adding a compensation factor after the 0-division that seems to fix it, but I'm not sure if it might cause too much deviation:

Code: Select all

1/((%value%/1000)+100000)*60
This 100000 offset-factor is based on having 2 decimal places. When having 3 decimal places, the factor should be 1000000, the rounding will get rid of that offset.
/Ton (PayPal.me)

acidsubway
Normal user
Posts: 14
Joined: 02 Jan 2021, 16:44

Re: Pulse Counter not send state 0 to mqtt

#12 Post by acidsubway » 05 Jan 2025, 19:58

the formula doesn't work for me, it always says zero, but you were right, if i take it out it sends the zero :) Too bad it doesn't just send zero at zero time, no matter what formula is there

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

Re: Pulse Counter not send state 0 to mqtt

#13 Post by TD-er » 05 Jan 2025, 21:22

Well you are trying to do a 1/0 operation.
This is undefined.

Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests