Yaml error mapping

Hi i am new to Home Assistant ,I am struggling with Yaml as i keep on getting errors messages in my configs. I have looked online and still cannot figure out what is wrong.
Could somebody advise where i am going wrong with these entries ,

I can see one thing wrong already. You should really copy and paste your code as spacing plays a great deal.

1 Like

Please, no screenshots. Use the code icon (</>) to include Yaml or log output.

The errors:

  • wrong keys used (unit_of measurement: must be unit_of_measurement)
  • wrong case used (Camera: must be camera:, Value_template to value_template)
  • wrong indendation (sensor: to beginning of line)
  • missing indendation to express the configuration item’s level
sensor:
  - platform: rest
    name: Front Driveway
    resources: ....

camera:
  - platform: generic
    name: Front Driveway
    still_image_url: ...
3 Likes

Thanks for your quick replies i have made the alteration according , however whilst using File Editor the Red Indicator does not turn Green like it used to do? When I typed it originally the Green tick came up. I am still getting the following errors when I go to Configuration Validation this is the error message.;-
Configuration invalid

Error loading /config/configuration.yaml: while parsing a block mapping
in “/config/configuration.yaml”, line 3, column 1
expected , but found ‘’
in “/config/configuration.yaml”, line 32, column 3

I have checked them but can not see the problem.

as mentioned before. please post your yaml as code snipte not as screenshot
it seems you have a lot wrong indentation in your config

We neither.

Thanks for you advise can your explain how to send yaml as code snipte please as i don’t want to offend anyone in the future. As i am sure to be asking more question.

I may type it all again as i cannot copy and paste with my Mac as I understand that File editor is not compatible, unless there is another way.

Thanks again

it is not offending.
in the editor use the </> symbol and paste your code

Hi deluxestyle

Thanks I see now.

Hi I am having serious problems with my configuration file. it appears to correct Green tick on each line but when I confirm configuration , i receive the following error messages.
`` Logger: homeassistant.components.hassio
Source: components/hassio/init.py:420
Integration: Hass.io (documentation, issues)
First occurred: 7:55:25 AM (1 occurrences)
Last logged: 7:55:25 AM

Invalid config for [switch]: expected a dictionary. Got OrderedDict([(‘default_config’, {}), (‘tts’, [‘platform:google_translate’]), (‘group’, {}), (‘automation’, {}), (‘script’, {}), (‘mqtt’, {}), (‘switch’, ‘-platform:mqtt name:“Pond” state_topic:“tele/pond/state” command_topic:“cmnd/Pond/power” payload_on:“on” payload_off:“off” availability_topic:“tele/Pond/LWT” payload_available:“online” payload_not_avaialble:“offline” qos:1 retain:false’), (‘sensor’, '-platform:mqtt name:“Pond Temperature” state_topic:“tele/pond/Hass_state” value_template:"{{… (See ?, line ?). Invalid config for [tts]: expected a dictionary. Got OrderedDict([(‘default_config’, {}), (‘tts’, [‘platform:google_translate’]), (‘group’, {}), (‘automation’, {}), (‘script’, {}), (‘mqtt’, {}), (‘sensor’, ‘-platform:mqtt name:“Pond Temperature” state_topic:“tele/pond/Hass_state” value_template:"{{value_json[‘DS18B20’].Temperature}}" unit_of_measurement:"*C" availability_topic:“tele/Pond/LWT” payload_available:“online” payload_not_available:“offline” device_class:“temperature”’)]). (See /config/configuration.yaml, line 6). Invalid config for [sensor]: expected a dictionary. Got OrderedDict([(‘default_config’, {}), (‘group’, {}), (‘automation’, {}), (‘script’, {}), (‘mqtt’, {‘port’: 1883, ‘discovery’: True, ‘birth_message’: {‘topic’: ‘homeassistant/status’, ‘payload’: ‘online’, ‘qos’: 0, ‘retain’: False}, ‘will_message’: {‘topic’: ‘homeassistant/status’, ‘payload’: ‘offline’, ‘qos’: 0, ‘retain’: False}, ‘discovery_prefix’: ‘homeassistant’, ‘protocol’: ‘3.1.1’, ‘keepalive’: 60, ‘tls_version’: ‘auto’}), (‘sensor’, '-platform:mqtt name:“Pond Temperature” state_topic:"te… (See ?, line ?).
Yaml file
``# 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

mqtt:

switch:
-platform:mqtt
name:“Pond”
state_topic:“tele/pond/state”
command_topic:“cmnd/Pond/power”
payload_on:“on”
payload_off:“off”
availability_topic:“tele/Pond/LWT”
payload_available:“online”
payload_not_avaialble:“offline”
qos:1
retain:false

sensor:
-platform:mqtt
name:“Pond Temperature”
state_topic:“tele/pond/Hass_state”
value_template:"{{value_json[‘DS18B20’].Temperature}}"
unit_of_measurement:"*C"
availability_topic:“tele/Pond/LWT”
payload_available:“online”
payload_not_available:“offline”
device_class:“temperature”

any help would be appreciated a is have been trying to install this switch for a few days now . I think my Yaml config file is corrupt ? Thanks in anticipation.

YOU STILL haven’t posted any properly formatted code!!!

And you haven’t put a space after the colon to seperate the key and value.

your_key:"your_value"
correct_key: "correct_value"

Typo in available.

When pasting code into the comment box, simply make sure it has three backtick symbols before and after, like in the screenshot that @deluxestyle posted above.

That’s the only way we can reliably check indentation and issues like “smart quotes”.

Hi
I have pasted the yaml file as per deluxestyle request below: The file is from visual studio code the majority of the text after the colon is in red ?

# 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

mqtt:



switch:
  -platform: mqtt
  name: "Pond"
  state_topic: "tele/pond/state"
  command_topic: "cmnd/Pond/power"
  payload_on: "on"
  payload_off: "off"
  availability_topic: "tele/Pond/LWT"
  payload_available: "online"
  payload_not_available: "offline"
  qos: 1

  
sensor:
  -platform: mqtt
  name: "Pond Temperature"
  state_topic: "tele/pond/Hass_state"
  value_template: "{{value_json['DS18B20'].Temperature}}"
  unit_of_measurement: "*C"
  availability_topic: "tele/Pond/LWT"
  payload_available: "online"
  payload_not_available: "offline"
  device_class: "temperature"
  
  
  
 or paste code here

Apologise if it is not clear but as i said i am a newly and trying to learn If I use Text Editor and place all text after the colon: it is has a tick on everything but i go to configuration i get the error message, i am not not certain where i am going wrong. The log file is the same every time ?

-platform

Should be

- platform

as I said your indentation is wrong. try this

While you’re in the editor:

tts:

  - platform:google_translate

Should be

tts:
  - platform: google_translate

i have changed the indentation as per deluxstyle and the amendment to line 6 tts , however the configuration is faulty on the sensor even though i have made the changes

Logger: homeassistant.components.hassio
Source: components/hassio/__init__.py:420
Integration: Hass.io (documentation, issues)
First occurred: 9:37:52 AM (1 occurrences)
Last logged: 9:37:52 AM

Invalid config for [tts]: expected a dictionary. Got OrderedDict([('default_config', {}), ('tts', ['platform:google_translate']), ('group', {}), ('automation', {}), ('script', {}), ('mqtt', {}), ('sensor', [OrderedDict([('platform', 'mqtt'), ('name', 'Pond Temperature'), ('state_topic', 'tele/pond/Hass_state'), ('value_template', "{{value_json['DS18B20'].Temperature}}"), ('unit_of_measurement', '*C'), ('availability_topic', 'tele/Pond/LWT'), ('payload_available', 'online'), ('payload_not_available', 'offline'), ('device_class', 'temperature')]).... (See /config/configuration.yaml, line 6).

# 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

mqtt:



switch:
  - platform: 'mqtt'
    name: "Pond"
    state_topic: "tele/pond/state"
    command_topic: "cmnd/Pond/power"
    payload_on: "on"
    payload_off: "off"
    availability_topic: "tele/Pond/LWT"
    payload_available: "online"
    payload_not_available: "offline"
    qos: 1

  
sensor:
  - platform: 'mqtt'
    name: "Pond Temperature"
    state_topic: "tele/pond/Hass_state"
    value_template: "{{value_json['DS18B20'].Temperature}}"
    unit_of_measurement: "*C"
    availability_topic: "tele/Pond/LWT"
    payload_available: "online"
    payload_not_available: "offline"

Here is the log file which now only mentions the sensor previously the switch was also mentioned.

Logger: homeassistant.components.hassio
Source: components/hassio/__init__.py:420
Integration: Hass.io (documentation, issues)
First occurred: 9:37:52 AM (1 occurrences)
Last logged: 9:37:52 AM

Invalid config for [tts]: expected a dictionary. Got OrderedDict([('default_config', {}), ('tts', ['platform:google_translate']), ('group', {}), ('automation', {}), ('script', {}), ('mqtt', {}), ('sensor', [OrderedDict([('platform', 'mqtt'), ('name', 'Pond Temperature'), ('state_topic', 'tele/pond/Hass_state'), ('value_template', "{{value_json['DS18B20'].Temperature}}"), ('unit_of_measurement', '*C'), ('availability_topic', 'tele/Pond/LWT'), ('payload_available', 'online'), ('payload_not_available', 'offline'), ('device_class', 'temperature')]).... (See /config/configuration.yaml, line 6).```

have you changes tts like samnewman86 suggested?