home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.78k stars 30.88k forks source link

Reading modbus registers fails with "Exception Response(131, 3, IllegalAddress)" #91682

Closed vbartels closed 1 year ago

vbartels commented 1 year ago

The problem

Readout of modbusregisters ends up with "Exception Response(131, 3, IllegalAddress)". Readout via external tools like QModMaster works as expected. Also tried register +1/-1 with same results. Here the snippet from the documentation of the device: sma_dok And the readout I've done with external tool. qmodmaster

What version of Home Assistant Core has the issue?

2023.4.5

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

Modbus

Link to integration documentation on our website

https://www.home-assistant.io/integrations/modbus/

Diagnostics information

2023-04-19 07:13:32.823 ERROR (SyncWorker_0) [homeassistant.components.modbus.modbus] Pymodbus: SMA Sunny Island: Exception Response(131, 3, IllegalAddress)

Example YAML snippet

modbus:
  - type: tcp
    host: 172.17.172.20
    port: 502
    name: "SMA Sunny Island"
    close_comm_on_error : false
    delay : 2
    retries: 10
    retry_on_empty: true
    sensors:
      - name: SunnyIsland_SoC
        data_type: int32
        input_type: holding
        #swap: word
        slave: 3
        address: 300845
        count: 2
        unit_of_measurement: "%"

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 1 year ago

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!

Code owner commands Code owners of `modbus` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign modbus` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


modbus documentation modbus source (message by IssueLinks)

janiversen commented 1 year ago

you talk about 2 different addresses, you have configured address 131 in HA, and your device tells that is an illegal address.

vbartels commented 1 year ago

I'm sorry - I fiddled around the whole day. I get know that 131 in the log is the adress I'm asking for. But as you can see in the configuration thats not what I've configured. What am I missing here?

edit: I tried with several adresses, i went through the logs of the whole day and never got anything other that 131.

janiversen commented 1 year ago

I was actually too fast in writing, 131 is the exception code, The address difference is that you have configured 300845, but the image you send contains 30845.

vbartels commented 1 year ago

You're right. I stared at this for hours and was very confident that there must be something wrong. It was just a 0. Sorry!