Block start / end difficulty

Hi Automateys,
New user, I’m trying to create my YAML to read and write MODBUS switches and relays.
Not yet a MODBUS problem as I cannot get past the configuration checker. The checker insists it sees a block end or start in unexpected places. I’ve tried numerous indent regimes, and examples cut and pasted from the web without ever getting an acceptable response from config checker.
Questions about MODBUS addressing will surely follow!
My YAML so far…

Configure a default setup of Home Assistant (frontend, api, etc)

default_config:

Text to speech

tts:

  • platform: google_translate

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

config paras

serial connection

modbus:

  • name: “hub1”
    close_comm_on_error: true
    delay: 5
    timeout: 1
    type: serial
    baudrate: 9600
    bytesize: 8
    method: rtu
    parity: N
    port: /dev/ttyUSB0
    stopbits: 1

################################################
sensors:
- name: “top_stair_upper”
slave: 110
address: 7
scan_interval: 1
data_type: int16

#input devices to be scanned often

output devices

- platform: template
  lights:

Office_Light:

    name: "Office_Hall_Light"
    turn_on:
    service: modbus.write_register
    data:
    hub: "hub1"
    unit: 115
    address: 3
    value: 1
#  device workshop troffer 'ON'

and the config tester result…

                      Error loading /config/configuration.yaml: while parsing a block mapping

in “/config/configuration.yaml”, line 16, column 5
expected , but found ‘-’
in “/config/configuration.yaml”, line 181, column 5

Yes, I know you can’t see the line numbers, the errors seem to be wherever the script starts with a minus “-” sign, and it has moved about with each attempt at a new edit. It does not seem to be grumbling about the actual MODBUS setting anymore, I reckon they are o.k. now. I can find no reference to block starts and ends in the ref or help files. All suggestions welcome, Thank you.

The lack of line numbers isn’t a problem. It’s the lack of formatting that prevents us from checking for proper indentation.

Refer to guideline 11 in the FAQ.

1 Like

Thanks Taras. I’d read the section you referred to, and I was surprised when a cut and paste resulted in big text with headers etc - perhaps I’ll use screen snip next time. Right now I’m struggling with Bl**#& Win10 which insists on using it’s own credentials when accessing Samba on HA, so I could use Visual Studio which I guess could help with maintaining the indents. Thanks again. Regards dd.

Please don’t.
Use code blocks instead.

```
like this
  It will keep the indentation intact.
```
like this
  It will keep the indentation intact.

Edit your original post and format it properly.

The net use command is your friend (usually).