Creating my first package

Hello! I’m transitioning from Hubitat to HA. So far it has been a good experience. I’m trying to create my first package but im not sure what the best practices are for filesystem structure. is there a way to make this structure work or do i need to reorganize the files/folders?

└── homeassistant
    ├── automations.yaml
    ├── config
    │   └── packages
    │       ├── foobar
    │       │   ├── automations.yaml
    │       │   ├── inputs.yaml
    │       │   └── sensors.yaml
    │       └── helloworld
    │           ├── automations.yaml
    │           ├── inputs.yaml
    │           └── sensors.yaml
    ├── configuration.yaml
    ├── scenes.yaml
    ├── scripts.yaml
    └── secrets.yaml

configuration.yaml

# Loads default set of integrations. Do not remove.
default_config:

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

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

homeassistant:
  packages:
    !include_dir_named config/packages/

I haven’t used pacvkages this complex, but it looks like you are including automations, scripts and sensors twice. Once as an include and once as a package.

Just what are you trying to accomplish?

Thats basically a requirement if you want to use a mix of YAML and GUI stuff since the GUI automatinos for example are stored in the automations.yaml file.

Explain please. I tend to avoid GUI, but I don’t see how this has anything to do with loading the configurations twice.

I just had another look at the image above and yeah, it’s a bit wrong. The package files would have headers for automation:, script: etc. but not actual files.

So what I was getting at was that you still need the overall automations.yaml file for GUI stuff on top of the package files. The image above (which I missed originally) has sub-files for each domain rather than file headers.

You don’t have files underneath the foobar.yaml file. Those domain files you show need to be headers within foobar.yaml.

eg:
This is in config\packages\dog.yaml

This is in config\packages\ensuite_light.yaml

I guess what’s confusing me is the “GUI stuff”. All my packages and includes are yaml.

Anything you create directly in here:

I know what the GUI is. What does that have to do with packages and includes?

Sorry, I’m a software developer/engineer by trade, so I get a little carried away with maintaining things in code. I guess the easier way to understand what I’m trying to accomplish is that I would like to maintain anything I make/configure/customize/etc for my HA in source control. I’d like to set up a git repo for each package under the packages directory. this will allow me to 1) run git clone to “install” packages 2) version control my HA config(s) and 3) commit changes as needed for new or deprecated functionality.

Well you need to include both the files that the GUI saves to and the files in the packages…

ie:
configuration.yaml

homeassistant:
  customize: !include customize.yaml # Customization file done in YAML
  packages: !include_dir_named packages # package setup done in YAML

automation: !include automations.yaml  # this is where the GUI saves to
group: !include groups.yaml    # also where the GUI saves to...

I think that’s where I was stuck… !include_dir_named packages doesn’t work for me. When I was testing I was able to get the inputs.yaml (helpers) to show up using !include_dir_list packages but that was the only thing that showed up in the UI. either I’m using the wrong syntax or I’m using the wring !include method? Here is a link to the branch that I’m working on for my setup.