Expected <block end>, but found '-'

Hi,
what is wrong with my configuration.yaml?

Config directory: /home/homeassistant/.homeassistant
2019-09-27 06:55:30 ERROR (SyncWorker_0) [homeassistant.util.yaml.loader] while parsing a block mapping
  in "/home/homeassistant/.homeassistant/configuration.yaml", line 2, column 1
expected <block end>, but found '-'
  in "/home/homeassistant/.homeassistant/configuration.yaml", line 22, column 1
2019-09-27 06:55:30 ERROR (MainThread) [homeassistant.bootstrap] Error loading /home/homeassistant/.homeassistant/configuration.yaml: while parsing a block mapping
  in "/home/homeassistant/.homeassistant/configuration.yaml", line 2, column 1
expected <block end>, but found '-'
  in "/home/homeassistant/.homeassistant/configuration.yaml", line 22, column 1

this is my configuration.yaml:

tts:
  - platform: google_translate

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

duckdns:
    domain: example
    access_token: token

http:
    base_url: https://example.duckdns.org:8123

mqtt:
    broker: 127.0.0.1
    port: 1883
    username: username
    password: password

- platform: mqtt
  name: bedroom_cover
  command_topic: "shellies/shellyswitch25-E59F4A/roller/0/command"
  position_topic: "shellies/shellyswitch25-E59F4A/roller/0/pos"
  set_position_topic: "shellies/shellyswitch25-E59F4Aroller/0/command/pos"
  availability_topic: "shellies/shellyswitch25-E59F4A/online"
  payload_available: "true"
  payload_not_available: "false"
  qos: 1
  retain: false
  payload_open: "open"
  payload_close: "close"
  payload_stop: "stop"
  position_open: 100
  position_closed: 0
  optimistic: false
2 Likes

Your mqtt block at the end isn’t under a platform.

You need a cover: and the appropriate indentation

Indentation in yaml is key !!

It should be:

mqtt: 
   broker: 127.0.0.1 
   port: 1883 
   username: username 
   password: password 

cover: 
   - platform: mqtt 
     name: bedroom_cover

GV

now there are other error:

2019-09-27 07:33:59 ERROR (SyncWorker_0) [homeassistant.util.yaml.loader] while parsing a block collection
  in "/home/homeassistant/.homeassistant/configuration.yaml", line 24, column 4
expected <block end>, but found '?'
  in "/home/homeassistant/.homeassistant/configuration.yaml", line 25, column 4
2019-09-27 07:33:59 ERROR (MainThread) [homeassistant.bootstrap] Error loading /home/homeassistant/.homeassistant/configuration.yaml: while parsing a block collection
  in "/home/homeassistant/.homeassistant/configuration.yaml", line 24, column 4
expected <block end>, but found '?'
  in "/home/homeassistant/.homeassistant/configuration.yaml", line 25, column 4

this is the new configuration.yaml:

tts:
  - platform: google_translate

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

duckdns:
    domain: example
    access_token: token

http:
    base_url: https://example.duckdns.org:8123

mqtt:
   broker: 127.0.0.1
   port: 1883
   username: username
   password: password

cover:
   - platform: mqtt
   name: bedroom_cover
   command_topic: "shellies/shellyswitch25-E59F4A/roller/0/command"
   position_topic: "shellies/shellyswitch25-E59F4A/roller/0/pos"
   set_position_topic: "shellies/shellyswitch25-E59F4Aroller/0/command/pos"
   availability_topic: "shellies/shellyswitch25-E59F4A/online"
   payload_available: "true"
   payload_not_available: "false"
   qos: 1
   retain: false
   payload_open: "open"
   payload_close: "close"
   payload_stop: "stop"
   position_open: 100
   position_closed: 0
   optimistic: false


Again… Indentation!
Look at:

cover: 
   - platform: mqtt 
     name: bedroom_cover

Compare to your:

cover:
   - platform: mqtt
   name: bedroom_cover

These two spaces make all the difference!

IMHO the pickiness on indention is a PITA… But that’s the way it is with YAML :frowning:

GV

1 Like

thanks, now it works and it doesn’t give me errors, but if I connect from the site it tells me: “404 not found”

I added “frontend:” and now it starts but the loading wheel in the overview section rotates to infinity.

I added “config:” and now it starts, but I don’t have the shelly shutter available

I don’t know where you are looking…

Is the mqtt broker working? Is the shelly working?
Have you tried to see if the shelly sends/receives message using an mqtt debug tool such as mqtt.fx (or other)?

Eventually, if something is seen in mqtt your shelly should be in your “unused entities” if you have configure lovelace but not add it there.

GV

I ran into this error earlier today and i found the easiest way to fix problems like these and other indentation problem in yaml config file.

check out link to Yaml Lint

How it works
Open the URL and copy your yaml configuration file into the blank page and paste (of course, you can tweak your sensitive information so you don’t leak them). What this does is, fix the indentations issues and point out the exact location and by how much space you need to adjust.

To read more indepth documentations about Yaml Lint, click YamlLint!