#Esphome/HA ignore rounding/decimal accuracy setting

1 messages · Page 1 of 1 (latest)

little ridge
#

Hi,

I am trying to add a pulse counter to an esphome device but the outputs all have the wrong accuracy/decimals which makes it weird to work with the data in HA.
This is the config:

sensor:
- platform: pulse_counter
    update_interval: 1s
    pin:
      number: 3
      inverted: true
      mode:
        input: true
        pullup: true
    unit_of_measurement: 'ml/s'
    name: 'Flow'
    id: flow
    filters:
      - lambda: return x/0.33;  # (330/1000 pulses per ml)
      - round: 0
      - delta: 1
    accuracy_decimals: 0
    total:
      unit_of_measurement: 'l'
      name: 'Total Flow'
      id: total_flow
      filters:
        - lambda: return x/330;
        - round: 1
        - delta: 0.1
      accuracy_decimals: 1

As you can see i round the ml/s to no decimals and i set accuracy to 0 and the total i round to 0.1 and set the accuracy to 1
In ha however i get:
0.00 ml/s instead of 0 ml/s
and
0 l instead of 0.0l
neither of them are correct?
How can i fix this?

Thanks!