Resources in configuration.yaml

Which is the correct indentation when putting resources from ui-lovelace.yaml to configuration.yaml?

Have a look here: https://www.home-assistant.io/lovelace/yaml-mode/
There is an example.

Indentation doesn’t matter, it just has to be consistent.

input_boolean:
  need_to_shovel:
    name: Need to Shovel
    icon: 'mdi:snowflake-alert'

  skip_shovel_updates:
    name: Skip Shovel Updates
    icon: 'mdi:do-not-disturb'

  test:
           name: Test indent
           icon: 'mdi:this-is-ok'
           initial: off

  test2:
        name: Cool Beans
        icon: 'mdi:this-is-still-ok'

As ugly as that is, it is still valid.

All things in a ‘group’ have to be at the same indentation level. In my exapmle, need_to_shovel, skip_shovel_updates, test, and test2 are all 2 spaces inside of input_boolean. The number of spaces isn’t important (though the fact that it’s spaces and not tabs is).

Under each ‘child/’ (group?), those elements are also all lined up with each other. In my example, name and icon are aligned underneath that child the same number. It doesn’t have to be consistent with anything outside of that child (I don’t know the correct terms for these things).

It is best to follow the same convention for consistency and readability, but the only requirement is to match your indentations to the file you’re pasting into at the correct levels.

UI lovelace uses 2 spaces indentation from the element name rather than 2 spaces from the list indicator (-).


views:
  - badges:
      - entity: binary_sensor.foyer_motion
      - entity: binary_sensor.wyzesense_motion
      - entity: binary_sensor.fire_alarms

But this is equally as valid

views:
  - badges:
    - entity: binary_sensor.foyer_motion
    - entity: binary_sensor.wyzesense_motion
    - entity: binary_sensor.fire_alarms

This is also valid if you’re insane.

views:
               - badges:
                               - entity: binary_sensor.foyer_motion
                               - entity: binary_sensor.wyzesense_motion
                               - entity: binary_sensor.fire_alarms
1 Like