Spliting configuration

I do want to split the configuration:

I read a lot of error-threads, but can not filter out, why mine is not working.

1st try:

homeassistant:
  packages: !include_dir_merge_named packages

Error message for try one:

expected a dictionary for dictionary value @ data['packages']['shell_command']

2nd try:

homeassistant:
  packages:
    mailcowaliases: !include packages/packages_dir/package_file.yaml

3nd try: 8with and without trailing /)

homeassistant:
  packages:
    mailcowaliases: !include_dir_merge_list packages/

But none of them worked the way I expected.

At first, I have to full restart HA from developer tools to update changes.
The only version I got to work for the half was version two, but I do not want to give all the names of all yaml-files to the config.

here are three versions of the yaml, all have some other error messages as long as I change some of the above lines in configuration.yaml.
At the moment I got no message on restart, I got a message for the shell_command after pressing the button. But this is part of an other thread.

- input_text:

    txt_1:
      name: "txt_1"
      initial: "1"

    txt_2:
      name: "txt_2"
      initial: "2"


- input_button:

    btn_1:
      name: "btn_1"

    btn_2:
      name: "btn_2"


- shell_command:

    shellcommand_add_la: >
      curl "https://subd.dom.tld" \
      -X POST \
      --header "Content-Type: application/json" \
      --header "X-K: xxx" \
      --header "Authorization: Basic xxx" \
      -d "{\"ad\" : \"{{ states('input_text.txt_la') }}\", \"active\": 1,\"comment\": \"\"}"

    shellcommand_add_la: >
      curl "https://subd.dom.tld" \
      -X POST \
      --header "Content-Type: application/json" \
      --header "X-K: xxx" \
      --header "Authorization: Basic xxx" \
      -d "{\"ad\" : \"{{ states('input_text.txt_la') }}\", \"active\": 1,\"comment\": \"\"}"

an other version:

input_text:

  txt_1:
    name: "txt_1"
    initial: "1"

  txt_2:
    name: "txt_2"
    initial: "2"


input_button:

  btn_1:
    name: "btn_1"

  btn_2:
    name: "btn_2"


shell_command:

  shellcommand_add_la: >
    curl "https://subd.dom.tld" \
    -X POST \
    --header "Content-Type: application/json" \
    --header "X-K: xxx" \
    --header "Authorization: Basic xxx" \
    -d "{\"ad\" : \"{{ states('input_text.txt_la') }}\", \"active\": 1,\"comment\": \"\"}"

  shellcommand_add_la: >
    curl "https://subd.dom.tld" \
    -X POST \
    --header "Content-Type: application/json" \
    --header "X-K: xxx" \
    --header "Authorization: Basic xxx" \
    -d "{\"ad\" : \"{{ states('input_text.txt_la') }}\", \"active\": 1,\"comment\": \"\"}"

an other version

- input_text:
  
    - txt_1:
        name: "txt_1"
        initial: "1"
	  
    - txt_2:
        name: "txt_2"
        initial: "2"
  
  
- input_button:
  
    - btn_1:
        name: "btn_1"
	  
    - btn_2:
        name: "btn_2"
	  
  
- shell_command:
  
    - shellcommand_add_la: >
        curl "https://subd.dom.tld" \
        -X POST \
        --header "Content-Type: application/json" \
        --header "X-K: xxx" \
        --header "Authorization: Basic xxx" \
        -d "{\"ad\" : \"{{ states('input_text.txt_la') }}\", \"active\": 1,\"comment\": \"\"}"
	  
    - shellcommand_add_la: >
        curl "https://subd.dom.tld" \
        -X POST \
        --header "Content-Type: application/json" \
        --header "X-K: xxx" \
        --header "Authorization: Basic xxx" \
        -d "{\"ad\" : \"{{ states('input_text.txt_la') }}\", \"active\": 1,\"comment\": \"\"}"
  

I’m using packages (my directory is named the same):


homeassistant:

#### PACKAGES
  packages: !include_dir_named packages

My packages directory (example weather package):
/config
— packages
—— weather
——— automations_weather
———— freeze_warning.yaml
———— storm_warning.yaml
——— sensors_weather.yaml

Example /config/packages/weather/automations_weather/freeze_warning.yaml:

automation:

- id: blabla1
      alias: bla1
      trigger: …

- id: blabla2
      alias: bla2
      trigger: …

See: Splitting Configuration using packages - #5 by AhmadK and Packages - Home Assistant

Do you have shell_commands (Multiline?), input_text or input_button declared, too?

I see something, that I can not unterstand, too.

I used

include_dir_merge_list

or

include_dir_merge_named

You use:

include_dir_named

I tried with your version and have:

- input_text:
  
    - txt_1:
      name: "txt_1"
      initial: "1"
	  
    - txt_2:
      name: "txt_2"
      initial: "2"

I think like you wrote, but I get this error:

Package package_file setup failed. Component input_text cannot be merged. Expected a dict.

Compare it with my example.

File example.yaml:


input_boolean:
  boolean_one:
    name: Bool one
    icon: mdi:cat


  boolean_two:
    name: Bool two
    icon: mdi:dog


input_text:
    text_one:

    text_two:


my fault (copy and paste).

I have this.

```
input_text:

- txt_1:
name: “txt_1”
initial: “1”

- txt_2:
name: “txt_2”
initial: “2”
```

I removed everything else out of the file and tried to check the config via developer tools and got:

</s> <s>Package package_file setup failed. Component input_text cannot be merged. Expected a dict.</s> <s>

I use:

packages: !include_dir_named packages

I use now:

input_text:

  txt_1:
    name: "txt_1"
    initial: "1"
  
  txt_2:
    name: "txt_2"
    initial: "2"

And I got no errors by testing, no I move on to test the resst.

Which button do I have to press to reload the full package instead restart HA all the time and wait 3 minuntes.

Go to Developer Tools —> YAML. There you can see the integrations that can be reloaded without restarting HA.

Yes, but I do not want to try them all out if I made some changes to differents entitiy-types in one package.

?

If, for instance, a package contains an automation, an input_number and a script, and you edit all three, you have to reload those three. Or am I misunderstanding you?

No, but I want to reload the whole package-yaml, instead of clicking on all things one by one.
Maybe I forgot that I changed parts of the sensor and only reload the automation part.

In this case, at least I know of no other possibility than to restart HA.

lazy man, me, remembered about autohotkey … some research and developing later … I have a Hotkey which does this job for me, I have only wait some seconds :smiley:

You wish will be fulfilled in the upcoming core release: Quick Reload