Page 1 of 1
Auto discovery of pulses
Posted: Saturday 02 August 2025 13:58
by mcipjvw
Hey there,
I have a MQTT auto discovery sensor system. Works well for the common sensors.
But....
I have a machine now rotating 5 /min with a pulse counter attached, so 5 pulses/min if it is rotating. When I announce the sensor to domoticz as "counter", it indeed creates the counter sensor, but with kWh unit. How can I configure the counter without dimension?
I have c++ code like this:
mqttcfg["name"] = "Count sensor";
mqttcfg["uniq_id"] = uniq_id;
mqttcfg["component_type"] = "sensor";
mqttcfg["icon"] = "pulse";
mqttcfg["unit_of_measurement"] = "counter";
mqttcfg["val_tpl"] = "{{value_json.cntr}}";
mqttcfg["stat_t"] = statetopic.c_str();
Any suggestions? Thanks!
BR Martin
Re: Auto discovery of pulses
Posted: Saturday 02 August 2025 14:25
by waltervl
There is no pulse counter device in Domoticz other the the S0 energy meter. But i do not think that can be created from MQTT Auto discovery.
If you want to count pulses you have to create some custom sensor or incremental counter
https://wiki.domoticz.com/Dummy_for_vir ... ncremental
If you only want to monitor if the device is rotating you better have your hardware measuring the 5 rpm and send a regular ON if rpm >= 5 and OFF when < 5 by MQTT to a Domoticz switch.
Re: Auto discovery of pulses
Posted: Saturday 02 August 2025 14:37
by gizmocuz
Maybe not a 100% answer, but this is how I created a watermeter that works with pulses that works with MQTT-AD
https://github.com/gizmocuz/esp_proximity_sensor_mqtt
Re: Auto discovery of pulses
Posted: Monday 04 August 2025 15:53
by mcipjvw
Thanks guys. I think I will announce the pulse sensor for now as 'on' / 'off' switch. Right now I want to know whether the thing is rotating or not, but would be nice to have some more MQTT configuration possibilities, e.g. to set it to type=' custom' immediately.
BR Martin
Re: Auto discovery of pulses
Posted: Monday 04 August 2025 17:17
by gizmocuz
You see the configuration at the bottom of my arduino code in the link above
Re: Auto discovery of pulses
Posted: Wednesday 06 August 2025 12:30
by mcipjvw
Thanks! I looked at your code.
The MQTT configuration and sensor anouncement was already working. It is just that the 'Counter Type' must be set to 'Custom' manually in domoticz when you want the counter to be dimension less. It would be nice to do this inside the MQTT configuration.
But, once set to 'Custom', it is working as expected: daily pulses in a graph.
The device info structure is nice, but is domoticz doing something with this?
Re: Auto discovery of pulses
Posted: Friday 08 August 2025 7:27
by gizmocuz
Yep, make sure you also send
Code: Select all
autoconfPayload["icon"] = "mdi:counter-inc"; //incremental counter
This will let Domoticz create a device with the following type
devType = pTypeGeneral;
subType = sTypeCounterIncremental;
instead of
devType = pTypeRFXMeter;
subType = sTypeRFXMeterCount;
Re: Auto discovery of pulses
Posted: Saturday 13 September 2025 11:59
by mcipjvw
Hi gizmocuz,
Some time ago, but thanks for your support.
What is Domoticz doing with the device info, like "sw-version" and "manufacturer" ?
BR Martin