core icon indicating copy to clipboard operation
core copied to clipboard

Modbus - swap option not working

Open newbie31fr opened this issue 2 years ago • 3 comments

The problem

After several check of reading "uint32" with modbus and trying the option SWAP: word , it appears that adding option: swap : word has no effect. Is it implemented ?

=> To be implemented (i hope) or documentation to be corrected Workaround: Using template sensor and swapping HIGH and LOW word

What version of Home Assistant Core has the issue?

Home Assistant 2022.10.4

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

No response

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

- name: RS485 total power sell TEST
      scan_interval:  30
      unit_of_measurement: kWh
      device_class: energy
      state_class: total_increasing
      slave: 1
      address: 0x021E
      count: 2
      input_type: holding
      data_type: uint32      
      scale: 1     
      swap: none

has same effect ( nothing)  than 

    - name: RS485 total power sell TEST
      scan_interval:  30
      unit_of_measurement: kWh
      device_class: energy
      state_class: total_increasing
      slave: 1
      address: 0x021E
      count: 2
      input_type: holding
      data_type: uint32      
      scale: 1     
      swap: word

Anything in the logs that might be useful for us?

no warning in log

Additional information

Home Assistant 2022.10.4 Supervisor 2022.10.0 Operating System 9.2 Interface utilisateur : 20221010.0 - latest

newbie31fr avatar Oct 16 '22 18:10 newbie31fr

Hey there @adamchengtkc, @janiversen, @vzahradnik, mind taking a look at this issue as it has been labeled with an integration (modbus) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)


modbus documentation modbus source (message by IssueLinks)

home-assistant[bot] avatar Oct 16 '22 22:10 home-assistant[bot]

Yes it is implemented and part of the test suite, but let me try to simulate your configuration.

janiversen avatar Oct 17 '22 08:10 janiversen

What type of sensor are you using ? It is a bit hard to guess because your yaml starts with "- name".

janiversen avatar Nov 07 '22 12:11 janiversen

Please have a look at #82308, there we added a test "test_wrap_sensor· where all combinations of wrap are tested and show that wrap is implemented and working.

If you still find it is not working, please run your test with debug log, and provide some logging in your app, that shows the problem.

janiversen avatar Nov 18 '22 08:11 janiversen