Splitting Configuration Files

I’m looking for some help with splitting out my configuration.yaml file. I read through the Splitting up the configuration help docs but I seem to be missing something.

This is the code in my configuration.yaml file I am trying to split out into another page…

template:
  - sensor:
      - name: Downstairs HVAC Activity
        state: "{{ state_attr('climate.downstairs_thermostat', 'hvac_action') }}"

sensor:
  # HVAC Stats
  - platform: history_stats
    name: Downstairs Heating Today
    entity_id: sensor.downstairs_hvac_activity
    state: "heating"
    type: time
    start: "{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}"
    end: "{{ now() }}"

  - platform: history_stats
    name: Downstairs Cooling Today
    entity_id: sensor.downstairs_hvac_activity
    state: "cooling"
    type: time
    start: "{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}"
    end: "{{ now() }}"

  - platform: template
    sensors:
      hvac_today:
        friendly_name: "Downstairs HVAC Today"
        unit_of_measurement: "H"
        value_template: '{{ states("sensor.downstairs_cooling_today") |float + states("sensor.downstairs_heating_today") | float }}'

utility_meter:
  heating_time_daily:
    source: sensor.downstairs_heating_today
    name: Downstairs Heating Time Daily
    cycle: daily
  heating_time_weekly:
    source: sensor.downstairs_heating_today
    name: Downstairs Heating Time Weekly
    cycle: weekly
  heating_time_monthly:
    source: sensor.downstairs_heating_today
    name: Downstairs Heating Time Monthly
    cycle: monthly
  heating_time_yearly:
    source: sensor.downstairs_heating_today
    name: Downstairs Heating Time Yearly
    cycle: yearly
  cooling_time_daily:
    source: sensor.downstairs_cooling_today
    name: Downstairs Cooling Time Daily
    cycle: daily
  cooling_time_weekly:
    source: sensor.downstairs_cooling_today
    name: Downstairs Cooling Time Weekly
    cycle: weekly
  cooling_time_monthly:
    source: sensor.downstairs_cooling_today
    name: Downstairs Cooling Time Monthly
    cycle: monthly
  cooling_time_yearly:
    source: sensor.downstairs_cooling_today
    name: Downstairs Cooling Time Yearly
    cycle: yearly
  hvac_time_filter:
    source: sensor.downstairs_hvac_today
    name: Downstairs HVAC Time Filter
    cycle: yearly

I tried to edit this…

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

By changing it to this…

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
hvac: !include hvac.yaml

Then, of course, I moved all that code into the hvac.yaml file but upon restart I get an error…

Logger: homeassistant.setup
Source: setup.py:275
First occurred: 4:40:49 PM (1 occurrences)
Last logged: 4:40:49 PM

Setup failed for 'hvac': Integration not found.

Do I need to create a yaml file for everything such as utility_meter, history_stats, sensor & template or is there some way to put everything is one hvac.yaml file?

Any help or insight is appreciated, thanks in advance!

hvac is not an integration key.

If you want to be able to group different integrations in the same file, use Packages. This will give you a folder where you can have files that can contain a mix of integrations.

Okay, I read the Packages file and I edited my configuration.yaml file to contain…

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
packages: !include_dir_named packages

Then I created a folder called “packages” in the same folder as the configuration.yaml file and I uploaded the hvac.yaml file to that new folder and restarted HA but now Im prompted with another error…

Logger: homeassistant.setup
Source: setup.py:275
First occurred: 5:15:41 PM (1 occurrences)
Last logged: 5:15:41 PM

Setup failed for 'packages': Integration not found.

Not sure what Im missing here?

Update: It looks like I didn’t read the docs properly. Once I changed my configuration.yaml to this and restarted, it seems to be working now.

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

homeassistant:
  packages: !include_dir_merge_named packages/
1 Like