My electricity counter vs the limited resolution of ESPHome 32 bit floats

My electricity counter has already measured 190 million units. This result does not fit into a 32 bits float: reads jumps hundreds of units on each update, which does not happen every second as it should but only after I have consumed enough electricity to make the change noticeable with the resolution of a 32 bit float.

The counter has 10 years, so switching to a signed 32 bit integer or a double float should give me enough resolution to hold the readings for the remaking of my life.

Is there any plan in ESPHome to support integer or double sensors to improve the accuracy?

Right now I have to pass readings around as text, which makes numeric sensor filters unavailable, requires custom handling everywhere to convert it to/from a number, making things super complex.

I can’t answer your specific question regarding registers in ESPhome but have you looked at the pulse_meter integration:

When used for calculating energy in kWh this creates a “total increasing” sensor which still functions correctly even when the pulse_meter gets reset (e.g. on a reboot) or in the case of a rollover of the counter.

Hope that is helpful.

My electricity counter does not use light pulses but an infrared serial port using some binary protocol that post every second energy consumption as a 64 bit integer in Watts-hour (and more)

Use a global and set its type to double?

globals:
  - id: my_double_value
    type: double
    restore_value: yes
    initial_value: '0.0'

sensor:
  - platform: template
    name: "Double Value"
    lambda: return id(my_double_value);