Hello.
I have this problem and I am not able to solve it. I use the modbus component to read sensors info and switch some functions in my Victron Energy inverter/charger.
It has been working for almost two years flawless but after last update I only can read the sensors and the switches are gone. I have tried several configurations without success. I see in last update something change in modbus but more relative about how to configure it.
Here my error log:
Logger: homeassistant.components.switch
Source: components/modbus/switch.py:25
Integration: Interruptor (documentation, issues)
First occurred: 18 de junio de 2021 23:52:31 (1 occurrences)
Last logged: 18 de junio de 2021 23:52:31
Error while setting up modbus platform for switch
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 250, in _async_setup_platform
await asyncio.shield(task)
File "/usr/src/homeassistant/homeassistant/components/modbus/switch.py", line 25, in async_setup_platform
for entry in discovery_info[CONF_SWITCHES]:
TypeError: 'NoneType' object is not subscriptable
Logger: homeassistant.components.modbus.modbus
Source: components/modbus/modbus.py:203
Integration: Modbus (documentation, issues)
First occurred: 18 de junio de 2021 23:52:42 (4832 occurrences)
Last logged: 20:00:39
Pymodbus: Exception Response(131, 3, GatewayPathUnavailable)
THANK YOU so much!!
I have tried before the new config but I did it wrong. I was using “register” instead “address” but after you told me I wrote again following the new method and finally I have back my switches (they are very important in my installation).
Hi!
I had to move out switches and sensors to configuration.yaml (or you can create a new yaml file, but not with the other switches.
Here is my config:
modbus:
- name: "victron"
type: tcp
host: 192.168.0.7
port: 502
switches:
- name: Victron - CarLimit- ctive input current
slave: 238
address: 22
command_on: 1700
command_off: 500
- name: Victron - 0 W Prueba
slave: 238
address: 37
command_on: 1700
command_off: 500
- name: Victron - 0 W Prueba2705
slave: 100
address: 2705
command_on: 70
command_off: 55
- name: Victron - Cargador
slave: 100
address: 2701
command_on: 100
command_off: 0
- name: Victron - Inversor
slave: 100
address: 2702
command_on: 100
command_off: 0
# - name: Victron Grid Power Setpoint
# hub: victron
# slave: 100
# register: 2700
# command_on: 4000
# command_off: 80
# verify_state: false
- name: Victron Min SoC (Unless grid fails)
slave: 100
address: 2901
command_on: 95
command_off: 5
# - name: Victron Set SoC
# hub: victron
# slave: 238
# register: 30
# command_on: 95
# command_off: 5
# verify_state: false
# - name: Victron AC Current Limit
# hub: victron
# slave: 100
# register: 2316
# command_on: 30
# command_off: 5
# verify_state: false
# - name: Victron Active Current Limit
# hub: victron
# slave: 100
# register: 22
# command_on: 30
# command_off: 5
# verify_state: false
sensors:
- name: V Grid Power
scan_interval: 3
slave: 100
address: 820
unit_of_measurement: "W"
- name: V Load
scan_interval: 3
unit_of_measurement: "W"
slave: 100
address: 817
#SoC Bateria sin decimal
- name: V Battery SoC
scan_interval: 3
unit_of_measurement: "%"
slave: 100
address: 843
#Battery Power sin invertir
- name: V Battery Power
scan_interval: 3
unit_of_measurement: "W"
slave: 100
address: 842
#Necesita añadir coma para decimal
- name: V BaterĂa Voltaje
unit_of_measurement: "V"
slave: 100
address: 840
scale: 10
- name: V BaterĂa Intensidad
unit_of_measurement: "A"
slave: 100
address: 841
scale: 100
#Convertir estados: 0 idle, 1 charging, 2 dischargin
- name: V Battery State
slave: 100
address: 844
#Necesita añadir coma para decimal
- name: V Battery Consumed Ah
unit_of_measurement: "Ah"
slave: 100
address: 845
#Writable
- name: V Active Input Current Limit
unit_of_measurement: "A"
slave: 239
address: 22
- name: V Output Power 1
unit_of_measurement: "W"
slave: 239
address: 23
- name: V Switch Position
# unit_of_measurement: "W"
slave: 239
address: 33
Could someone check my modbus config, I cannot get it to work after updating HA and it worked before the updates. I have tried to copy other formats shown or linked in this thread but can’t get it to work, I have tried using it in my configuration.yaml file as well as in it’s own modbus.yaml file, nothing works and I can’t see where I have gone wrong.