Custom component : yet another template to help you start quickly with cookiecutter

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.

2 Likes

New version of my cookiecutter, synchronized with the latest version of Ludeeus repositiory (called now intergration_blueprint to avoid confusion with the new Blueprints feature) and with some additions:

  • Dedicated documentation on ReadTheDoc
  • Add some linting and CI features.
  • Add settings and documentation for step by step debugging in Visual Studio Code (VSC).

Don’t hesitate to share your feedback or expectations here.

2021.1.1 version released.

The main improvement is the addition of tests suite with 100% code coverage of the generated project cookiecutter.

Thanks to @raman325 who contributed a lot to this release.

1 Like