Yaml error mapping

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?

I did editor as per samnewman86 post , tts: line 6 `-platform: google_translate line 7.

I check and then restarted server and now i have Configuration Valid.

Thank you all for your support and patience .`

Once thing left:

unit_of_measurement: "*C"

at the sensor’s config should be

unit_of_measurement: "°C"

Thank you spotting it.

All working ok now?

Yes Thank you, just need to download a thermostat custom card then i can install the Sonoff TH switch and sensor. I just learning all the time.

Thanks again for your help.

Hi sorry to trouble you again, i put 2 lines in the yaml using File Editor and again it gives OK green tick when i check thru Configurator it comes up with error on line 31, I have checked and checked again but cannot find the error perhaps you can help.

Configuration invalid

Invalid config for [sensor]: required key not provided @ data['platform']. Got None. (See /config/configuration.yaml, line 31).# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Text to speech
tts:
 - platform: google_translate

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





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"
  

  - url: /hacsfiles/lovelace-thermostat-dark-card/thermostat-dark-card.js
    type: module ```

The last two lines shouldn’t be there at all, delete them. Also switch and sensor should be lowercase.

What are you trying to do with those last two lines.
They are currently part of the list of sensors

Looks like he’s trying to use a custom plugin.

lovelace:
  mode: yaml
  resources:
    - url: /hacsfiles/lovelace-thermostat-dark-card/thermostat-dark-card.js
      type: module

@mwy6283 I’d suggest using the UI for lovelace until you get a handle on YAML.

1 Like

Hi all

Thank for the quick reply, Yes i have downloaded a thermostat in UI Lovelace yaml i read that i had to include this in yaml obviously i did not understand this correctly . Now that i have removed the two lines I am back to where i was yesterday with a valid Configuration. I thought i need to direct the switch and señor to the thermostat-card. Hopefully when i connect the switch and sensor up . i will get the readings
Apologise to you all.