Counting (adding) pulses from ESPEASY via MQTT thing

Tags: #<Tag:0x00007faec903a488> #<Tag:0x00007faec903a348> #<Tag:0x00007faec903a118>

Hi @David_Graeff

I have succesfully setup a pulse counter with espeasy. It can send different values via MQTT to my mosquitto broker. Like Total count of pulse or just the one pulse it detects each time. My main problem is that when I have to reboot the espeasy during the day, the total pulse count for that day is gone (I’m measuring my watermeter).

I noticed there is a setting that can operate a Delta value:

I tried setting it to 1. I was hoping that whenever the mqtt client on the espeasy is sending payload 1 to the broker, the OH thing would take the sum of both.

Whenever a pulse is detected this is what is sent:

image

How could I count these pulses in my OH2 thing? I’m using a rule on the espeasy device to have it reboot every night at 0:00h That way a new day starts and I can start counting again.

Like it says, you’d have to send an INCREASE command. Because it is intended for dimmer use, it might top off at 100.

Think I’d send ‘1’ to a number, have a rule that listens for update, increments the master counter.

Ok, you have to send INCREASE and not Increase :slight_smile:

Great, it is working the way I needed.

@David_Graeff is it possible to change the text in the Thing description to capital letters? It is quite confusing at the moment because when you use it like it says, it is not working.

A number/dimmer channel can receive Increase/Decrease commands and computes the target number by adding or subtracting this delta value.

to

A number/dimmer channel can receive INCREASE/DECREASE commands and computes the target number by adding or subtracting this delta value.

Using it like in the description obviously doesn’t work:

[ab.binding.mqtt.generic.ChannelState] - Incoming payload 'Increase' not supported by type 'NumberValue'

You can do that, link at bottom of page
EDIT, no that’s nonsense, I was thinking docs, not PaperUI form. Is it correct in docs?

Does it count beyond 100, out of interest?

Hi @rossko57 @David_Graeff , yes it goes over 100 as it is a NumberValue and not a Dimmer. What I don’t understand is why it gives an extra number after the comma.

[vent.ChannelTriggeredEvent] - mqtt:systemBroker:LocalMosquitto:WM triggered INCREASE
[vent.ItemStateChangedEvent] - WaterMeter_Daily changed from 0 to 1.0
[vent.ChannelTriggeredEvent] - mqtt:systemBroker:LocalMosquitto:WM triggered INCREASE
[vent.ItemStateChangedEvent] - WaterMeter_Daily changed from 1.0 to 2.0

Internally it’s stored as a Bigdecimal type so the value has decimal digits.

Hi @David_Graeff,

Can you explain some other things too? I created a pull request to document the INCREASE/DECREASE command in capital letters. But even if you don’t fill in the Delta value, sending payload INCREASE always counts 1.0 to the current value. From a Dimmer perspective I can understand it but what if you want to count pulses coming from ESPEasy and for example want to count with 0.01 per step. The description says the Delta value also counts for a Numbervalue.

I also discovered a bug whilst experimenting with this:

Is the question, why is the default step size 1? What do you think it should be?

It should be whatever Delta value you fill in the field?
1
2
0,01
0,1

Should all be possible no?

This is the only way to properly count volumetric sizes like m³ or Liters, even temperature.

So you’re saying that field is ignored, then? I’n guessing whatever you call delta in PaperUI corresponds to step :in text config.

That’s the default yes. That’s why you can define the delta value. Every decimal can be used. Just be careful with the decimal point. In a German local than needs to be a comma for example.