"configuration.yaml" structure?

Hello to the forum,

I have a question about the “configuration.yaml” file. I have arranged my entities for “parents” (as stated here: https://www.home-assistant.io/docs/configuration/devices/#style-1-collect-every-entity-under-the-parent).
Is there a specification in which order the individual “parents” have to be structured? I ask because I noticed that the “Tuya-parent” once works, but when I enter it in another place in the “configuration.yaml” entry no longer works.
For answers I would be grateful.

Thank you in advance

You can’t have two ‘parents’ of the same name, so if you do one will override the other.

Post your configuration (with formatting and sanitised) and we can show you how to rectify it :slight_smile:

Hello mf_social,

yes, I realize that I can only have one “parent” once, so I did it in my “configuration.yaml”. I attached them here, maybe someone sees a mistake. In this structure “Tuya” works. Yesterday I had it elsewhere in the “configuration.yaml” and it did not work, mmh !!!

Is there no specific arrangement how the “parents” have to be created?

homeassistant:
  # Name of the location where Home Assistant is running
  name: Home
  # Location required to calculate the time the sun rises and sets
  latitude: !secret latitude
  longitude: !secret longitude
  # Impacts weather/sunrise data (altitude above sea level in meters)
  elevation: !secret elevation
  # metric for Metric, imperial for Imperial
  unit_system: metric
  # Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
  time_zone: Europe/Berlin
  # Customization file
  customize: !include customize.yaml

# Show links to resources in log and frontend
introduction:

# Systemgesungheit:
system_health:
    
# Enables the frontend
frontend:

# Enables configuration UI
config:

# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# http:
#   base_url: example.duckdns.org:8123

# Checks for available updates
# Note: This component will send some information about your system to
# the developers to assist with development of Home Assistant.
# For more information, please see:
# https://home-assistant.io/blog/2016/10/25/explaining-the-updater/
updater:
  # Optional, allows Home Assistant developers to focus on popular components.
  # include_used_components: true

# Discover some devices automatically
discovery:

# Allows you to issue voice commands from the frontend in enabled browsers
conversation:

# Enables support for tracking state changes over time
history:

# View all events in a logbook
logbook:

# Enables a map showing the location of tracked devices
map:

# Track the sun
sun:

# HTTP
http:
  api_password: !secret http_password

# Lovelace
#lovelace:
#  mode: yaml

# Sensoren
sensor:
# Weather prediction
  - platform: yr
  - platform: dht
    sensor: DHT11
    pin: 4
    monitored_conditions:
      - temperature
      - humidity
# Stromverbrauch
  - platform: template
    sensors:
      my_tp_switch_amps:
        friendly_name_template: "{{ states.switch.tp_link_steckdose.name}} Current"
        value_template: '{{ states.switch.tp_link_steckdose.attributes["current_a"] | float }}'
        unit_of_measurement: 'A'
      my_tp_switch_watts:
        friendly_name_template: "{{ states.switch.tp_link_steckdose.name}} Current Consumption"
        value_template: '{{ states.switch.tp_link_steckdose.attributes["current_power_w"] | float }}'
        unit_of_measurement: 'W'
      my_tp_switch_total_kwh:
        friendly_name_template: "{{ states.switch.tp_link_steckdose.name}} Total Consumption"
        value_template: '{{ states.switch.tp_link_steckdose.attributes["total_energy_kwh"] | float }}'
        unit_of_measurement: 'kWh'
      my_tp_switch_volts:
        friendly_name_template: "{{ states.switch.tp_link_steckdose.name}} Voltage"
        value_template: '{{ states.switch.tp_link_steckdose.attributes["voltage"] | float }}'
        unit_of_measurement: 'V'
      my_tp_switch_today_kwh:
        friendly_name_template: "{{ states.switch.tp_link_steckdose.name}} Today's Consumption"
        value_template: '{{ states.switch.tp_link_steckdose.attributes["today_energy_kwh"] | float }}'
        unit_of_measurement: 'kWh'       ###### <-- Config Warning 2 #########
  - platform: mqtt
    name: "Nokia 8 Display"
    state_topic: "homeassistant/switch/android_nokia_8_ariela_screen/state"
    command_topic: "homeassistant/switch/android_nokia_8_ariela_screen/set"
    value_template: "{{value_json.state}}"   ##### <-- Config Warning 3 ##########
  - platform: mqtt
    name: "Tablet Display"
    state_topic: "homeassistant/switch/android_yoga_tablettablet_screen/state"
    command_topic: "homeassistant/switch/android_yoga_tablettablet_screen/set"
    value_template: "{{value_json.state}}"
  - platform: mqtt    
    name: "ALARM SENSOR NAME"    
    state_topic: "homeassistant/sensor/android_yoga_tablettablet_nextalarm/state"    
    value_template: "{{ value_json.state }}"    
    json_attributes:      
      - icon

binary_sensor:
  - platform: ping
    name: Telestar
    host: 192.168.178.58
    scan_interval: 10

# Text to speech
tts:
  - platform: google
    language: 'de'

# Cloud
cloud:

# Steckdosen
tuya:
  username: !secret tuya_user
  password: !secret tuya_password
  country_code: 49

# Xiaomi
xiaomi_aqara:
  discovery_retry: 5
  gateways:
    - key: !secret xiaomi_gateway_key
# MQTT
mqtt:
  discovery: true
  broker: 192.168.178.63
#  discovery_prefix: homeassistant

# Seitenleiste
panel_iframe:
  nodered_flows:
    title: 'Node-RED'
    url: 'http://192.168.178.63:1880'
    icon: mdi:nodejs
    
  cameras:
    title: 'Motion Eye'
    url: 'http://192.168.178.63:8765'
    icon: mdi:cctv
     
  configurator:
    title: 'Konfigurator'
    url: 'http://192.168.178.63:3218/'
    icon: mdi:wrench
    
  esphomeyaml:
    title: 'ESPHome'
    url: 'http://192.168.178.63:6052'
    icon: mdi:network

# Schalter
switch:                  ####### <-- Config Warning 1 ########
  - platform: mqtt
    name: "NodeMCU"
    state_topic: "ha/switch1"
    command_topic: "ha/switch1"
    qos: 0
    payload_on: "ON"
    payload_off: "OFF"
    optimistic:
    false retain: true
  - platform: mqtt
    name: "ESP8266"
    state_topic: "ha/switch2"
    command_topic: "ha/switch2"
    qos: 0
    payload_on: "ON"
    payload_off: "OFF"
    optimistic: false
    retain: true
  - platform: broadlink
    host: 192.168.178.71
    mac: '34:EA:34:43:2E:17' 
    type: rm2_pro_plus
    switches:
      sat:
        friendly_name: "Sat Receiver"
        command_on: 'JgBgAB4dHR06OjsdHR0eHB4dHjkeHTodHgALnB0dHR07OjscHh0eHB0dHzkdHTscHgALnB8cHhw7OTsdHhwfHB4cHjkfHDscHgALnB4cHxs8OTwcHhweHB4cHzkeHDwcHgANBQAAAAAAAAAA'
        command_off: 'JgBgAB4dHR06OjsdHR0eHB4dHjkeHTodHgALnB0dHR07OjscHh0eHB0dHzkdHTscHgALnB8cHhw7OTsdHhwfHB4cHjkfHDscHgALnB4cHxs8OTwcHhweHB4cHzkeHDwcHgANBQAAAAAAAAAA'
  - platform: mqtt
    name: "Tablet Display schalten"
    state_topic: "homeassistant/switch/android_yoga_tablettablet_screen/state"
    command_topic: "homeassistant/switch/android_yoga_tablettablet_screen/set"
    value_template: "{{value_json.state}}"
  - platform: mqtt
    name: "Nokia Display schalten"
    state_topic: "homeassistant/switch/android_nokia_8_ariela_screen/state"
    command_topic: "homeassistant/switch/android_nokia_8_ariela_screen/set"
    value_template: "{{value_json.state}}"
    
# TP-Link
tplink:
  discovery: false
  switch:
    - host: 192.168.178.112

# Media Player
media_player:
  - platform: smartir
    name: Telestar
    device_code: 1000
    controller_send_service: switch.broadlink_send_packet_192_168_178_71
    power_sensor: binary_sensor.telestar
  - platform: androidtv
    name: Firetv
    host: 192.168.178.53
    adbkey: "/config/android/adbkey"
    adb_server_ip: 192.168.178.63
    
# Google Home Sensor
googlehome:
   devices:
    - host: 192.168.178.70
      track_alarms: true
      track_devices: false
    - host: 192.168.178.88
      track_alarms: true
      track_devices: false

# Kamera
camera:
  - platform: mjpeg
    mjpeg_url: http://192.168.178.36:8080/video

android_ip_webcam:
  - host: 192.168.178.36
    port: 8080
    sensors:
      - motion

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

I also have a “Config Warning” in the UI. I have made a mark in the respective lines, because unfortunately I do not know how to indicate the line number. Here is a screenshot …

Maybe someone can help me, I do not see the mistakes …

I have Hass.io running in version 90.0, an update to version 91.0 does not work either …

Thank you in advance

OK -

No, it doesn’t matter what order the keys are in, there must’ve been another problem but if it is working now then leave it where it is.

The first error ‘false retain’ - if you look at the switch you’ve named NodeMCU (the first one under your switch: key) the last two lines should read

optimistic: false
retain: true

… But you’ve accidentally put the word false on the line below.

The last two errors refer to your sensors for “Nokia8 display” and “tablet display” - completely remove the lines beginning with command_topic: for these, there is no command topic for sensors.

Hope this helps :+1:

1 Like

Thank you mf_social, the errors are no longer available.

:checkered_flag::+1::+1:

I only have 500 MB of free memory on my SD card, is it possible that the update does not work?

1 Like