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.16k stars 29.84k forks source link

Modbus stop to polling over night. #53006

Closed mawreegnau closed 3 years ago

mawreegnau commented 3 years ago

The problem

After upgrading to 2021.7 The modbus sensor read a power energy from a solar inverter. The inverter goes in sleep mode after sunset and wake up on sunrise the day after. At wake up HA don't read sensor, i have to reboot HA. Before 2021.7 it worked correctly.

What is version of Home Assistant Core has the issue?

core-2021.7.2

What was the last working version of Home Assistant Core?

core-2021.6

What type of installation are you running?

Home Assistant Core

Integration causing the issue

No response

Link to integration documentation on our website

No response

Example YAML snippet

modbus:
  type: tcp
  host: 192.168.1.220
  port: 502
  sensors:
    - name: Produzione
      scan_interval: 10
      slave: 1
      address: 40084
      input_type: holding
      unit_of_measurement: W
      count: 1
      scale: 10
      offset: 0
      precision: 0
      data_type: int

Anything in the logs that might be useful for us?

No response

Additional information

No response

janiversen commented 3 years ago

It is probably a known problem (without debug logsI cannot tell). There is a patch being tested which will be submitted soon.

probot-home-assistant[bot] commented 3 years ago

modbus documentation modbus source (message by IssueLinks)

probot-home-assistant[bot] commented 3 years ago

Hey there @adamchengtkc, @vzahradnik, mind taking a look at this issue as its been labeled with an integration (modbus) you are listed as a codeowner for? Thanks! (message by CodeOwnersMention)

issuluca commented 3 years ago

I also have the same problem with an ABB inverter ... with the old modbus version never had problems, since I had to change it in the morning it is always unavailable

peterhoe commented 3 years ago

Modbus sensors against host experience momentary outtage, however never seems to reconnect without a reboot Haas 2021.7.2

0210717 - 15:45 Pymodbus: Modbus Error: [Input/Output] [Errno 104] Connection reset by peer restart required

20210718 - 01:30 Pymodbus: Modbus Error: [Input/Output] Modbus Error: [Invalid Message] No response received, expected at least 8 bytes (0 received) restart required

These errors may well have occurred prior to 2021.7.x, however i didnt experience permanent sensor unavailable response prior to moving from 2021.6.x to 2021.7.3.

Yes there may be the odd issue if network momentatarily unavailable for example, however modbus would recover, and not require a reboot of Haas to get sensors to reconnect & update.

I left sensor in unavailable state for 20 minutes & it didnt seem to attempt reconnect via modbus. Sensor from that point unavailable untill haas a reboot. Given there is no way i could easily find of restaring modbus module or integration so to speak, a reboot seemed to be my only option

janiversen commented 3 years ago

https://github.com/home-assistant/core/pull/53020 solves that issue.

mpfurnari commented 3 years ago

I'm seeing this as well. The only thing I see in the logs related is:

Logger: pymodbus.client.sync
Source: /usr/local/lib/python3.9/site-packages/pymodbus/client/sync.py:218
First occurred: 12:17:15 AM (3 occurrences)
Last logged: 12:17:21 AM

Connection to (192.168.6.13, 502) failed: timed out

I'm running Home Assistant 2021.7.3

I made all the required changes for Modbus for 2021.7

Also, while all of the devices for one endpoint go unavailable, I have other endpoints which are still working.

remyderuysscher commented 3 years ago

I still have issues after upgrading to 2021.7.3 with modbus RTU. Error are absent for a few hours after restart.

2021-07-18 15:22:27 ERROR (SyncWorker_0) [homeassistant.components.modbus.modbus] Pymodbus: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response 2021-07-18 16:28:27 ERROR (SyncWorker_2) [homeassistant.components.modbus.modbus] Pymodbus: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response 2021-07-18 16:40:27 ERROR (SyncWorker_0) [homeassistant.components.modbus.modbus] Pymodbus: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response 2021-07-18 16:46:26 ERROR (SyncWorker_2) [homeassistant.components.modbus.modbus] Pymodbus: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response 2021-07-18 19:46:28 ERROR (SyncWorker_1) [homeassistant.components.modbus.modbus] Pymodbus: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response 2021-07-18 20:28:27 ERROR (SyncWorker_0) [homeassistant.components.modbus.modbus] Pymodbus: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response 2021-07-18 20:28:28 ERROR (SyncWorker_2) [homeassistant.components.modbus.modbus] Pymodbus: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response 2021-07-18 21:34:28 ERROR (SyncWorker_0) [homeassistant.components.modbus.modbus] Pymodbus: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response 2021-07-18 21:34:28 ERROR (SyncWorker_0) [homeassistant.components.modbus.modbus] Pymodbus: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response 2021-07-18 21:34:28 ERROR (SyncWorker_3) [homeassistant.components.modbus.modbus] Pymodbus: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response 2021-07-18 21:34:28 ERROR (SyncWorker_0) [homeassistant.components.modbus.modbus] Pymodbus: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response 2021-07-19 00:10:26 ERROR (SyncWorker_3) [homeassistant.components.modbus.modbus] Pymodbus: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response 2021-07-19 00:10:37 ERROR (SyncWorker_2) [homeassistant.components.modbus.modbus] Pymodbus: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response 2021-07-19 01:40:28 ERROR (SyncWorker_0) [homeassistant.components.modbus.modbus] Pymodbus: Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response

mawreegnau commented 3 years ago

The problem was not solved with the 2017.3 I have to reboot HA every morning to make modbus connect.

janiversen commented 3 years ago

The last log shows the device is not responding, so you need to look for the cause in the device or earlier in the debug logs.

mawreegnau commented 3 years ago

The device (a solar inverter) goes in sleep mode at sunset. Totally, even the tcp/ip. At sunrise the device wake-up and start tcp-ip comm. But HA seems not to notice, and only a reboot restores communication. It worked perfectly in 2021.6

janiversen commented 3 years ago

Set timeout sufficient high that should solve it.

janiversen commented 3 years ago

Test with 2021.8

janiversen commented 3 years ago

Closing issue as solved.