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 component 2021.5.1 error #50348

Closed
rostislav-palivoda opened this issue May 9, 2021 · 7 comments
Closed

Modbus component 2021.5.1 error #50348

rostislav-palivoda opened this issue May 9, 2021 · 7 comments

Comments

@rostislav-palivoda
Copy link

rostislav-palivoda commented May 9, 2021

The problem

What is version of Home Assistant Core has the issue?

2021.5.1

What was the last working version of Home Assistant Core?

2021.4.6

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/

Example YAML snippet

  • name: modbus_mb10td_01
    slave: 7
    address: 0
    count: 10
    input_type: holding
    data_type: custom
    structure: ">10h"
    scan_interval: 15

Anything in the logs that might be useful for us?

A lot of exceptions after update:

Traceback (most recent call last):
File “/usr/local/lib/python3.8/concurrent/futures/thread.py”, line 57, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/src/homeassistant/homeassistant/components/modbus/sensor.py”, line 232, in
self.hass, lambda arg: self._update(), self._scan_interval
File “/usr/src/homeassistant/homeassistant/components/modbus/sensor.py”, line 300, in _update
registers = self._swap_registers(result.registers)
AttributeError: ‘ModbusIOException’ object has no attribute ‘registers’

Additional information

Caused by https://github.com/home-assistant/core/blame/cbf46328955ef62560295471159414242f8c203c/homeassistant/components/modbus/sensor.py#L298

@probot-home-assistant
Copy link

modbus documentation
modbus source
(message by IssueLinks)

@rostislav-palivoda
Copy link
Author

- name: modbus_mb10td_01
  slave: 7
  address: 0
  count: 10
  input_type: holding
  data_type: custom
  structure: ">10h"
  scan_interval: 15

@rostislav-palivoda
Copy link
Author

I think backward compatibility is broken in 2021.5 and I can not upgrade. If this is the case, then please return ability to request values in bulk - data_type: custom.

Single request per value will not work, i.e. some devices has hundreds of values and in 4.6 it was possible to read all of them in a single request. Single value request approach brings RS485 network to its limits very fast - each request is multiplied by 1) values per device; 2) amount of devices in a network; and limited by 1) baud rate restrictions VS length of the lines 2) frequency of requests in the RS485 network.

@janiversen
Copy link
Member

You can still do multi request with "struct:" the limitation is (as it was in 2021.4.6) 255 bytes in the result string. We did not touch that (as far as I know).

@rostislav-palivoda
Copy link
Author

I've got this error right after migration from 4.6 to 5.1. If mentioned config does not cause described error you can close the ticket.

@janiversen
Copy link
Member

The error have nothing to do with your configuration that looks ok.

closing.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants