When I have worked on custom components, I used to copy/paste the blueprint template maintained by Ludeeus and promoted by HACS.
I remind having some difficulties to find all the places where I needed to change names or entity ids before having a basic custom component working.
I’ve recently discovered cookiecutter to manage templates.
So I’ve created a cookiecutter template to generate Home Assistant custom component based on blueprint. You can customized all names used in the template by running the command and follow the instructions:
$ cookiecutter gh:oncleben31/cookiecutter-homeassistant-custom-component --checkout=2021.1.1
Then the repository generated is ready to be tested locally in a development container or installed thru HACS in any other Home Assistant instance. You can focus in adapting the code with your features.
Current features (edited after the 2021.1.1):
- Ready to use Home Assistant custom component
- UI configuration with config Flow
- Translations
- Development, testing and step by step debugging in Visual Studio Code development container
- HACS ready
- Continuous integration with GitHub Actions workflows
- Settings for pre-commit
- Optional tests suite with pytest and 100% code coverage
To get more information, contribute or read the doc, please check:
I will work on it, keeping it up to date with future blueprint enhancements, adding CI, best practices of Python programming, and perhaps merge with another similar initiative which have a different approach.
I hope it will be useful for the community and I’m open to any feedback.