Modbus parameters

HI ,

Connecting to a plasmatronic solar charger via us usb to serial converter using modbus protocol
I’ve successfully talked to it with Python using minimalmodbus

sensor:
platform: modbus
registers:
- name: Voltagereg
slave: 8
register: 8370
modbus:
type: serial
method: rtu
port: /dev/ttyUSB0
baudrate: 9600
stopbits: 1
bytesize: 8
parity: E
log file returns the following error:
homemeassistant.bootstrap: Invalid config for [sensor.modbus]: required key not provided @ data[‘registers’][0][‘register’]. Got None. (See ?:?). Please check the docs at https://home-assistant.io/components/sensor.modbus/

In addition, have tried both but should the slave and register values be in decimal or hex?
Thanks,
Rob.

Post code using preformatted text so that we can tell if it’s a formatting problem.

See how that error is looking for “registers”? It looks like you’re not formatting the configuration correctly. You need to define each register under a registers: block like the example on the component page.

sensor:
  platform: modbus
  registers:
    - name: Sensor1
      unit_of_measurement: °C
      slave: 1
      register: 100
    - name: Sensor2
      unit_of_measurement: mg
      slave: 1
      register: 110
      count: 2
    - name: Sensor3
      unit_of_measurement: °C
      slave: 1
      register: 120
      scale: 0.01
      offset: -273.16
      precision: 2

Big thank for that,

You made my day! All values now coming through!

It was an alignment issue, mind you I did study the formatting pretty closely, think I just needed a good overnight sleep.
Of course it all makes sense when it works but frustrating when it’s not.
Is there something I could use to step through the YAML code to debug the formatting?
Guess it’s a learning curve but spending vast amount of time just getting the text alignment right. Using notepad ++

P…S , Tidying up the values but, happy to post code for reading the plasmatronic solar charger if anyone interested.

The errors in home-assistant.log are generally helpful enough to point to the issue. It pointed out that you were missing “registers:”