Merge duplicate keys for better configs

The yaml configuration is good for small setups. With more complex configuration, the configuration becomes large and hard to read. Modularization can only be done on a per-type base (e.g. all sensors in one file, all friendly_names in a different file).

Idea: Allow duplicate keys and merge them. Allow “include” on top level.

This allows to have e.g. all garden sensors, switches group and friendly names on one block or file and the living room stuff in a different one.

Hi
Can´t you use packages for that?

1 Like

Great, I did not know this (honestly, after reading about the 2 styles of writing config I did not expected a 3rd to be there ^^).
Seems that it can contain all except customizing :wink:

But that’s another story: Why “customizing” instead having entity_id and name as separate properties in all components? But I should create a new post for this…

Update: IMO packages should be mentioned in “splitting configuration”.

According to this post it works to put the customize in the package too:

1 Like

I use customising in packages, it works.

You need to put in homeassistant and then customizing. I will post an example when I get home.

I group my configuration by topic.

Harmony, Xiaomi, gpslogger,…

This will come with its own challenges I am sure when my configuration becomes more complex.

example media_player package with customize:


mediaplayers:

  media_player:
    - platform: sonos
      hosts: 192.168.1.10
      entity_namespace: 'sonos'
      
    - platform: cast
      host: 192.168.1.11
      entity_namespace: 'cast'
 
    
  homeassistant:
    customize:
      media_player.sonos_playbar:
        friendly_name: Playbar
        icon: mdi:speaker
        emulated_hue: true
        
      media_player.cast_upstairs__cast:
        icon: mdi:cast