Is there something special about automations and packages?
I am in the process of converting to packages but if I have an automations.config and the associated !include my packaged automations do not seem to be loaded.
Is there something special about automations and packages?
I am in the process of converting to packages but if I have an automations.config and the associated !include my packaged automations do not seem to be loaded.
On further investigation, it seems that ‘reloading automations’ will unload those in packages before only reloading those in the base config.
Restarting HA appears to load both the config and the packages.
Is this correct behaviour or am I doing something wrong?
It seems a shame it can’t at least leave the packaged automations alone during a ‘reload automations’ even if there is a good reason why it can’t reload them.
This is normal, if you’re using packages restart homeassistant when you make changes.
Ok, I was just adding reply to say that I thought I had now confirmed that to myself. But can you use a mix of packages and !includes? It is beginning to look to me like the answer is no. (But I am rewriting my system into packages so I might have introduced other issues that is clouding the issue).
In either case what is the best practice? Packages are great, but a pain when testing. What do other people do to avoid having to restart every time you make a small change and want to test it?
Yes, you can use includes.
Basically when homeassistant runs it uses one single configuration.yaml file. Includes and packages are just ways for us to break it up so that we can interact with the code in manageable chunks. When you run homeassistant it merges them all together.
When it finds an include it drops a line, indents two characters and adds the contents of the included file.
When it finds a package it adds the component options defined in the package to those components in configuration.yaml.
There is no ‘avoid having to restart every time you make a small change’, if you’re using packages. I don’t know how long ‘reload automations’ takes on a non-packaged setup, but I don’t think the 30 seconds it takes to restart homeassistant adds that much inconvenience to testing tbh.
Thanks for the explanation. It helps to understand exactly what is going on.
30 seconds isn’t a huge problem (although I think it is closer to a minute on my Pi) I had just got used to the 5 seconds when reloading automation and scripts.
So long as I know there is no way around it I’m happy
One last question on packages, can you have child folders? Will they be included?
Thanks again…
Yeah, my configuration.yaml is literally just including the packages, then I have folders with all the packages in (grouped by type), and then the packages contain includes for repeated code or long configuration options.
It’s as flexible as you want it to be.
wish the HASS developer could find a way though. I moved almost everythging to packages, it makes fixing and programming much more easy IMO
The issue I’m having with restarting is that it takes my z-wave network several minutes to be ready again (I have about 45 z-wave devices). So, if I’m developing an automation that includes a z-wave device, a restart takes about 3-5 min before I can command a z-wave device.
It’s not exactly setting the world on fire but you could look here!
https://community.home-assistant.io/t/reload-when-using-packages/52664
I don’t thing promoting feature requests is against the rules but if it is I am sorry.