I am trying to get “Total pulses counter” - additional sensor with value that would add pulses reported every 60s
I tried what @OttoWinter suggested in one of issues on github.
Problem is I’m getting ‘unknown value’ in Hass.io all the time
Could anyone help me solve this?
Any help/ideas apreciated
I had exactly the same problem when I was trying to get a pulse counter working a few weeks ago and it was maddening. I spent tons of time down in the C++ code trying to debug it there, only to get “unavailable” in my Hass.io instance for my template sensor and the expected value for the sensor itself. I could return the count, the total, and other numbers, but as soon as I tried to perform a math operation on the state, it would turn into “unavailable”. I’m trying to remember exactly what the problem was and I’m failing so far.
One thing that I discovered is that the underlying C++ code only maintains a count of pulses since the last time the raw count was read, resetting it each time. I thought that it was keeping a running counter, so when I tried to add additional reads and prints in the lambda function, I would get values that made no sense. I think that may have been related the weird Hass behavior.
There is nothing in the logs … Or I’m looking in wrong places:
ESPHome node logs show only information about pulse readings (30 pulses/min) and what is sent to Hass.io (280W) … But when for test I changed lambda to just adding 1 on every cycle, it worked - showed up in Hass.io, but wasn’t visible in logs.
In Hass.io logs I don’t see any references to this sensor.
I kept it for the night and it wasn’t updated once…
Looks like this is working
Thank you very much.
It can be also achieved on Hassio side (integration sensor component) but I needed a counter on ESP side in case there is no connection to Hassio
Can this work with water L instead of energy W?
I’m trying to get a daily water total in litres from a pulse counter and ESPhome but not having much success so far.
the pulse sensor will always give you the counts in a period of time, e.g. liters per hour, during the last hour, so if you want to have the liters ever since you’ve opened the faucet you have to integrate the sensor, unfortunately the integration sensor is buggy on 1.13 but you can use the template filter as is there on the first post in order to integrate it.