Hi Guys,
I have a Modbus board of switches and want to use them in a variety of applications. It worked before when I tried to describe the light in a simple statement with the Modbus as a hub to call, but I want to make it a bit more modular, defining the light function through the switch. So, I thought to do something like:
modbus:
- name: swbf2
type: tcp
host: swb-f2
port: 17000
switch:
- platform: modbus
scan_interval: 5
coils:
- name: switch1
hub: swbf2
coil: 0
slave: 0
command_on: 1
command_off: 0
verify_state: true
light:
- platform: switch
name: GuestRoom_MainLight
entity_id: switch.switch1
I see that am getting the following error:
2021-06-16 16:48:57 ERROR (MainThread) [homeassistant.components.switch] Error while setting up modbus platform for switch
Traceback (most recent call last):
File “/home/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/entity_platform.py”, line 250, in _async_setup_platform
await asyncio.shield(task)
File “/home/homeassistant/lib/python3.8/site-packages/homeassistant/components/modbus/switch.py”, line 25, in async_setup_platform
for entry in discovery_info[CONF_SWITCHES]:
TypeError: ‘NoneType’ object is not subscriptable
I see that the HA is trying to communicate to the modbus server, just okay, and it keeps the connection running. Any ideas?
Thanks in advance,
Regards Matt