core: Modbus Crashes on 0.108.1 using Serial
The problem
Modbus Crashes in Home Assistant 108.1 using Serial Connection.
Environment
- Home Assistant Core release with the issue: 0.108.1
- Last working Home Assistant Core release (if known): 0.107.7
- Operating environment (Home Assistant/Supervised/Docker/venv): Home Assistant
- Integration causing this issue: Modbus
- Link to integration documentation on our website: https://www.home-assistant.io/integrations/modbus/
Problem-relevant configuration.yaml
sensor:
# PLC (Cabinet Sensors)
- platform: modbus
scan_interval: 6
registers:
# Cabinet Temperature
- name: PLC Cabinet Temperature
hub: Skylight Controller
unit_of_measurement: °C
register: 0
scale: 0.01
precision: 2
# Cabinet Minimum Temperature
- name: PLC Cabinet Minimum Temperature
hub: Skylight Controller
unit_of_measurement: °C
register: 1
scale: 0.01
precision: 2
# Cabinet Maximum Temperature
- name: PLC Cabinet Maximum Temperature
hub: Skylight Controller
unit_of_measurement: °C
register: 2
scale: 0.01
precision: 2
# Cabinet Average Daily Temperature
- name: PLC Cabinet Daily Average Temperature
hub: Skylight Controller
unit_of_measurement: °C
register: 3
scale: 0.01
precision: 2
# Cabinet Minimum Daily Temperature
- name: PLC Cabinet Minimum Daily Temperature
hub: Skylight Controller
unit_of_measurement: °C
register: 25
scale: 0.01
precision: 2
# Cabinet Maximum Daily Temperature
- name: PLC Cabinet Maximum Daily Temperature
hub: Skylight Controller
unit_of_measurement: °C
register: 26
scale: 0.01
precision: 2
# Cabinet Humidity
- name: PLC Cabinet Humidity
hub: Skylight Controller
unit_of_measurement: '%'
register: 10
scale: 0.01
precision: 2
# Cabinet Minimum Humidity
- name: PLC Cabinet Minimum Humidity
hub: Skylight Controller
unit_of_measurement: '%'
register: 11
scale: 0.01
precision: 2
# Cabinet Maximum Humidity
- name: PLC Cabinet Maximum Humidity
hub: Skylight Controller
unit_of_measurement: '%'
register: 12
scale: 0.01
precision: 2
# Cabinet Average Daily Humidity
- name: PLC Cabinet Daily Average Humidity
hub: Skylight Controller
unit_of_measurement: '%'
register: 13
scale: 0.01
precision: 2
# Cabinet Minimum Daily Humidity
- name: PLC Cabinet Minimum Daily Humidity
hub: Skylight Controller
unit_of_measurement: '%'
register: 27
scale: 0.01
precision: 2
# Cabinet Maximum Daily Humidity
- name: PLC Cabinet Maximum Daily Humidity
hub: Skylight Controller
unit_of_measurement: '%'
register: 28
scale: 0.01
precision: 2
# Skylight (Bathroom Window Position)
- name: Skylight Bathroom Window Position
hub: Skylight Controller
unit_of_measurement: Steps
register: 20
# Skylight (Ensuite Window Position)
- name: Skylight Ensuite Window Position
hub: Skylight Controller
unit_of_measurement: Steps
register: 21
# Skylight (Bathroom Window Position)
- name: 'Skylight Bathroom Position (%)'
hub: Skylight Controller
unit_of_measurement: '%'
register: 22
# Skylight (Ensuite Window Position)
- name: 'Skylight Ensuite Position (%)'
hub: Skylight Controller
unit_of_measurement: '%'
register: 23
# Skylight (Bathroom Operation - On Time)
- name: Skylight (Bathroom Operation - On Time)
hub: Skylight Controller
unit_of_measurement: s
register: 15
# Skylight (Ensuite Operation - On Time)
- name: Skylight (Ensuite Operation - On Time)
hub: Skylight Controller
unit_of_measurement: s
register: 16
# Skylight (Bathroom Operation - Off Time)
- name: Skylight (Bathroom Operation - Off Time)
hub: Skylight Controller
unit_of_measurement: s
register: 17
# Skylight (Ensuite Operation - Off Time)
- name: Skylight (Ensuite Operation - Off Time)
hub: Skylight Controller
unit_of_measurement: s
register: 18
binary_sensor:
- platform: modbus
scan_interval: 2
inputs:
- name: High High Temperature - Cabinet Alarm
hub: Skylight Controller
slave: 1
address: 800
- name: High Temperature - Cabinet Alarm
hub: Skylight Controller
slave: 1
address: 801
- name: Low Temperature - Cabinet Alarm
hub: Skylight Controller
slave: 1
address: 802
- name: High High Humidity - Cabinet Alarm
hub: Skylight Controller
slave: 1
address: 816
- name: High Humidity - Cabinet Alarm
hub: Skylight Controller
slave: 1
address: 817
- name: Low Humidity - Cabinet Alarm
hub: Skylight Controller
slave: 1
address: 818
- name: Bathroom Skylight Window - Open
hub: Skylight Controller
slave: 1
address: 145
- name: Ensuite Skylight Window - Open
hub: Skylight Controller
slave: 1
address: 146
#Modbus TCP Connection (Siemens)
modbus:
- name: Skylight Controller
type: tcp
host: 192.168.80.155
port: 502
delay: 0
- name: Curtain Controller
type: serial
method: rtu
port: /dev/serial/by-id/usb-www.freetronics.com_0003_95437313934351505191-if00
baudrate: 9600
stopbits: 1
bytesize: 8
parity: N
timeout: 10
# Modbus - PLC Cabinet
- platform: modbus
coils:
# Climate Stats (Resets)
- name: "PLC Cabinet Maximum Temperature Reset"
hub: Skylight Controller
slave: 1
coil: 81
- name: "PLC Cabinet Minimum Temperature Reset"
hub: Skylight Controller
slave: 1
coil: 82
- name: "PLC Cabinet Daily Temperature Reset"
hub: Skylight Controller
slave: 1
coil: 83
- name: "PLC Cabinet Maximum Humidity Reset"
hub: Skylight Controller
slave: 1
coil: 84
- name: "PLC Cabinet Minimum Humidity Reset"
hub: Skylight Controller
slave: 1
coil: 85
- name: "PLC Cabinet Daily Humidity Reset"
hub: Skylight Controller
slave: 1
coil: 86
- name: "PLC Cabinet Maximum Daily Temperature Reset"
hub: Skylight Controller
slave: 1
coil: 881
- name: "PLC Cabinet Minimum Daily Temperature Reset"
hub: Skylight Controller
slave: 1
coil: 882
- name: "PLC Cabinet Maximum Daily Humidity Reset"
hub: Skylight Controller
slave: 1
coil: 883
- name: "PLC Cabinet Minimum Daily Humidity Reset"
hub: Skylight Controller
slave: 1
coil: 884
# Skylight Control
- name: "PLC Cabinet Service Mode (Remote Activate)"
hub: Skylight Controller
slave: 1
coil: 97
- name: "Skylight Control - All UP"
hub: Skylight Controller
slave: 1
coil: 98
- name: "Skylight Control - All Down"
hub: Skylight Controller
slave: 1
coil: 98
# Individual Skylight Control
- name: "Skylight Control - Bathroom UP"
hub: Skylight Controller
slave: 1
coil: 113
- name: "Skylight Control - Bathroom Down"
hub: Skylight Controller
slave: 1
coil: 114
- name: "Skylight Control - Ensuite UP"
hub: Skylight Controller
slave: 1
coil: 115
- name: "Skylight Control - Ensuite Down"
hub: Skylight Controller
slave: 1
coil: 116
# Skylight Time Set
- name: "Skylight Control - Ensuite On Time Set"
hub: Skylight Controller
slave: 1
coil: 130
- name: "Skylight Control - Ensuite Off Time Set"
hub: Skylight Controller
slave: 1
coil: 132
- name: "Skylight Control - Bathroom On Time Set"
hub: Skylight Controller
slave: 1
coil: 129
- name: "Skylight Control - Bathroom Off Time Set"
hub: Skylight Controller
slave: 1
coil: 131
- name: " Bedroom Curtain - UP"
hub: Curtain Controller
slave: 1
coil: 0
- name: " Bedroom Curtain - Down"
hub: Curtain Controller
slave: 1
coil: 1
- name: " Bedroom Curtain - Stop"
hub: Curtain Controller
slave: 1
coil: 2
Traceback/Error logs
Logger: homeassistant.setup
Source: components/modbus/__init__.py:175
First occurred: 6:03:36 PM (1 occurrences)
Last logged: 6:03:36 PM
Error during setup of component modbus
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 171, in _async_setup_component
hass, processed_config
File "/usr/src/homeassistant/homeassistant/components/modbus/__init__.py", line 103, in async_setup
hub_collect[client_config[CONF_NAME]] = ModbusHub(client_config, hass.loop)
File "/usr/src/homeassistant/homeassistant/components/modbus/__init__.py", line 175, in __init__
self._config_delay = client_config[CONF_DELAY]
KeyError: 'delay'
Additional information
Different Issue to Recently fixed MODBUS issue.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 3
- Comments: 64 (36 by maintainers)
Commits related to this issue
- solve modbus issue #33872 CONF_DELAY was used in a serial connection, which is not permitted. — committed to janiversen/core by janiversen 4 years ago
- solve modbus issue #33872 CONF_DELAY was used in a serial connection, which is not permitted. Sometimes async_update is called after async_setup is completed, but before event EVENT_HOMEASSISTANT_ST... — committed to janiversen/core by janiversen 4 years ago
- Fix modbus default delay (#33877) * solve modbus issue #33872 CONF_DELAY was used in a serial connection, which is not permitted. Sometimes async_update is called after async_setup is complete... — committed to home-assistant/core by janiversen 4 years ago
- Fix modbus default delay (#33877) * solve modbus issue #33872 CONF_DELAY was used in a serial connection, which is not permitted. Sometimes async_update is called after async_setup is complete... — committed to home-assistant/core by janiversen 4 years ago
I updated my Home Assistant to version 0.108.3 and still have a problem. On version 0.107.7 all works perfect. Ony after update is a problem. My Config: modbus: type: serial method: rtu port: /dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0 baudrate: 9600 stopbits: 1 bytesize: 8 parity: N
and in logs show me this: 2020-04-11 09:28:22 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant. 2020-04-11 09:28:26 WARNING (MainThread) [pymodbus.client.asynchronous] Not Importing deprecated clients. Dependency Twisted is not Installed 2020-04-11 09:28:27 ERROR (MainThread) [homeassistant.setup] Error during setup of component modbus Traceback (most recent call last): File “/usr/src/homeassistant/homeassistant/setup.py”, line 171, in _async_setup_component hass, processed_config File “/usr/src/homeassistant/homeassistant/components/modbus/init.py”, line 139, in async_setup await hass.async_add_executor_job(start_modbus) File “/usr/local/lib/python3.7/concurrent/futures/thread.py”, line 57, in run result = self.fn(*self.args, **self.kwargs) File “/usr/src/homeassistant/homeassistant/components/modbus/init.py”, line 111, in start_modbus client.setup() File “/usr/src/homeassistant/homeassistant/components/modbus/init.py”, line 207, in setup loop=self._loop, File “/usr/local/lib/python3.7/site-packages/pymodbus/client/asynchronous/serial.py”, line 75, in new yieldable = factory_class(framer=framer, port=port, **kwargs) File “/usr/local/lib/python3.7/site-packages/pymodbus/client/asynchronous/factory/serial.py”, line 104, in async_io_factory client = AsyncioModbusSerialClient(port, proto_cls, framer, loop, **kwargs) File “/usr/local/lib/python3.7/site-packages/pymodbus/client/asynchronous/asyncio/init.py”, line 689, in init self._connected_event = asyncio.Event() File “/usr/local/lib/python3.7/asyncio/locks.py”, line 249, in init self._loop = events.get_event_loop() File “/usr/local/lib/python3.7/asyncio/events.py”, line 644, in get_event_loop % threading.current_thread().name)
Is any solution for it ?