Are we losing have included including folders in the Configuration

I’ll give this a go… :wink:

first create a folder in your config directory called “templates”.

then under that folder create folders called “sensors”, “climates”, “covers”, “switches”, etc. Basically create a subfolder in the templates folder for any domain that you had a template for in those other folders.

then move all of the yaml files from your other included folders that contain templates (things that have “platform: template” in the config). if those files contain other platforms other than “platform: template” entries then leave the original file in it’s original location and just move the entries that are “platform: template” from those files to the new folders/files.

then perform the conversion from the old legacy “platform: template” version to the new template domain version in the new files per the repair notification.

once that’s done then in configuration.yaml add another include:

template: !include_dir_merge_list templates/

do a config check. if all is good then restart HA.

1 Like

How deep can I drill with Folders in the template folder

I’m assuming when you say “drill” you mean having subfolders inside of subfolders? If so TBH I’m not 100% sure since I don’t use includes like that.

All of mine are just yaml files inside of folder directly in my config directory.

ok it seems to support sub folders in sub folders I am 3 deep on my sub folders and it grabbing everything

Thanks for your help

1 Like

If you are using !include_dir_merge_list the yaml parser is only limited by your system file system or system memory.

Theoretically you could have thousands of levels of subfolders as long as the full file path name doesn’t exceed your OS’es limitations and as the yaml parser doesn’t exceed system memory while recursively processing the subfolders.

1 Like

Welp with this Breaking Change I decided it was time to do some serious house cleaning in home assistant and completely rebuilt it from the ground up updated it to the latest, redid all the templates to meet the change redid the scripts and Automations only took about a month to get through it all, but now the stuff that is no longer valid is gone and everything is now more organized and built through the GUI instead of direct yaml editing

for those that helped me understand the breaking change thank you

Apologies for asking dumb questions again, but I’m also trying to migrate, and it still does not work for me. In my configuration.yaml I have:

template:
  cover: !include_dir_merge_list templates/covers/
  fan: !include_dir_merge_list templates/fans/
  sensor: !include_dir_merge_list templates/sensors/
  binary_sensor: !include_dir_merge_list templates/binary_sensors/
  switch: !include_dir_merge_list templates/switches/

But then in the file located in templates/sensors folder - this:

#----- Wind --
    - unique_id: wind_speed_kmh
      name: "Wind speed"
      unit_of_measurement: 'km/h'
      state: >
          {{ (states('sensor.wind_speed')|float*3.6)|round(1) }}
      availability: >
          {{ is_number(states('sensor.wind_speed')) }}

    - unique_id: wind_gustspeed_kmh
      name: "Wind speed"
      unit_of_measurement: 'km/h'
      state: >
          {{ (states('sensor.wind_gustspeed')|float*3.6)|round(1) }}
      availability: >
          {{ is_number(states('sensor.wind_gustspeed')) }}

    - unique_id: wind_speed_kn
      name: "Wind speed"                                                                                                                                                                                                                                   
      unit_of_measurement: 'kn'
      state: >
          {{ (states('sensor.wind_speed')|float*1.9438444924)|round(1) }}
      availability: >
          {{ is_number(states('sensor.wind_speed')) }}

    - unique_id: wind_gustspeed_kn
      name: "Wind speed"
      unit_of_measurement: 'kn'
      state: >
          {{ (states('sensor.wind_gustspeed')|float*1.9438444924)|round(1) }}
      availability: >
          {{ is_number(states('sensor.wind_gustspeed')) }}

… and those sensors are not recognized. At the same time - no errors in HA that would help understand the reason… What am I missing?

your sensors will now go into the template folder

so lose the include sensor and include binary sensor lines

and put in include template line

create a templates folder
you then can either put sub folders in that templates folder or you can put your YAML files in it

I chose to put sub folders to break down what yaml file is for

“\192.168.1.123\config\templates\garage\garage_door_south\garagedoorsouth.yaml”

Below is my config file include lines

automation: !include automations.yaml
climate: !include_dir_merge_list climates/
input_boolean: !include_dir_merge_named input_booleans/
scene: !include scenes.yaml
script: !include scripts.yaml
switch: !include_dir_merge_list switches/
template: !include_dir_merge_list ./templates/

and this is what is included in my Garage Door YAML

- sensor:
  - default_entity_id: sensor.garage_door_south_state
    name: Garage Door South Status
    state: "{% if states('sensor.garage_doors_general_purpose_2') | float > 1000 %}\n
      \ on\n{% else %}\n  off\n{% endif %}"

- sensor:
  - default_entity_id: sensor.garage_door_south_position
    name: Garage Door South Position
    state: "{% if is_state('sensor.garage_door_south_state' , 'on') %}\n  Open\n{%
      elif is_state('sensor.garage_door_south_state' , 'off') %}\n  Closed\n{% else
      %}\n  Unknown\n{% endif %}"

- cover:
  - device_class: garage
    open_cover:
    - data:
        entity_id: switch.garage_doors_4
      action: switch.toggle
    close_cover:
    - data:
        entity_id: switch.garage_doors_4
      action: switch.toggle
    default_entity_id: cover.garage_south
    name: Garage South
    state: '{{ states(''sensor.garage_door_south_position'') }}'
1 Like

Thank you, your approach makes sense. I’ve restructured mine, and it works now :+1:

1 Like