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.48k stars 30.7k forks source link

Mobus sensor not available due to communication error #107398

Closed Sesshoumaru-sama closed 10 months ago

Sesshoumaru-sama commented 10 months ago

The problem

Hi

I am reading several values via modbus tcp from my Varta Element 6 device. To have it working I had to set retries on the device to >5 because of communication issues.

Home Assistant Update 2024.1 seems to have retries now fixed set to 3 - which is not enough for my usecase. Please either set to something higher, like 10, or make configurable again (what is the pain in this?)

Thanks

What version of Home Assistant Core has the issue?

core-2024.1.2

What was the last working version of Home Assistant Core?

core-2023.12.4

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

Error in log: Logger: homeassistant.components.modbus.modbus Source: components/modbus/modbus.py:375 Integration: Modbus (documentation, issues) First occurred: 17:26:04 (5 occurrences) Last logged: 17:31:04

Pymodbus: VartaE6: Error: device: 1 address: 1068 -> Modbus Error: [Connection] ModbusTcpClient(192.168.2.5:502): Connection unexpectedly closed 8.034706115722656e-05 seconds into read of 8 bytes without response from slave before it closed connection Pymodbus: VartaE6: Error: device: 1 address: 1068 -> Modbus Error: [Connection] ModbusTcpClient(192.168.2.5:502): Connection unexpectedly closed 4.2438507080078125e-05 seconds into read of 8 bytes without response from slave before it closed connection

Example YAML snippet

- name: VartaE6
  host: 192.168.2.5
  type: tcp
  port: 502
  delay: 2
  timeout: 10
  message_wait_milliseconds: 250
  retry_on_empty: true
  retries: 10
  sensors:
    - name: "VE Battery SOC"
      unique_id: "VE6BSOC"
      data_type: uint16
      unit_of_measurement: "%"
      address: 1068
      slave: 1
      scan_interval: 60
      state_class: measurement
      device_class: battery

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 10 months ago

Hey there @janiversen, 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. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


modbus documentation modbus source (message by IssueLinks)

janiversen commented 10 months ago

The pain is simply that this is moving to the library and away from the integration, to conform with HA rules that transport should be handled outside the integration.

If you that many retries, then you really should locate the problem, e.g. your cabling, so many retries is not normal in the modbus world.

Pull requests are welcome, but apart from that this is not a bug so closing issue.

Sesshoumaru-sama commented 10 months ago

You are funny. What should I do? Dismantel the battery element and look for a cold solder joint? There is no issue in the network, its the crappy firmware from Varta.

transport should be handled outside the integration

What is that even supposed to mean? Modbus is a protocol in my case running over TCP. And what the heck makes it a difference if a value is given as hard corded default over a configuration. Just say no if my issues are of no concern for you instead of throwing bull as me!

janiversen commented 10 months ago

Please remember we are all volunteers so using a tone like you do is not appropriate at all, especially not if you want help.

I politely tried to explain why the parameter is gone, whether or not you understand how our integrations are divided in layers is really not my problem.

Varta is known to have a professional implementation that are used by very large companies, but if you know better then....

janiversen commented 10 months ago

And just a couple of observations: