However, I now have a problem with getting my Home Assistant config to pass testing on travis-ci.org. Like some other users I share and backup my config up to GitHub. When my new code hits GitHub, Travis goes to work testing the code for errors.
Since I installed HACS Travis reports an error Integration not found: hacs. My repository already contains the /custom_components/hacs folder and code, so I would expect hass on travis to see that component’s code.
Taking a step back, it was a struggle to get HACS installed properly. To get it working I had to place the hacs: definition in my configuration.yaml as a top-level component. It had to be at the same depth as homeassistant: to work properly, which shocked me and still doesn’t seem right. Could that be the problem? The component’s author doesn’t think the problem is related to his component, so here I am asking the community.
I ran the same check_config script that runs on Travis, on my server and it does not return the same error. (The hass -c ./ --script check_config --info all line.)
@anon43302295 The code in my original post above is where I started.
The error remained the same regardless of the inclusion of those commands you discovered. I tried to work around the problem by adding the HACS terminal installation instructions. But the hacs code is already available in the custom_components folder, so it isn’t necessary and did not help.
I removed this explanation from the original post to keep from confusing the situation. Since it now has, I have removed it from my repo. As far as it being a mess. Yeah, troubleshooting can be messy. Had it worked I would have put in a bash script and collapsed it to a single line in the .travis file.
hacs updates a lot… i don’t want that many files changing with every commit. So i just removed it from the travis configuration. Just add this oneliner
sed -e '/hacs/,+2d' < configuration.yaml > configuration.yaml
I am very intrigued by this solution. I vaguely aware of sed, but I have never used it.
So, if I copy configuration.yaml to test.yaml, and then run sed -e '/hacs/,+4d' < temp.yaml it outputs my config, without the hacs: section. Great. Unfortunately, adding the > temp.yaml to the end causes the temp.yaml to be emptied.
Here are the commands in order to replicate this. (I am preforming the sed command on my Ubuntu Server before I add it to my .travis file.)
This has to be done for each hacs-installed custom component that requires some yaml configuration.
In the end you’ll be testing some parts of your config, but not the whole config anymore.
Would be great if there would be a proper solution to make travis install hacs and the required components. @ludeeus any chance to get this working? Any best practices?
The newest version of HACS can be added via the UI (Configuration -> Integrations). First, remove the hacs: section from configuration.yaml, then restart and add HACS via “Integrations”.
Unfortunately this is only right if all components installed via have are also set up with the UI integration.
If there’s only a single one that’s using yaml setup, the check will fail.
No, this has to be done for all custom_components, no matter how you “install” them.
HACS “is just a downloader”.
You can try adding this as a script that runs before your checks.
for file in $(find custom_components/ -name "manifest.json"); do cat "$file" | for req in $(jq .requirements[]); do python3 -m pip install $(echo "$req" | jq -r .) ; done ; done
With that said, If it where me I would have the YAML for all custom_components in a single package, and just add the entire custom_components dir and that package file to my .gitignore file
That way I’m not republishing these (sometimes huge) custom_components.
Thanks for the input.
As you mentioned I also don’t want to have the custom component code in my config repo.
I guess the best way forward is to help component developers add integrations support and not even having to add the component to the yaml configuration.