Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modbus sensor fails to read 64-bit register correctly #25671

Closed
tomilehto opened this issue Aug 3, 2019 · 0 comments · Fixed by #25672
Closed

Modbus sensor fails to read 64-bit register correctly #25671

tomilehto opened this issue Aug 3, 2019 · 0 comments · Fixed by #25672

Comments

@tomilehto
Copy link
Contributor

Home Assistant release with the issue:
0.96.0

Last working Home Assistant release (if known):

Operating environment (Hass.io/Docker/Windows/etc.):
Docker

Component/platform:
https://www.home-assistant.io/components/sensor.modbus/

Description of problem:
When reading four 16-bit modbus registers as a sensor value,
slave output is stored first as 64-bit integer, but before returning
that value is converted to double precision floating point. This
causes loss of precision for integer values bigger than 2^53.

Conversion to floating point is done because of scale, offset
and precision support. Conversion is done even if scale and offset
are configured as integer values and precision set to zero.

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

sensor:
  - platform: modbus
    registers:
      - name: nilan_date
        slave: 1
        register: 4722
        register_type: holding
        count: 4
        data_type: uint

Traceback (if applicable):


Additional information:
I'll make a PR for the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants