I have a small hobby: in my free time I create my own smart home system based on Home Assistant.
And, like any program, it gradually becomes more and more. And it is becoming more and more difficult to keep in mind the internal interrelations of its various components. Therefore, testing comes to the rescue through a system of continuous integration. I use Travis CI.
I like this system, but it has one feature — it uses the data publicly posted on GitHub. And to test the Home Assistant configuration, you need a secrets.yaml file, which contains various parameters that are not allowed for open publishing.
How to be?…
For myself, I solved this problem in the style of a “lazy programmer” — I wrote a script that can create a fake secrets.yaml file based on the original one. It saves all the same fields, but fills them with random data.
The idea turned out to be very useful…
You can always find the code for this and other tricks in the repository of my config for HA:
Yes, you can exclude secrets.yaml. I say more: you MUST exclude secrets.yaml from git.
But above I write about continuous testing configs for errors. And for that purpose you need to have some secrets.yaml file. You have to be an idiot to share the original file in open access. That’s why I created a fake secrets.yaml generator.
Local instance may be convenient for some needs, but Travis CI provides a free service only for projects publicly hosted on GitHub.
I think the point is, that when you exclude your real secrets.yaml, but then put a fake secrets.yaml in your repo, you have a conflict. Hance creating a fake one on the fly during CI can be useful.
But to create a fake secrets.yaml at the time of testing is impossible, because we can no longer find out at this moment what the field names were. It is possible to create fake secrets.yaml only having the original secrets.yaml before your eyes.
The conflict will be if you put fake secrets.yaml exactly in place of the original in the repository. Then when updating configs from the git, you destroy the original secrets.yaml.
That is why fake secrets.yaml are stored in a separate file and are copied to the place of original secrets.yaml only in a temporary environment at the very last moment before testing.
Administering a git server is a lot of work. I’d simply use Gitlab instead of Github. There you can setup as many repos as you like, and you can have every repo either hidden, for members only or public. Saves the hassle in administering.
But since this is also an online service, this changes nothing about the secrets.yaml.
@Limych Thanks, that comes in handy, I’m just setting up my gitlab repo. Including testing
You have a problem not with Home Assistant, but specifically with ZWave. Here I can not help you, because I do not use this system and have no experience of using it. Sorry.
I like it when the background music in the house. There is a media server that can distribute music to the speakers. But I like listening to the radio more.
In Home Assistant there is no regular convenient way to maintain a list of radio stations. Enthusiasts have come up with a way to get around this boundary in a couple of automation scripts (Combined music player). But editing them in the usual way is difficult - you have to dig into long lists of URLs and text strings. High probability of error.
Going along the path of a “lazy programmer”, I wrote a script that makes changes to the automation scripts for me:
For its work, I just need to make a list of radio stations, similar to the usual YAML: