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 sensors Unavailable after 2021.7.1 Update #52795

Closed chris-kuhr closed 3 years ago

chris-kuhr commented 3 years ago

The problem

I was running 2021.6.4 and have adapted the new configuration style right before the update to 2021.7.1 today. The configuration checks out fine. But all sensors are "Unavailable".

The device is a RS485-Ethernet gateway connected to an EPEVER MPPT Controller.

What is version of Home Assistant Core has the issue?

2021.7.1

What was the last working version of Home Assistant Core?

2021.6.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/

Example YAML snippet

# new style:
modbus:
  - name: ModbusTCPPV
    type: rtuovertcp
    host: 10.4.149.17
    port: 8888
    sensors:
      - name: Modbus_OL_Temp_MPPT
        slave: 1
        address: 8192
        input_type: input

# old style
modbus:
  - name: ModbusTCPPV
    type: rtuovertcp
    host: 10.4.149.17
    port: 8888

sensor:
  - platform: modbus
    registers:
      - name: Modbus_OL_Temp_MPPT
        hub: ModbusTCPPV
        slave: 1
        register: 8192
        register_type: input

Anything in the logs that might be useful for us?

Was also present before and is related to another, misconfigured device. Was no problem thus far.

Pymodbus: Modbus Error: [Connection] ModbusTcpClient(10.4.149.20:502): Connection unexpectedly closed 0.009882 seconds into read of 8 bytes without response from unit before it closed connection
Pymodbus: Exception Response(132, 4, IllegalAddress)

Additional information

No response

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

modbus documentation modbus source (message by IssueLinks)

janiversen commented 3 years ago

most likely solved with https://github.com/home-assistant/core/pull/52505, this is included in 2021.7.1

However the log does not correspond to your config !!! the log contains address 10.4.149.20:502 which is host: 10.4.149.20 port: 502

but your configuration contains: host: 10.4.149.17 port: 8888

so it is understandable you cannot get a connection.

Remark you cannot have 2 modbus statements in one configuration.

honikos commented 3 years ago

I use also an EPever - device with modbus protocoll. @chris-kuhr standard port is 8088 you use 8888 ... but maybe you changed standard EPever port

here is my config (works for about 20 minutes after reboot, than errors come in):

modbus:
  - type: tcp
    host: 192.168.178.82
    port: 8088
    name: hub0
    delay: 2
    timeout: 10
  - type: rtuovertcp
    host: 192.168.178.82
    port: 8088
    name: hub1
    sensors:
      - name: EPEver_Temperatur # später an Batterie anbinden?
        device_class: temperature
        unit_of_measurement: C°
        slave: 1
        address: 12560
        input_type: input
        scale: 0.01
        precision: 2
      - name:  Spannung_Batterie_V # EPEver   #331A
        device_class: voltage
        unit_of_measurement: V
        slave: 1  # slave, which request, 247 possible
        address: 13082
        input_type: input
        scale: 0.01
        precision: 2
      - name: Batterie_Ladestand_SOC #311A State of Charge — hier wohl aus Volt berechnet??
        device_class: battery
        unit_of_measurement: Percent
        slave: 1
        address: 12570
        input_type: input
      - name: PV_Leistung_W # 3102 (L) und 3103 (H)
        device_class: power
        unit_of_measurement: W
        slave: 1
        address: 12546
        input_type: input
        scale: .01
        count: 2
        precision: 2
        swap: word
      - name: PV_Eingangsspannung #3100
        device_class: voltage
        unit_of_measurement: V
        slave: 1
        address: 12544
        input_type: input
        scale: 0.01
      - name: PV_Strom_A # 3101
        device_class: current
        unit_of_measurement: A
        slave: 1
        address: 12545
        input_type: input
        scale: 0.01
        precision: 2

log after error: 2021-07-10 14:25:07 DEBUG (SyncWorker_2) [pymodbus.client.sync] New Transaction state 'SENDING' 2021-07-10 14:25:07 DEBUG (SyncWorker_3) [pymodbus.client.sync] New Transaction state 'SENDING' 2021-07-10 14:25:21 DEBUG (SyncWorker_6) [pymodbus.client.sync] New Transaction state 'SENDING' 2021-07-10 14:25:21 DEBUG (SyncWorker_0) [pymodbus.client.sync] New Transaction state 'SENDING' 2021-07-10 14:25:21 DEBUG (SyncWorker_2) [pymodbus.client.sync] New Transaction state 'SENDING' 2021-07-10 14:25:21 DEBUG (SyncWorker_3) [pymodbus.client.sync] New Transaction state 'SENDING' 2021-07-10 14:25:21 DEBUG (SyncWorker_1) [pymodbus.client.sync] New Transaction state 'SENDING' 2021-07-10 14:25:21 DEBUG (SyncWorker_5) [pymodbus.client.sync] New Transaction state 'SENDING' 2021-07-10 14:25:36 DEBUG (SyncWorker_3) [pymodbus.client.sync] New Transaction state 'SENDING' 2021-07-10 14:25:36 DEBUG (SyncWorker_5) [pymodbus.client.sync] New Transaction state 'SENDING' 2021-07-10 14:25:36 DEBUG (SyncWorker_1) [pymodbus.client.sync] New Transaction state 'SENDING' 2021-07-10 14:25:36 DEBUG (SyncWorker_4) [pymodbus.client.sync] New Transaction state 'SENDING' 2021-07-10 14:25:37 DEBUG (SyncWorker_6) [pymodbus.client.sync] New Transaction state 'SENDING' 2021-07-10 14:25:37 DEBUG (SyncWorker_0) [pymodbus.client.sync] New Transaction state 'SENDING' 2021-07-10 14:25:51 DEBUG (SyncWorker_5) [pymodbus.client.sync] New Transaction state 'SENDING' 2021-07-10 14:25:54 ERROR (SyncWorker_5) [homeassistant.components.modbus.modbus] Pymodbus: Modbus Error: [Input/Output] Modbus Error: [Invalid Message] No response received, expected at least 2 bytes (0 received) 2021-07-10 14:25:54 DEBUG (SyncWorker_4) [pymodbus.client.sync] Connection to Modbus server established. Socket ('192.168.178.20', 45155) 2021-07-10 14:25:54 DEBUG (SyncWorker_4) [pymodbus.client.sync] New Transaction state 'SENDING' 2021-07-10 14:25:54 DEBUG (SyncWorker_4) [homeassistant.components.modbus.modbus] Pymodbus: Modbus Error: [Connection] ModbusTcpClient(192.168.178.82:8088): Connection unexpectedly closed 0.119413 seconds into read of 7 bytes without response from unit before it closed connection 2021-07-10 14:25:54 DEBUG (SyncWorker_3) [pymodbus.client.sync] Connection to Modbus server established. Socket ('192.168.178.20', 60197) 2021-07-10 14:25:57 DEBUG (SyncWorker_3) [pymodbus.client.sync] New Transaction state 'SENDING' 2021-07-10 14:25:57 DEBUG (SyncWorker_3) [homeassistant.components.modbus.modbus] Pymodbus: Modbus Error: [Connection] ModbusTcpClient(192.168.178.82:8088): Connection unexpectedly closed 0.000100 seconds into read of 7 bytes without response from unit before it closed connection 2021-07-10 14:25:57 DEBUG (SyncWorker_2) [pymodbus.client.sync] Connection to Modbus server established. Socket ('192.168.178.20', 35093) 2021-07-10 14:26:00 DEBUG (SyncWorker_2) [pymodbus.client.sync] New Transaction state 'SENDING' 2021-07-10 14:26:00 DEBUG (SyncWorker_7) [pymodbus.client.sync] New Transaction state 'SENDING' 2021-07-10 14:26:03 ERROR (SyncWorker_7) [homeassistant.components.modbus.modbus] Pymodbus: Modbus Error: [Input/Output] Modbus Error: [Invalid Message] No response received, expected at least 2 bytes (0 received) 2021-07-10 14:26:03 DEBUG (SyncWorker_6) [pymodbus.client.sync] Connection to Modbus server established. Socket ('192.168.178.20', 57011) 2021-07-10 14:26:03 DEBUG (SyncWorker_6) [pymodbus.client.sync] New Transaction state 'SENDING' 2021-07-10 14:26:04 DEBUG (SyncWorker_6) [homeassistant.components.modbus.modbus] Pymodbus: Modbus Error: [Connection] ModbusTcpClient(192.168.178.82:8088): Connection unexpectedly closed 0.324146 seconds into read of 7 bytes without response from unit before it closed connection

poldim commented 3 years ago

having similar problem with Modbus not working after update

74345B35-820E-49D9-B3C9-646C37EF40A1

StevenBontius commented 3 years ago

similar issues over here

- name: hub1
  type: serial
  method: rtu
  port: /dev/ttyUSB0
  baudrate: 9600
  stopbits: 2
  bytesize: 8
  parity: N
  delay: 4
  retry_on_empty: true
  retries: 10
  switches:
    - name: AC_on_off
      address: 0
      command_on: 1
      command_off: 0 
      verify:
        delay: 2
  sensors:
    - name: 3rd_floor_masterbedroom_AC_current_temp_setpoint
      slave: 1
      address: 4
      precision: 1
      scan_interval: 20
      data_type: uint
      device_class: temperature
nov30th commented 3 years ago

I hereby confirmed once I updated the HA, the Modbus has gone, I checked my devices and found they work all normal.

same issue list:

52872

52773

52787

I enabled the logs level to debug for Modbus, it output nothing just

2021-07-12 23:45:29 INFO (MainThread) [homeassistant.setup] Setup of domain modbus took 2.5 seconds
2021-07-12 23:45:33 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.modbus

Useless information.

During my debugging of my devices, I found HA sent nothing to the Modbus server (status of my EE11 and EW11 TCP to serial device), mine is RTU over TCP, which means it could be the sending function of the component was dead or the component exited already.

EagleAlex commented 3 years ago

Same issue. I have two devices connected: rtu over tcp (ee11 to epever charge controller) and rtu (dev/tty*), the first one stoped working after update to 2021.7.1, while the second is still fine, even after update.

One more things happend just after introduction of the new modbus style, the next construction can change the coil state, but cannot veryfy it, and as a result the switch returns to off position each time it was switched on. switches:

janiversen commented 3 years ago

What do you mean “cannot verify it” ? It sounds a lot more as if the verify receives an “off” from your device, in case of an error it would be unavailable.

Please run wuth debug log (as pr modbus documentation) and post.

lopez3 commented 3 years ago

Similar story here, this works in 2021.6.6 but not 2021.7.x. Serial part works fine, TCP does not show any signs of life. Nothing useful in logs after switching on debug. Tcpdump shows no packets transmitted when changing the state of the light (which changes the modbus switch). The switch switch.lampa_wiata_kulki is available in UI but does nothing.

modbus:
  - name: wise4060
    type: tcp
    host: 192.168.88.9
    port: 502
    switches:
      - { name: Lampa wiata kulki,    slave: 1, address: 16, write_type: coil, verify: }
      - { name: Wiata wlacznik,       slave: 1, address: 33, write_type: holding, command_on: 1, command_off: 0 }
      - { name: Wiata wlacznik clear, slave: 1, address: 37, write_type: holding, command_on: 1, command_off: 0 }
  - name: fatek
    type: serial
    method: rtu
    port: /dev/serial0
    baudrate: 115200
    stopbits: 1
    bytesize: 8
    parity: N
    switches:.
      - { name: Lampa Salon sufit,          slave: 1, address: 32, write_type: coil, verify: }
      - { name: Lampa Salon kinkiety,       slave: 1, address: 33, write_type: coil, verify: }
      - { name: Lampa Jadalnia sufit,       slave: 1, address: 34, write_type: coil, verify: }
      - { name: Lampa Salon kanapa,         slave: 1, address: 35, write_type: coil, verify: }
      - { name: Lampa Taras,                slave: 1, address: 36, write_type: coil, verify: }
      - { name: Lampa Kuchnia sufit,        slave: 1, address: 37, write_type: coil, verify: }
      - { name: Lampa Lazienka dol,         slave: 1, address: 38, write_type: coil, verify: }
      - { name: Lampa Lazienka dol lustro,  slave: 1, address: 39, write_type: coil, verify: }
      - { name: Lampa Korytarz dol,         slave: 1, address: 40, write_type: coil, verify: }
      - { name: Lampa Techniczne,           slave: 1, address: 41, write_type: coil, verify: }
      - { name: Lampa Wiatrolap,            slave: 1, address: 42, write_type: coil, verify: }
      - { name: Lampa Osw2,                 slave: 1, address: 43, write_type: coil, verify: }
      - { name: Lampa Schody,               slave: 1, address: 44, write_type: coil, verify: }
      - { name: Lampa Drzwi,                slave: 1, address: 45, write_type: coil, verify: }
      - { name: Lampa Pralnia 1,            slave: 1, address: 46, write_type: coil, verify: }
      - { name: Lampa Pralnia 1A,           slave: 1, address: 47, write_type: coil, verify: }
      - { name: Lampa Lazienka gora,        slave: 1, address: 48, write_type: coil, verify: }
      - { name: Lampa Lazienka gora lustro, slave: 1, address: 49, write_type: coil, verify: }
      - { name: Lampa Garderoba,            slave: 1, address: 50, write_type: coil, verify: }
      - { name: Lampa Sypialnia rodzicow,   slave: 1, address: 51, write_type: coil, verify: }
      - { name: Lampa Sypialnia Ady,        slave: 1, address: 52, write_type: coil, verify: }
      - { name: Lampa Sypialnia Ewy,        slave: 1, address: 53, write_type: coil, verify: }
      - { name: Lampa Korytarz pralnia,     slave: 1, address: 54, write_type: coil, verify: }
      - { name: Lampa Schody gora,          slave: 1, address: 55, write_type: coil, verify: }
      - { name: Lampa Kuchnia zlew,         slave: 1, address: 24, write_type: coil, verify: }
      - { name: Lampa Kuchnia okap,         slave: 1, address: 25, write_type: coil, verify: }
      - { name: Stycznik strych,            slave: 1, address: 26, write_type: coil, verify: }
      - { name: Stycznik gniazda parter,    slave: 1, address: 0 , write_type: coil, verify: }
      - { name: Stycznik gniazda gora,      slave: 1, address: 1 , write_type: coil, verify: }
      - { name: Stycznik podgrzewacze lazienki,  slave: 1, address: 2, write_type: coil, verify: }
      - { name: Stycznik kuchnia,           slave: 1, address: 3 , write_type: coil, verify: }
      - { name: Grzanie salon przejscie,    slave: 1, address: 8 , write_type: coil, verify: }
      - { name: Grzanie techniczne,         slave: 1, address: 9 , write_type: coil, verify: }
      - { name: Grzanie wiatrolap,          slave: 1, address: 10, write_type: coil, verify: }
      - { name: Grzanie kuchnia,            slave: 1, address: 11, write_type: coil, verify: }
      - { name: Grzanie salon,              slave: 1, address: 12, write_type: coil, verify: }
      - { name: Grzanie lazienka dol,       slave: 1, address: 13, write_type: coil, verify: }
      - { name: Grzanie pralnia,            slave: 1, address: 14, write_type: coil, verify: }
      - { name: Grzanie korytarz gora,      slave: 1, address: 15, write_type: coil, verify: }
      - { name: Grzanie garderoba,          slave: 1, address: 16, write_type: coil, verify: }
      - { name: Grzanie sypialnia rodzicow, slave: 1, address: 17, write_type: coil, verify: }
      - { name: Grzanie sypialnia Ady,      slave: 1, address: 18, write_type: coil, verify: }
      - { name: Grzanie sypialnia Ewy,      slave: 1, address: 19, write_type: coil, verify: }
      - { name: Grzanie lazienka gora,      slave: 1, address: 20, write_type: coil, verify: }
      - { name: L1_state,      slave: 1, address: 100, write_type: holding, command_on: 1, command_off: 0  }
      - { name: L1_updatereq,  slave: 1, address: 101, write_type: holding, command_on: 1, command_off: 0  }
      - { name: L2_state,      slave: 1, address: 102, write_type: holding, command_on: 1, command_off: 0  }
      - { name: L2_updatereq,  slave: 1, address: 103, write_type: holding, command_on: 1, command_off: 0  }
      - { name: L3_state,      slave: 1, address: 104, write_type: holding, command_on: 1, command_off: 0  }
      - { name: L3_updatereq,  slave: 1, address: 105, write_type: holding, command_on: 1, command_off: 0  }
      - { name: L4_state,      slave: 1, address: 106, write_type: holding, command_on: 1, command_off: 0  }
      - { name: L4_updatereq,  slave: 1, address: 107, write_type: holding, command_on: 1, command_off: 0  }
      - { name: L5_state,      slave: 1, address: 108, write_type: holding, command_on: 1, command_off: 0  }
      - { name: L5_updatereq,  slave: 1, address: 109, write_type: holding, command_on: 1, command_off: 0  }
    sensors:
      - { name: Temperatura wiatrolap,                  unit_of_measurement: °C, scale: 0.01, precision: 2, slave: 1,  address: 1000 }
      - { name: Temperatura wiatrolap podloga,          unit_of_measurement: °C, scale: 0.01, precision: 2, slave: 1,  address: 1002 }
      - { name: Temperatura wiatrolap zadana,           unit_of_measurement: °C, scale: 0.01, precision: 2, slave: 1,  address: 1006 }
      - { name: Temperatura techniczne,                 unit_of_measurement: °C, scale: 0.01, precision: 2, slave: 1,  address: 1020 }
      - { name: Temperatura techniczne podloga,         unit_of_measurement: °C, scale: 0.01, precision: 2, slave: 1,  address: 1022 }
      - { name: Temperatura techniczne zadana,          unit_of_measurement: °C, scale: 0.01, precision: 2, slave: 1,  address: 1026 }
      - { name: Temperatura lazienka dol,               unit_of_measurement: °C, scale: 0.01, precision: 2, slave: 1,  address: 1040 }
      - { name: Temperatura lazienka dol podloga,       unit_of_measurement: °C, scale: 0.01, precision: 2, slave: 1,  address: 1042 }
      - { name: Temperatura lazienka dol zadana,        unit_of_measurement: °C, scale: 0.01, precision: 2, slave: 1,  address: 1046 }
      - { name: Temperatura salon,                      unit_of_measurement: °C, scale: 0.01, precision: 2, slave: 1,  address: 1060 }
      - { name: Temperatura salon podloga,              unit_of_measurement: °C, scale: 0.01, precision: 2, slave: 1,  address: 1062 }
      - { name: Temperatura salon zadana,               unit_of_measurement: °C, scale: 0.01, precision: 2, slave: 1,  address: 1066 }
      - { name: Temperatura salon przejscie,            unit_of_measurement: °C, scale: 0.01, precision: 2, slave: 1,  address: 1080 }
      - { name: Temperatura salon przejscie podloga,    unit_of_measurement: °C, scale: 0.01, precision: 2, slave: 1,  address: 1082 }
      - { name: Temperatura salon przejscie zadana,     unit_of_measurement: °C, scale: 0.01, precision: 2, slave: 1,  address: 1086 }
      - { name: Temperatura kuchnia,                    unit_of_measurement: °C, scale: 0.01, precision: 2, slave: 1,  address: 1100 }
      - { name: Temperatura kuchnia podloga,            unit_of_measurement: °C, scale: 0.01, precision: 2, slave: 1,  address: 1102 }
      - { name: Temperatura kuchnia zadana,             unit_of_measurement: °C, scale: 0.01, precision: 2, slave: 1,  address: 1106 }
      - { name: Temperatura garderoba,                  unit_of_measurement: °C, scale: 0.01, precision: 2, slave: 1,  address: 1120 }
      - { name: Temperatura garderoba podloga,          unit_of_measurement: °C, scale: 0.01, precision: 2, slave: 1,  address: 1122 }
      - { name: Temperatura garderoba zadana,           unit_of_measurement: °C, scale: 0.01, precision: 2, slave: 1,  address: 1126 }
      - { name: Temperatura pralnia,                    unit_of_measurement: °C, scale: 0.01, precision: 2, slave: 1,  address: 1140 }
      - { name: Temperatura pralnia podloga,            unit_of_measurement: °C, scale: 0.01, precision: 2, slave: 1,  address: 1142 }
      - { name: Temperatura pralnia zadana,             unit_of_measurement: °C, scale: 0.01, precision: 2, slave: 1,  address: 1146 }
      - { name: Temperatura lazienka gora,              unit_of_measurement: °C, scale: 0.01, precision: 2, slave: 1,  address: 1160 }
      - { name: Temperatura lazienka gora podloga,      unit_of_measurement: °C, scale: 0.01, precision: 2, slave: 1,  address: 1162 }
      - { name: Temperatura lazienka gora zadana,       unit_of_measurement: °C, scale: 0.01, precision: 2, slave: 1,  address: 1166 }
      - { name: Temperatura korytarz gora,              unit_of_measurement: °C, scale: 0.01, precision: 2, slave: 1,  address: 1180 }
      - { name: Temperatura korytarz gora podloga,      unit_of_measurement: °C, scale: 0.01, precision: 2, slave: 1,  address: 1182 }
      - { name: Temperatura korytarz gora zadana,       unit_of_measurement: °C, scale: 0.01, precision: 2, slave: 1,  address: 1186 }
      - { name: Temperatura sypialnia Ewy,              unit_of_measurement: °C, scale: 0.01, precision: 2, slave: 1,  address: 1200 }
      - { name: Temperatura sypialnia Ewy podloga,      unit_of_measurement: °C, scale: 0.01, precision: 2, slave: 1,  address: 1202 }
      - { name: Temperatura sypialnia Ewy zadana,       unit_of_measurement: °C, scale: 0.01, precision: 2, slave: 1,  address: 1206 }
      - { name: Temperatura sypialnia Ady,              unit_of_measurement: °C, scale: 0.01, precision: 2, slave: 1,  address: 1220 }
      - { name: Temperatura sypialnia Ady podloga,      unit_of_measurement: °C, scale: 0.01, precision: 2, slave: 1,  address: 1222 }
      - { name: Temperatura sypialnia Ady zadana,       unit_of_measurement: °C, scale: 0.01, precision: 2, slave: 1,  address: 1226 }
      - { name: Temperatura sypialnia rodzicow,         unit_of_measurement: °C, scale: 0.01, precision: 2, slave: 1,  address: 1240 }
      - { name: Temperatura sypialnia rodzicow podloga, unit_of_measurement: °C, scale: 0.01, precision: 2, slave: 1,  address: 1242 }
      - { name: Temperatura sypialnia rodzicow zadana,  unit_of_measurement: °C, scale: 0.01, precision: 2, slave: 1,  address: 1246 }
      - { name: Temperatura zewnetrzna polnoc,          unit_of_measurement: °C, scale: 0.01, precision: 2, slave: 1,  address: 1400 }
      - { name: Temperatura zewnetrzna poludnie,        unit_of_measurement: °C, scale: 0.01, precision: 2, slave: 1,  address: 1401 }
      - { name: Wilgotnosc salon schody,                unit_of_measurement: '%', scale: 0.01, precision: 2, slave: 1,  address: 1404 }
      - { name: Wilgotnosc zewnetrzna,                  unit_of_measurement: '%', scale: 0.01, precision: 2, slave: 1,  address: 1406 }
      - { name: PLC_RTC_MINUTE,                         slave: 1,  address: 4129 }
      - { name: PLC_RTC_HOUR,                           slave: 1,  address: 4130 }
      - { name: PLC_RTC_DAY,                            slave: 1,  address: 4131 }
      - { name: PLC_RTC_MONTH,                          slave: 1,  address: 4132 }
      - { name: PLC_RTC_YEAR,                           slave: 1,  address: 4133 }
janiversen commented 3 years ago

If you have nothing about modbus in the log,then it is not installed. If tcp does not work at all, then at least you have either configuration errors or a connect failure in the log.

Multiple connections are solved with #52794

lopez3 commented 3 years ago

Sorry I should have be more specific, here is what's in the logs.

root@raspberrypi:/home/pi# docker restart home-assistant-2021
home-assistant-2021
root@raspberrypi:/home/pi# docker logs -f home-assistant-2021 2>&1 | grep modb | grep -v SENDING
2021-07-13 10:46:36 WARNING (MainThread) [homeassistant.components.switch] Setup of switch platform modbus is taking over 10 seconds.
2021-07-13 11:39:20 DEBUG (SyncWorker_2) [pymodbus.client.sync] Connection to Modbus server established. Socket ('192.168.88.11', 43089)
2021-07-13 11:39:44 WARNING (MainThread) [homeassistant.components.switch] Setup of switch platform modbus is taking over 10 seconds.
^C
root@raspberrypi:/home/pi# netstat | grep 43089
tcp        0      0 192.168.88.11:43089     192.168.88.9:502        ESTABLISHED
root@raspberrypi:/home/pi#
lopez3 commented 3 years ago

Just realized this connection dies after some time:

2021-07-13 10:46:36 WARNING (MainThread) [homeassistant.components.switch] Setup of switch platform modbus is taking over 10 seconds.
2021-07-13 11:39:20 DEBUG (SyncWorker_2) [pymodbus.client.sync] Connection to Modbus server established. Socket ('192.168.88.11', 43089)
2021-07-13 11:39:44 WARNING (MainThread) [homeassistant.components.switch] Setup of switch platform modbus is taking over 10 seconds.
^C
root@raspberrypi:/home/pi# netstat | grep 43089
root@raspberrypi:/home/pi#

I am willing to experiment, please let me know if I can help in any way.

nov30th commented 3 years ago

Suggestion: As there are warnings of settings: sensor *** scan_interval(1) is lower than 5 seconds, which may cause Home Assistant stability issues image would be good if a parameter or something to mute the warning. =)

poldim commented 3 years ago

@chris-kuhr Just a heads up, I didn't get an error but noticed that I was still using the old config for the sensors. Updating to the newest config where the sensor is under the modbus definition has fixed my problem on the stable build (core-2021.7.2)

image

chris-kuhr commented 3 years ago

However the log does not correspond to your config !!! the log contains address 10.4.149.20:502 which is host: 10.4.149.20 port: 502

As I posted in the OP directly above the log, this belongs to a different, misconfigured modbus integration. It just was the only modbus related log entry.

I just updated to 2021.7.2, which did not fix anything for me. But I also didn't find any modbus in the changelog though. Screenshot_20210715-075227 Related log entry after update:


Logger: 
homeassistant.components.modbus.modbus
Source: components/modbus/modbus.py:237
Integration: Modbus (documentation, issues)
First occurred: 6:19:55 AM (380 occurrences)
Last logged: 7:54:13 AM

Pymodbus: Modbus Error: [Connection] ModbusTcpClient(10.4.149.20:502): Connection unexpectedly closed 0.000098 seconds into read of 8 bytes without response from unit before it closed connection
Pymodbus: Exception Response(132, 4, IllegalAddress)

Again, it shows only the second, misconfigured modbus device.

The port 8888 is also correct, which I manually configured in my RS485 gateway.

Do I have to switch to a dev version to try, if it fixes my configuration?

nov30th commented 3 years ago

@chris-kuhr downgrade to 6.6 works for me and i am waiting the new release which contains the fixes. simply do:

# ha core upgrade --version=2021.6.6

but i have one modbus host currently, and i put 485 in node_red. the 7.2 happens unavailable after a period of time of HA started, havent look into the issue, just waiting new release and test it.

chris-kuhr commented 3 years ago

Yeah, I know, but I want to provide debugging insights for the fixes. For me, the modbus device is not vital.

janiversen commented 3 years ago

see above #52794 solves the problem and is available on dev, I hope it will be part of 2021.7.3

chris-kuhr commented 3 years ago

core-2021.8.0.dev20210716 works fine!

Screenshot_20210716-092827

Thank you!