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
71.74k stars 29.99k forks source link

Modbus USB dongle has stopped working after version 2023.02 #89131

Closed enc1976 closed 1 year ago

enc1976 commented 1 year ago

The problem

I have a usb dongle for Modbus communication. I am running HassOS through virtuabox.

Up to version 2023.01 the dongle has been working well. If I upgrade to 2023.02 or 2023.03 it stops working. Downgrading again to 2022.01 fixes the issue.

Many thanks.

Home Assistant 2023.1.4 Supervisor 2023.01.1 Operating System 9.5 Frontend 20230110.0 - latest

What version of Home Assistant Core has the issue?

2023.02

What was the last working version of Home Assistant Core?

2023.01

What type of installation are you running?

Home Assistant OS

Integration causing the issue

modbus

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

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

Please provide a debug log, as pr documentation. Without a debug log, we have no way of helping you pinpoint the issue.

enc1976 commented 1 year ago

Hi Jan!. Many thanks for your response. As I am not familiar with the process, what exactly should I do? I have enabled logger at default level and I will export that (I guess this is what is wanted). Do I post it here? Can the log file contain sensitive data that should not be posted? Many thanks

janiversen commented 1 year ago

Please read the documentation for the modbus integration in homeassistant.io, that details what needs to be done. You can post it here. Potentially the log can contain sensitive data, depending on your level of sensitivity.

enc1976 commented 1 year ago

home-assistant_2023-03-05T15-49-51.191Z.log

Hi Jan, thanks for the quick response. Please see attached the log file. This is also the main modbus config:

enc1976 commented 1 year ago

Screenshot 2023-03-05 175831

In case it is useful, I am also attaching a picture from the response I get when I unmount the USB through the menu. I am not getting any message when mounting it. In both cases I am getting the something connected on the USB sound.

janiversen commented 1 year ago

First of all, you have custom_components installed, these might interfere, which is why we want them deactivated when you submit a bug report (log).

The modbus integration connects to your usb, but when sending a request your device do not respond. This could indicate that some other component/program have taken the control.

You use method=ascii, which is fairly unusual, but allowed.

Apart from that I cannot tell you what the problem is. 2023.02 did introduce use of a new version of the library, which are known to cause problems for some custom_components (at least until they/you upgrade).

enc1976 commented 1 year ago

Hi Jan, many thanks for your feedback. The other integrations do not seem to be related to modbus and unless they can pull config data from the general configuration they should not be able to connect anyway.

I guess the new library is breaking also the modbus integration for some instances? things work fine in 2023.01 but not thereafter. Is there anything else to do on my side to help detect the problem?

janiversen commented 1 year ago

It does not seem to be a general problem, I have a working USB. Maybe you need to activate some of the available parameters.

elupus commented 1 year ago

There has been reports on rfxtrx issues after this version too. Could be coincidental.

janiversen commented 1 year ago

Could be, it looks as if something changes at a lower level (hassio). I cannot reproduce the problem here, but my setup is probably not similar to a standard setup.

elupus commented 1 year ago

That is what is weird though, since i dont think OS was updated. Maybe supervisor. I often seen ZHA failing (could not open serial port) on restart off full system, while it comes up fine on retry. That is not new though, so should not be related.

janiversen commented 1 year ago

@elupus, something have happened, I just went through the log of one of my production servers, and I see errors from both pymodbus and aiohttp stating "network unreachable". If I just restart HA it stops, but if I reboot the raspberry it comes back.

I currently have no idea if any of this is related, but at least it is a bit strange.

The devices are on Wifi and the raspberry is connected via cable to the same router....Just thinking loud, could it have something to do with the (relative) new security (not allowing networks). When pymodbus connect to the USB it does so using a unix domain socket.

ludovic-steinbach commented 1 year ago

I have a similar issue:

Source: components/modbus/modbus.py:396
Integration: Modbus (documentation, issues)
First occurred: 11:18:12 (1 occurrences)
Last logged: 11:18:12

Pymodbus: hub1: Modbus Error: [Input/Output] Modbus Error: [Invalid Message] No response received, expected at least 4 bytes (0 received)
Logger: homeassistant.core
Source: core.py:337
First occurred: 11:23:24 (1 occurrences)
Last logged: 11:23:24

Something is blocking Home Assistant from wrapping up the start up phase. We're going to continue anyway. Please report the following info at https://github.com/home-assistant/core/issues: counter, sensor.zha, climate.zha, diagnostics, map, switch.rfxtrx, freebox, siren.rfxtrx, system_log, hassio, number.zha, input_boolean, notify, switch.shelly, history, alarm_control_panel, alarm_control_panel.zha, mobile_app, frontend, http, trace, update.hassio, sensor.esphome, system_health, update.shelly, select, sensor.energy, analytics, weather, samsungtv, shelly, sensor.history_stats, binary_sensor.zha, media_player, fan, blueprint, binary_sensor.hassio, energy, influxdb, sun, button, weather.met, siren, network, rpi_power, sensor.template, fan.zha, homeassistant, lock, input_button, button.esphome, file_upload, media_source, input_select, modbus, timer, default_config, image_upload, climate, person, hardware, input_text, cover.rfxtrx, conversation, sensor.systemmonitor, binary_sensor.rpi_power, zeroconf, lock.zha, sensor.rfxtrx, binary_sensor, light.shelly, sensor, my, notify.mobile_app, tag, scene, update, light, tts.google_translate, auth, automation, select.zha, cert_expiry, sensor.hassio, siren.zha, switch.zha, media_player.samsungtv, cover.shelly, waze_travel_time, sensor.waze_travel_time, api, onboarding, input_number, device_tracker, dlna_dms, sensor.modbus, websocket_api, usb, search, binary_sensor.template, recorder, config, template, rfxtrx, binary_sensor.shelly, sensor.time_date, application_credentials, logbook, schedule, lovelace, number, sensor.mobile_app, webhook, light.rfxtrx, raspberry_pi, met, persistent_notification, cloud, sensor.shelly, button.freebox, device_tracker.freebox, light.zha, tts, binary_sensor.mobile_app, repairs, dhcp, button.shelly, stream, device_automation, scene.homeassistant, group, media_player.cast, zone, sensor.freebox, device_tracker.mobile_app, cover.zha, esphome, device_tracker.zha, bluetooth, input_datetime, zha, homeassistant_alerts, switch.freebox, switch, logger, cast, button.zha, switch.esphome, script, ssdp, binary_sensor.rfxtrx, cover

I don't have any custom components. I'm running HA on a Raspberry with HA OS. Everything works fine on 2023.1, and on 2023.2 or 2023.3 the "hub1" does not work.

Config:

modbus:
  - name: brink
    type: serial
    method: rtu
    port: /dev/serial/by-id/usb-1a86_USB2.0-Ser_-if00-port0
    baudrate: 4800
    stopbits: 1
    bytesize: 8
    parity: E
    delay: 0.5
    close_comm_on_error: true 
    sensors:
        ....
  - name: hub1
    type: serial
    method: ascii
    port: /dev/serial/by-id/usb-Microchip_Technology_Inc._SELTRON_HEATING_CONTROLLER-if00
    baudrate: 9600
    stopbits: 1
    bytesize: 7
    parity: E
    delay: 2
    sensors:

Full debug logs after a restart:

2023-03-08 11:40:21.698 WARNING (SyncWorker_0) [homeassistant.util.yaml.loader] YAML file /config/configuration.yaml contains duplicate key "name". Check lines 43 and 54
2023-03-08 11:40:21.698 WARNING (SyncWorker_0) [homeassistant.util.yaml.loader] YAML file /config/configuration.yaml contains duplicate key "address". Check lines 46 and 55
2023-03-08 11:40:21.698 WARNING (SyncWorker_0) [homeassistant.util.yaml.loader] YAML file /config/configuration.yaml contains duplicate key "name". Check lines 43 and 57
2023-03-08 11:40:21.698 WARNING (SyncWorker_0) [homeassistant.util.yaml.loader] YAML file /config/configuration.yaml contains duplicate key "address". Check lines 46 and 58
2023-03-08 11:40:21.699 WARNING (SyncWorker_0) [homeassistant.util.yaml.loader] YAML file /config/configuration.yaml contains duplicate key "name". Check lines 43 and 61
2023-03-08 11:40:21.699 WARNING (SyncWorker_0) [homeassistant.util.yaml.loader] YAML file /config/configuration.yaml contains duplicate key "address". Check lines 46 and 62
2023-03-08 11:40:21.699 WARNING (SyncWorker_0) [homeassistant.util.yaml.loader] YAML file /config/configuration.yaml contains duplicate key "unit_of_measurement". Check lines 44 and 63
2023-03-08 11:40:21.699 WARNING (SyncWorker_0) [homeassistant.util.yaml.loader] YAML file /config/configuration.yaml contains duplicate key "device_class". Check lines 50 and 64
2023-03-08 11:40:21.699 WARNING (SyncWorker_0) [homeassistant.util.yaml.loader] YAML file /config/configuration.yaml contains duplicate key "data_type". Check lines 51 and 65
2023-03-08 11:40:21.699 WARNING (SyncWorker_0) [homeassistant.util.yaml.loader] YAML file /config/configuration.yaml contains duplicate key "name". Check lines 43 and 61
2023-03-08 11:40:21.699 WARNING (SyncWorker_0) [homeassistant.util.yaml.loader] YAML file /config/configuration.yaml contains duplicate key "address". Check lines 46 and 62
2023-03-08 11:40:21.699 WARNING (SyncWorker_0) [homeassistant.util.yaml.loader] YAML file /config/configuration.yaml contains duplicate key "unit_of_measurement". Check lines 44 and 63
2023-03-08 11:40:21.700 WARNING (SyncWorker_0) [homeassistant.util.yaml.loader] YAML file /config/configuration.yaml contains duplicate key "device_class". Check lines 50 and 64
2023-03-08 11:40:21.700 WARNING (SyncWorker_0) [homeassistant.util.yaml.loader] YAML file /config/configuration.yaml contains duplicate key "data_type". Check lines 51 and 65
2023-03-08 11:40:21.700 WARNING (SyncWorker_0) [homeassistant.util.yaml.loader] YAML file /config/configuration.yaml contains duplicate key "name". Check lines 61 and 67
2023-03-08 11:40:21.700 WARNING (SyncWorker_0) [homeassistant.util.yaml.loader] YAML file /config/configuration.yaml contains duplicate key "address". Check lines 62 and 68
2023-03-08 11:40:21.702 WARNING (SyncWorker_0) [homeassistant.util.yaml.loader] YAML file /config/configuration.yaml contains duplicate key "name". Check lines 134 and 142
2023-03-08 11:40:21.702 WARNING (SyncWorker_0) [homeassistant.util.yaml.loader] YAML file /config/configuration.yaml contains duplicate key "address". Check lines 137 and 143
2023-03-08 11:40:21.702 WARNING (SyncWorker_0) [homeassistant.util.yaml.loader] YAML file /config/configuration.yaml contains duplicate key "name". Check lines 134 and 145
2023-03-08 11:40:21.702 WARNING (SyncWorker_0) [homeassistant.util.yaml.loader] YAML file /config/configuration.yaml contains duplicate key "address". Check lines 137 and 146
2023-03-08 11:40:21.702 WARNING (SyncWorker_0) [homeassistant.util.yaml.loader] YAML file /config/configuration.yaml contains duplicate key "name". Check lines 134 and 148
2023-03-08 11:40:21.703 WARNING (SyncWorker_0) [homeassistant.util.yaml.loader] YAML file /config/configuration.yaml contains duplicate key "address". Check lines 137 and 149
2023-03-08 11:40:36.186 ERROR (MainThread) [homeassistant.components.automation] Blueprint 'Wake-up light alarm with sunrise effect' generated invalid automation with inputs OrderedDict([('light_entity', 'light.extended_color_light_9'), ('manual_time', '08:00:00'), ('sunrise_duration', 15), ('min_mired', 255), ('pre_sunrise_actions', [OrderedDict([('device_id', ''), ('domain', ''), ('entity_id', '')])])]): Integration '' not found
2023-03-08 11:40:37.705 INFO (SyncWorker_2) [homeassistant.components.modbus.modbus] modbus hub1 communication open
2023-03-08 11:40:37.725 INFO (SyncWorker_1) [homeassistant.components.modbus.modbus] modbus brink communication open
2023-03-08 11:40:45.112 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template("{{states('sensor.35') | int in [1, 3, 5, 7]}}")
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 458, in async_render
    render_result = _render_with_context(self.template, compiled, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2007, in _render_with_context
    return template.render(**kwargs)
  File "/usr/local/lib/python3.10/site-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.10/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 1, in top-level template code
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1790, in forgiving_int_filter
    raise_no_default("int", value)
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1472, in raise_no_default
    raise ValueError(
ValueError: Template error: int got invalid input 'unavailable' when rendering template '{{states('sensor.35') | int in [1, 3, 5, 7]}}' but no default was specified

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 576, in async_render_to_info
    render_info._result = self.async_render(variables, strict=strict, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 460, in async_render
    raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: ValueError: Template error: int got invalid input 'unavailable' when rendering template '{{states('sensor.35') | int in [1, 3, 5, 7]}}' but no default was specified
2023-03-08 11:40:45.119 ERROR (MainThread) [homeassistant.helpers.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{{states('sensor.35') | int in [1, 3, 5, 7]}}' but no default was specified') while processing template 'Template("{{states('sensor.35') | int in [1, 3, 5, 7]}}")' for attribute '_state' in entity 'binary_sensor.oeg_r1'
2023-03-08 11:40:45.126 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template("{{states('sensor.35') | int in [2, 3, 6, 7]}}")
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 458, in async_render
    render_result = _render_with_context(self.template, compiled, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2007, in _render_with_context
    return template.render(**kwargs)
  File "/usr/local/lib/python3.10/site-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.10/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 1, in top-level template code
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1790, in forgiving_int_filter
    raise_no_default("int", value)
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1472, in raise_no_default
    raise ValueError(
ValueError: Template error: int got invalid input 'unavailable' when rendering template '{{states('sensor.35') | int in [2, 3, 6, 7]}}' but no default was specified

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 576, in async_render_to_info
    render_info._result = self.async_render(variables, strict=strict, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 460, in async_render
    raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: ValueError: Template error: int got invalid input 'unavailable' when rendering template '{{states('sensor.35') | int in [2, 3, 6, 7]}}' but no default was specified
2023-03-08 11:40:45.130 ERROR (MainThread) [homeassistant.helpers.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{{states('sensor.35') | int in [2, 3, 6, 7]}}' but no default was specified') while processing template 'Template("{{states('sensor.35') | int in [2, 3, 6, 7]}}")' for attribute '_state' in entity 'binary_sensor.oeg_r2'
2023-03-08 11:40:45.134 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template("{{states('sensor.35') | int in [4, 5, 6, 7]}}")
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 458, in async_render
    render_result = _render_with_context(self.template, compiled, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2007, in _render_with_context
    return template.render(**kwargs)
  File "/usr/local/lib/python3.10/site-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.10/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 1, in top-level template code
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1790, in forgiving_int_filter
    raise_no_default("int", value)
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1472, in raise_no_default
    raise ValueError(
ValueError: Template error: int got invalid input 'unavailable' when rendering template '{{states('sensor.35') | int in [4, 5, 6, 7]}}' but no default was specified

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 576, in async_render_to_info
    render_info._result = self.async_render(variables, strict=strict, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 460, in async_render
    raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: ValueError: Template error: int got invalid input 'unavailable' when rendering template '{{states('sensor.35') | int in [4, 5, 6, 7]}}' but no default was specified
2023-03-08 11:40:45.137 ERROR (MainThread) [homeassistant.helpers.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{{states('sensor.35') | int in [4, 5, 6, 7]}}' but no default was specified') while processing template 'Template("{{states('sensor.35') | int in [4, 5, 6, 7]}}")' for attribute '_state' in entity 'binary_sensor.oeg_r3'
2023-03-08 11:40:45.151 WARNING (MainThread) [homeassistant.components.sensor] Sensor sensor.oeg_r2_intensity has device class None, state class None and unit % thus indicating it has a numeric value; however, it has the non-numeric value:  (<class 'str'>); Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+template%22
2023-03-08 11:40:45.156 WARNING (MainThread) [homeassistant.components.sensor] Sensor sensor.oeg_r3_intensity has device class None, state class None and unit % thus indicating it has a numeric value; however, it has the non-numeric value:  (<class 'str'>); Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+template%22
2023-03-08 11:40:58.866 ERROR (SyncWorker_6) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] Modbus Error: [Invalid Message] No response received, expected at least 4 bytes (0 received)
2023-03-08 11:41:04.934 DEBUG (SyncWorker_2) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-08 11:41:11.004 DEBUG (SyncWorker_4) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-08 11:41:17.065 DEBUG (SyncWorker_2) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-08 11:41:23.123 DEBUG (SyncWorker_3) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-08 11:41:27.164 WARNING (MainThread) [homeassistant.components.zha.core.channels.base] [0x525E:11:0x0006]: async_initialize: all attempts have failed: [DeliveryError('Failed to deliver packet: <TXStatus.NWK_ROUTE_DISCOVERY_FAILED: 208>'), DeliveryError('Failed to deliver packet: <TXStatus.NWK_ROUTE_DISCOVERY_FAILED: 208>'), DeliveryError('Failed to deliver packet: <TXStatus.NWK_ROUTE_DISCOVERY_FAILED: 208>'), DeliveryError('Failed to deliver packet: <TXStatus.NWK_ROUTE_DISCOVERY_FAILED: 208>')]
2023-03-08 11:41:29.179 DEBUG (SyncWorker_6) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-08 11:41:35.235 DEBUG (SyncWorker_2) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-08 11:41:41.289 DEBUG (SyncWorker_3) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-08 11:41:47.355 DEBUG (SyncWorker_5) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-08 11:41:53.415 DEBUG (SyncWorker_0) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-08 11:41:59.468 DEBUG (SyncWorker_6) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-08 11:42:05.522 DEBUG (SyncWorker_5) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-08 11:42:11.576 DEBUG (SyncWorker_6) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-08 11:42:17.630 DEBUG (SyncWorker_5) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-08 11:42:23.686 DEBUG (SyncWorker_0) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-08 11:42:29.740 DEBUG (SyncWorker_1) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-08 11:42:35.802 DEBUG (SyncWorker_2) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-08 11:42:41.860 DEBUG (SyncWorker_0) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-08 11:42:47.919 DEBUG (SyncWorker_2) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-08 11:42:53.977 DEBUG (SyncWorker_3) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-08 11:43:00.029 DEBUG (SyncWorker_1) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-08 11:43:06.081 DEBUG (SyncWorker_2) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-08 11:43:12.139 DEBUG (SyncWorker_3) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response

No problems with RFXTRX on my side

ludovic-steinbach commented 1 year ago

I've tried commenting out "hub1" -> all works fine. It's also using method = ascii, which you noted was unusual

janiversen commented 1 year ago

Changing methods only makes sense if modbus gets data but cannot interpret them.

A couple of observations:

Also please make sure the id have not changed with the new version.

ludovic-steinbach commented 1 year ago

Thanks for your help.

I've had to revert back as I need HA to work for now, but I'll try your recommendations asap

janiversen commented 1 year ago

please try with 2023.3.2 I just heard learned it solves a number of core problems.

enc1976 commented 1 year ago

Hi and many thanks. Did try 2023.3.3 but the problem persists. Had to roll back.

janiversen commented 1 year ago

Did you try the options as I asked earlier.

Have you solved your configuration.yaml errors.

ludovic-steinbach commented 1 year ago

I fixed all configuration errors (all templates failing due to modbus not working) and updated to 2023.3.3: still the same issue.

I have tried commenting out my 'brink' hub, it did not help. The ascii hub still does not work.

The device ID for the hub that does not work is still correct. Replaced it with the device path, no improvement.

janiversen commented 1 year ago

Submit a log without configuration.yaml errors, then I will look at it.

ludovic-steinbach commented 1 year ago
2023-03-13 22:11:27.463 INFO (SyncWorker_4) [homeassistant.components.modbus.modbus] modbus hub1 communication open
2023-03-13 22:11:27.473 INFO (SyncWorker_1) [homeassistant.components.modbus.modbus] modbus brink communication open
2023-03-13 22:11:37.277 ERROR (SyncWorker_1) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] Modbus Error: [Invalid Message] No response received, expected at least 4 bytes (0 received)
2023-03-13 22:11:37.285 ERROR (SyncWorker_5) [homeassistant.components.modbus.modbus] Pymodbus: brink: Modbus Error: [Input/Output] Modbus Error: [Invalid Message] No response received, expected at least 4 bytes (0 received)
2023-03-13 22:11:43.344 DEBUG (SyncWorker_4) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:11:49.404 DEBUG (SyncWorker_5) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:11:55.460 DEBUG (SyncWorker_6) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:12:01.522 DEBUG (SyncWorker_0) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:12:07.583 DEBUG (SyncWorker_2) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:12:13.645 DEBUG (SyncWorker_3) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:12:19.707 DEBUG (SyncWorker_5) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:12:21.874 WARNING (MainThread) [homeassistant.components.zha.core.channels.base] [0x525E:11:0x0006]: async_initialize: all attempts have failed: [DeliveryError('Failed to deliver packet: <TXStatus.NWK_ROUTE_DISCOVERY_FAILED: 208>'), DeliveryError('Failed to deliver packet: <TXStatus.NWK_ROUTE_DISCOVERY_FAILED: 208>'), DeliveryError('Failed to deliver packet: <TXStatus.NWK_ROUTE_DISCOVERY_FAILED: 208>'), DeliveryError('Failed to deliver packet: <TXStatus.NWK_ROUTE_DISCOVERY_FAILED: 208>')]
2023-03-13 22:12:25.771 DEBUG (SyncWorker_0) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:12:31.831 DEBUG (SyncWorker_1) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:12:37.893 DEBUG (SyncWorker_7) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:12:43.953 DEBUG (SyncWorker_4) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:12:50.009 DEBUG (SyncWorker_2) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:12:56.062 DEBUG (SyncWorker_6) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:13:02.120 DEBUG (SyncWorker_1) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:13:08.182 DEBUG (SyncWorker_0) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:13:14.236 DEBUG (SyncWorker_7) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:13:20.300 DEBUG (SyncWorker_5) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:13:26.357 DEBUG (SyncWorker_4) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:13:32.414 DEBUG (SyncWorker_2) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:13:38.473 DEBUG (SyncWorker_6) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:13:44.537 DEBUG (SyncWorker_1) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:13:50.595 DEBUG (SyncWorker_3) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:13:56.655 DEBUG (SyncWorker_7) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:14:02.709 DEBUG (SyncWorker_2) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:14:08.760 DEBUG (SyncWorker_0) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:14:14.819 DEBUG (SyncWorker_5) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:14:20.889 DEBUG (SyncWorker_7) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:14:26.950 DEBUG (SyncWorker_2) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:14:33.010 DEBUG (SyncWorker_3) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:14:39.070 DEBUG (SyncWorker_4) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:14:45.132 DEBUG (SyncWorker_1) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:14:51.192 DEBUG (SyncWorker_6) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:14:57.246 DEBUG (SyncWorker_5) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:15:03.301 DEBUG (SyncWorker_3) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:15:09.357 DEBUG (SyncWorker_0) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:15:15.417 DEBUG (SyncWorker_7) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:15:21.477 DEBUG (SyncWorker_2) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:15:27.537 DEBUG (SyncWorker_1) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:15:33.596 DEBUG (SyncWorker_6) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:15:39.658 DEBUG (SyncWorker_4) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:15:45.722 DEBUG (SyncWorker_2) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:15:51.782 DEBUG (SyncWorker_3) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:15:57.840 DEBUG (SyncWorker_7) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:16:03.894 DEBUG (SyncWorker_6) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:16:09.954 DEBUG (SyncWorker_1) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:16:16.014 DEBUG (SyncWorker_2) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:16:22.071 DEBUG (SyncWorker_4) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:16:28.141 DEBUG (SyncWorker_0) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:16:34.197 DEBUG (SyncWorker_3) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:16:36.492 WARNING (MainThread) [homeassistant.bootstrap] Setup timed out for bootstrap - moving forward
2023-03-13 22:16:40.261 DEBUG (SyncWorker_1) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:16:46.325 DEBUG (SyncWorker_2) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:16:51.503 WARNING (MainThread) [homeassistant.core] Something is blocking Home Assistant from wrapping up the start up phase. We're going to continue anyway. Please report the following info at https://github.com/home-assistant/core/issues: sensor.waze_travel_time, button.zha, light.zha, siren.rfxtrx, sensor.hassio, lovelace, rfxtrx, siren, analytics, binary_sensor, input_text, device_tracker.zha, device_tracker.mobile_app, hassio, input_datetime, zha, light, zone, zeroconf, frontend, freebox, system_health, homeassistant, raspberry_pi, tag, select, persistent_notification, button.freebox, trace, usb, recorder, select.zha, number, binary_sensor.template, sensor.freebox, schedule, energy, lock.zha, number.zha, sensor, device_automation, sensor.rfxtrx, button, switch.esphome, cover.shelly, sun, binary_sensor.zha, alarm_control_panel, dhcp, sensor.systemmonitor, climate.zha, stream, scene.homeassistant, binary_sensor.rfxtrx, device_tracker.freebox, sensor.template, logbook, binary_sensor.mobile_app, image_upload, input_button, media_player.samsungtv, sensor.esphome, rpi_power, application_credentials, fan, api, http, light.rfxtrx, modbus, climate, input_number, counter, binary_sensor.shelly, websocket_api, blueprint, cert_expiry, network, system_log, homeassistant_alerts, tts, switch, automation, input_select, timer, weather, binary_sensor.rpi_power, sensor.energy, bluetooth, sensor.zha, weather.met, shelly, met, repairs, mobile_app, button.shelly, update.shelly, siren.zha, alarm_control_panel.zha, light.shelly, sensor.shelly, ssdp, hardware, search, binary_sensor.hassio, switch.freebox, map, button.esphome, default_config, cloud, webhook, notify, history, update.hassio, cover.zha, conversation, group, media_source, samsungtv, config, auth, sensor.history_stats, notify.mobile_app, tts.google_translate, my, script, template, onboarding, input_boolean, cover.rfxtrx, influxdb, sensor.modbus, cover, person, update, logger, dlna_dms, switch.rfxtrx, lock, waze_travel_time, sensor.mobile_app, device_tracker, switch.zha, diagnostics, esphome, sensor.time_date, file_upload, fan.zha, media_player, scene, switch.shelly
2023-03-13 22:16:52.390 DEBUG (SyncWorker_7) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
2023-03-13 22:17:03.869 DEBUG (SyncWorker_4) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
janiversen commented 1 year ago

The problem is the same your USB device delivers 0 bytes.

You wrote that running with brink solo works, did you try to run with hub1 solo ? (to see if the problem is multiple setups)

I assume you have 2 USB dongles one for each ? if not that Is a problem you cannot share a USB device.

Is there a special reason to have 2 USB and not just combine the RS384 wiring (which is the normal way) ?

If hub1 still fails when running solo, then try to switch the cabling between the USB (and of course the port in the configuration).

ludovic-steinbach commented 1 year ago

Yes, hub1 solo still does not work.

brink is connected to a usb dongle (https://www.reichelt.nl/fr/fr/raspberry-pi-interface-usb-rs485-ch340c-rpi-usb-rs485-p242783.html?r=1), wired to a brink ventilation system. hub1 is connected directly to a heating controller with a USB to microUSB cable.

Is there any point in trying to connect directly with a laptop and trying versions of pymodbus (the one from 2023.01 and the one from 2022.02/03)?

janiversen commented 1 year ago

We have often seen problems with USB converters connected via cable, it seems the use more current than the cable permits or at least we see more transmit problems than with directly connected USB.

Cable with USB and micro USB connectors or also known to cause problems, it seems (from personal experience) that the electrical signals are different and thus the driver behaves differently. remark USB to USB-C works.

janiversen commented 1 year ago

If you need extension, then it is preferable to extend the RS485 cabling, which are designed for long distances.

enc1976 commented 1 year ago

I have no extensions or converters and I am facing similar difficulties. I do not think the issue is there, especially when the same hardware is working fine under the previous version.

janiversen commented 1 year ago

Well then provide something to limit the scope of the search. The log I have seen do not suggest that there are a problem with the modbus integration, just that is does not receive any data.

When one USB device is working another is not, it seems more likely to be a problem outside the modbus integration.

I am happy to help if there are a bug in the modbus integration, but without something to help isolate the problem, I simply have no way of helping.

ludovic-steinbach commented 1 year ago

@janiversen I believe this is a bug. I've run tests directly with python, plugging in my ascii modbus device directly to my pc.

From what I can tell, 'method' is passed as an arg to the Modbus client constructor. With pymodbus 2.5.3 (used in HA 2023.01), this successfully sets the framer to the ascii framer With pymodbus 3.1.3 (current version on HA dev), setting the 'method' to ascii does not correctly set the framer, which defaults to RTU and therefore sends an incorrect message.

When working locally, I can fix the issue by setting the 'framer' arg in the client constructor, rather than relying on 'method'.

I can't tell if it's a regression in pymodbus, or just that HA has not been updated accordingly, but I'm pretty sure this is the source of our problems

janiversen commented 1 year ago

Let me have a look on that, I remember there was something changed around framer so you might be right.

Thanks for looking into it.