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-integration crashes and won't get up again without reboot #85714

Closed
oyta opened this issue Jan 11, 2023 · 11 comments · Fixed by #85961
Closed

Modbus-integration crashes and won't get up again without reboot #85714

oyta opened this issue Jan 11, 2023 · 11 comments · Fixed by #85961
Assignees

Comments

@oyta
Copy link

oyta commented Jan 11, 2023

The problem

I am using the Modbus-integration to communicate with my Systemair VSR500 ventilation system. I have configured several sensor. It crashed while having far less sensors as well, but I am sharing the current config as this crashes every day. The integration stops retrieving the Modbus data and I have not found any other way than restarting the entire HA. This makes it work for another day or so. I have setup debug logging to be able figure out what is wrong. Please see below.

Screenshot 2023-01-11 at 21 16 00

Showing a graph of one of the sensor and the last data point retrieved.

Home Assistant Modbus.log
Additional logs from Home Assistant as it was too long to include in the logs textarea below.

FWIW: Systemair VSR500 Modbus variable reference: https://shop.systemair.com/upload/assets/SAVE_MODBUS_VARIABLE_LIST_20210301_REV36.PDF?58f78dfe

What version of Home Assistant Core has the issue?

Home Assistant 2023.1.2

What was the last working version of Home Assistant Core?

Home Assistant 2023.1.2

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

No response

Example YAML snippet

modbus:
  - name: "VSR500"
    type: tcp
    host: xxxxxxxxxx
    port: 8234
    sensors:
      - name: "VSR_500_Tilluft_vifte" #ok
        unit_of_measurement: "rpm"
        slave: 1
        address: 12400
        scale: 1
        input_type: input
        scan_interval: 30
        unique_id: VSR_500_Tilluft_vifte
      - name: "VSR_500_Ute_temperatur" #ok
        unit_of_measurement: °C
        slave: 1
        device_class: temperature
        address: 12101
        scale: 0.1
        input_type: input
        scan_interval: 60
        data_type: int16
        precision: 1
        unique_id: VSR_500_temperatur_ute
      - name: "VSR_500_Supply_air_temperature" #ok
        unit_of_measurement: °C
        device_class: temperature
        slave: 1
        address: 12102
        scale: 0.1
        input_type: input
        data_type: int16
        precision: 1
        scan_interval: 60
        unique_id: VSR_500_Temperature_Supply_Air
      - name: "VSR_500_User_Mode" #ok
        slave: 1
        address: 1160
        input_type: input
        data_type: int16
        scan_interval: 60
        unique_id: VSR_500_User_mode
      - name: "VSR_500_Temperature_unit" #ok
        slave: 1
        address: 9002
        data_type: int16
        scan_interval: 60
        unique_id: VSR_500_Temperature_Unit
      - name: "VSR_500_Overheat_Temperature"
        unit_of_measurement: °C
        device_class: temperature
        slave: 1
        address: 12107
        scale: 0.1
        precision: 1
        data_type: int16
        scan_interval: 30
        unique_id: VSR_500_Overheat_temperature
      - name: "VSR_500_Extract_Air_Temperature"
        unit_of_measurement: °C
        device_class: temperature
        slave: 1
        address: 12543
        scale: 0.1
        precision: 1
        data_type: uint16
        scan_interval: 30
        unique_id: VSR_500_Extract_air_temperature
      - name: "VSR_500 Heat Exchanger AO state"
        unit_of_measurement: '%'
        device_class: power_factor
        slave: 1
        address: 14102
        data_type: uint16
        scan_interval: 30
        unique_id: VSR_500_Heat_Exchanger_AO_State"
      - name: "VSR_500 Relative Humidity Sensor"
        unit_of_measurement: '%'
        device_class: humidity
        slave: 1
        address: 12135
        data_type: uint16
        scan_interval: 30
        unique_id: VSR_500_Relative_Humidity
      - name: "VSR_500 Extract Air Fan RPM"
        unit_of_measurement: 'rpm'
        slave: 1
        address: 12401
        data_type: uint16
        scan_interval: 30
        unique_id: VSR_500_Extract_air_fan_RPM
      - name: "VSR_500_Fan_speed_level"
        slave: 1
        address: 1130
        scan_interval: 30
        unique_id: VSR_500_Fan_Speed_Level
      - name: "VSR_500_Eco_level"
        slave: 1
        address: 2504
        data_type: uint16
        scan_interval: 30
        unique_id: VSR_500_Eco_Level
      - name: "VSR_500 DI1 type"
        slave: 1
        address: 11400
        input_type: holding
        scan_interval: 30
        unique_id: VSR_500_DI1_Type
      - name: "VSR_500 DI2 type"
        slave: 1
        address: 11401
        input_type: holding
        scan_interval: 30
        unique_id: VSR_500_DI2_Type
      - name: "VSR_500 DI1 config"
        slave: 1
        address: 11420
        input_type: holding
        unique_id: VSR_500_DI1_Config
      - name: "VSR_500 DI2 config"
        slave: 1
        address: 11421
        input_type: holding
        scan_interval: 30
        unique_id: VSR_500_DI2_Config
      - name: "VSR_500 DI1 input"
        slave: 1
        address: 12030
        input_type: holding
        scan_interval: 30
        unique_id: VSR_500_DI1_Input
      - name: "VSR_500 DI2 input"
        slave: 1
        address: 12031
        input_type: holding
        scan_interval: 30
        unique_id: VSR_500_DI2_Input
      - name: "VSR_500_el_kolbe_padrag_triac"
        device_class: power_factor        
        slave: 1
        address: 2148
        input_type: holding
        unit_of_measurement: '%'
        count: 1
        data_type: uint16
        scan_interval: 30
        unique_id: VSR_500_Triac_Output
      - name: "VSR_500_el_kolbe_av_pa_triac"
        slave: 1
        address: 14380
        input_type: holding
        count: 1
        data_type: uint16
        scan_interval: 30
        unique_id: VSR_500_Triac_State
      - name: "VSR_500_varmegjenvinner"
        device_class: power_factor        
        slave: 1
        address: 14102
        input_type: holding
        unit_of_measurement: '%'
        count: 1
        data_type: uint16
        scan_interval: 30
        unique_id: VSR_500_HeatExchangeState
      - name: "VSR_500_Filter_Change_Alarm"
        slave: 1
        address: 7006
        input_type: holding
        count: 1
        data_type: uint16
        scan_interval: 30
        unique_id: VSR_500_Filter_Change_Alarm
      - name: "VSR_500_Filter_Change_Period_Months"
        slave: 1
        address: 7000
        input_type: holding
        unit_of_measurement: 'months'
        count: 1
        data_type: int16
        scan_interval: 30
        unique_id: VSR_500_Filter_Change_Period
      - name: "VSR_500_Filter_Lifetime_Left_Seconds_LSB"
        slave: 1
        address: 7004
        input_type: holding
        unit_of_measurement: 's'
        count: 1
        data_type: uint16
        scan_interval: 30
        unique_id: VSR_500_Filter_Liftetime_Left_LSB
      - name: "VSR_500_Filter_Lifetime_Left_Seconds_MSB"
        slave: 1
        address: 7005
        input_type: holding
        unit_of_measurement: 's'
        count: 1
        data_type: uint16
        scan_interval: 30
        unique_id: VSR_500_Filter_Liftetime_Left_MSB
      - name: "VSR_500_Filter_Lifetime_Left_Seconds"
        slave: 1
        address: 7005
        input_type: holding
        unit_of_measurement: 's'
        count: 2
        data_type: uint16
        scan_interval: 30
        unique_id: VSR_500_Filter_Liftetime_Left
    climates:
      - name: VSR_500_Temp_Setpoint
        address: 12102
        slave: 1
        data_type: uint16
        count: 1
        scale: 0.1
        offset: 0
        precision: 1
        max_temp: 30
        min_temp: 15
        temp_step: 1
        target_temp_register: 2000
    switches:
      - name: Boost mode
        slave: 1
        address: 1130
        command_on: 4
        command_off: 3
        verify:

Anything in the logs that might be useful for us?

Logger: homeassistant
Source: components/modbus/modbus.py:386
First occurred: 18:33:54 (7012 occurrences) (reporters note: this is when it crashed)
Last logged: 20:59:56

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/modbus/sensor.py", line 95, in async_update
    raw_result = await self._hub.async_pymodbus_call(
  File "/usr/src/homeassistant/homeassistant/components/modbus/modbus.py", line 409, in async_pymodbus_call
    result = await self.hass.async_add_executor_job(
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/modbus/modbus.py", line 386, in _pymodbus_call
    result = entry.func(address, value, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/pymodbus/client/common.py", line 125, in read_input_registers
    return self.execute(request)
  File "/usr/local/lib/python3.10/site-packages/pymodbus/client/sync.py", line 109, in execute
    return self.transaction.execute(request)
  File "/usr/local/lib/python3.10/site-packages/pymodbus/transaction.py", line 174, in execute
    response, last_exception = self._transact(
  File "/usr/local/lib/python3.10/site-packages/pymodbus/transaction.py", line 294, in _transact
    result = self._recv(response_length, full)
  File "/usr/local/lib/python3.10/site-packages/pymodbus/transaction.py", line 362, in _recv
    result = self.client.framer.recvPacket(expected_response_length)
  File "/usr/local/lib/python3.10/site-packages/pymodbus/framer/__init__.py", line 49, in recvPacket
    return self.client.recv(size)
  File "/usr/local/lib/python3.10/site-packages/pymodbus/client/sync.py", line 89, in recv
    return self._recv(size)
  File "/usr/local/lib/python3.10/site-packages/pymodbus/client/sync.py", line 293, in _recv
    ready = select.select([self.socket], [], [], end - time_)
ValueError: filedescriptor out of range in select()

/////////////////////  NEXT LOG ////////////////////
Reporters note: This happened many times all the time until it crashed - I don't think it is relevant, but as am not sure I'll include it.
Logger: homeassistant.components.modbus.modbus
Source: components/modbus/modbus.py:391
Integration: Modbus (documentation, issues)
First occurred: 10 January 2023 at 23:12:43 (110 occurrences)
Last logged: 18:33:44

Pymodbus: VSR500: Modbus Error: [Input/Output] Modbus Error: [Invalid Message] No response received, expected at least 8 bytes (0 received)

Additional information

No response

@home-assistant
Copy link

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 Change the title of 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
Copy link
Member

You have stumbled across a known bug in pymodbus, this is actually solved in a newer pymodbus version. Once pymodbus v3.1 gets released I will update the integration.

@oyta
Copy link
Author

oyta commented Jan 11, 2023

Alright! That is good news. Thanks for your quick reply. I will be sure to update as soon as it a part of an HA-release.

@janiversen
Copy link
Member

#85961 should fix your problem. If not please let me know, because then I need to do more testing in the library.

@mxwi
Copy link

mxwi commented Feb 3, 2023

Hi, this problem is not solved. I had the problem when updating to 2023.02.01.
I did a restart and the problem was fixed. Sadly I don't have the logs anymore.

Unfortunately there was no public information about the update to 3.x
For me, this is a breaking change.

Neverless, great work!

@janiversen
Copy link
Member

There was information, just look in the CHANGELOG.

@mxwi
Copy link

mxwi commented Feb 3, 2023

Keep cool buddy..
Can you bring up a link or something?
I did not found any information in the blogpost. I thought that was the point of information.

greetz

@janiversen
Copy link
Member

CHANGELOG is a standard document that is part of every release. Just look at the release

https://github.com/home-assistant/core/releases/tag/2023.2.1

@mxwi
Copy link

mxwi commented Feb 7, 2023

but not for 2023.2.0.

https://github.com/home-assistant/core/releases/tag/2023.2.0

have a nice day

@janiversen
Copy link
Member

actually it has the list of commits: 2023.2.0...master

and if yo look here, you can see it is our standard to show the commits in a release.

@mxwi
Copy link

mxwi commented Feb 7, 2023

Come on, no one's looking at that.
But okay, let's leave it alone.

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

Successfully merging a pull request may close this issue.

3 participants