Please ⭐ this repo if you find it useful
The component and platforms in this repository are not meant to be used by a user, but as a "blueprint" that custom component developers can build upon, to make more awesome stuff.
HAVE FUN! 😎
This is simple, by having custom_components look (README + structure) the same it is easier for developers to help each other and for users to start using them.
If you are a developer and you want to add things to this "blueprint" that you think more developers will have use for, please open a PR to add it :)
This repository contains multiple files, here is a overview:
File | Purpose |
---|---|
.devcontainer/* |
Used for development/testing with VSCODE, more info in the readme file in that dir. |
.github/ISSUE_TEMPLATE/feature_request.md |
Template for Feature Requests |
.github/ISSUE_TEMPLATE/issue.md |
Template for issues |
.vscode/tasks.json |
Tasks for the devcontainer. |
custom_components/integration_blueprint/translations/* |
Translation files. |
custom_components/integration_blueprint/__init__.py |
The component file for the integration. |
custom_components/integration_blueprint/api.py |
This is a sample API client. |
custom_components/integration_blueprint/binary_sensor.py |
Binary sensor platform for the integration. |
custom_components/integration_blueprint/config_flow.py |
Config flow file, this adds the UI configuration possibilities. |
custom_components/integration_blueprint/const.py |
A file to hold shared variables/constants for the entire integration. |
custom_components/integration_blueprint/manifest.json |
A manifest file for Home Assistant. |
custom_components/integration_blueprint/sensor.py |
Sensor platform for the integration. |
custom_components/integration_blueprint/switch.py |
Switch sensor platform for the integration. |
tests/__init__.py |
Makes the tests folder a module. |
tests/conftest.py |
Global fixtures used in tests to patch functions. |
tests/test_api.py |
Tests for custom_components/integration_blueprint/api.py . |
tests/test_config_flow.py |
Tests for custom_components/integration_blueprint/config_flow.py . |
tests/test_init.py |
Tests for custom_components/integration_blueprint/__init__.py . |
tests/test_switch.py |
Tests for custom_components/integration_blueprint/switch.py . |
CONTRIBUTING.md |
Guidelines on how to contribute. |
example.png |
Screenshot that demonstrate how it might look in the UI. |
info.md |
An example on a info file (used by hacs). |
LICENSE.md |
The license file for the project. |
README.md |
The file you are reading now, should contain info about the integration, installation and configuration instructions. |
requirements.txt |
Python packages used by this integration. |
requirements-dev.txt |
Python packages used to provide IntelliSense/code hints during development of this integration, typically includes packages in requirements.txt but may include additional packages |
requirements-text.txt |
Python packages required to run the tests for this integration, typically includes packages in requirements-dev.txt but may include additional packages |
-
…or create a new repository on the command line:
# Initialize your new origin repository git init git remote add origin https://github.com/YOUR_NEW_REPOSITORY # Apply blueprint repository git remote add blueprint https://github.com/Limych/ha-blueprint.git git fetch blueprint dev git reset --hard blueprint/dev git branch -M dev # Push changes to origin repository git push -u origin dev
-
…or apply blueprint to an existing repository from the command line:
# Apply blueprint repository git remote add blueprint https://github.com/Limych/ha-blueprint.git git fetch blueprint dev git merge blueprint/dev --allow-unrelated-histories # Push changes to origin repository git push -u origin dev
After these steps, your repository will developing on a own branch. But in parallel there will be this blueprint repository, new changes in which you can always apply with a couple of simple commands:
./bin/update
git merge blueprint/dev
Note: Please, before starting to develop your own code, initialize the development environment with the command
./bin/setup
If you want to use all the potential and features of this blueprint template you should use devcontainer. See .devcontainer/README.md for more information.
If you need to work on the python library in parallel of this integration
(sampleclient
in this example) there are different options. The following one seems
easy to implement:
- Create a dedicated branch for your python library on a public git repository (example: branch
dev
onhttps://github.com/ludeeus/sampleclient
) - Update in the
manifest.json
file therequirements
key to point on your development branch ( example:"requirements": ["git+https://github.com/ludeeus/sampleclient.git@dev#devp==0.0.1beta1"]
) - Each time you need to make a modification to your python library, push it to your
development branch and increase the number of the python library version in
manifest.json
file to ensure Home Assistant update the code of the python library. (example"requirements": ["git+https://...==0.0.1beta2"]
).
README content if this was a published component:
Please ⭐ this repo if you find it useful
Component to integrate with integration_blueprint.
This component will set up the following platforms.
Platform | Description |
---|---|
binary_sensor |
Show something True or False . |
sensor |
Show info from blueprint API. |
switch |
Switch something True or False . |
- Some example limitation.
- Have HACS installed, this will allow you to easily manage and track updates.
- Search for "Blueprint".
- Click Install below the found integration.
- If you want to configure component via Home Assistant UI...
in the HA UI go to "Configuration" -> "Integrations" click "+" and search for "Integration blueprint". - If you want to configure component via
configuration.yaml
...
follow instructions below, then restart Home Assistant.
- Using the tool of choice open the directory (folder) for your HA configuration (where you find
configuration.yaml
). - If you do not have a
custom_components
directory (folder) there, you need to create it. - In the
custom_components
directory (folder) create a new folder calledintegration_blueprint
. - Download file
integration_blueprint.zip
from the latest release section in this repository. - Extract all files from this archive you downloaded in the directory (folder) you created.
- Restart Home Assistant
- If you want to configure component via Home Assistant UI...
in the HA UI go to "Configuration" -> "Integrations" click "+" and search for "Blueprint". - If you want to configure component via
configuration.yaml
...
follow instructions below, then restart Home Assistant.
* * *
I put a lot of work into making this repo and component available and updated to inspire and help others! I will be glad to receive thanks from you — it will give me new strength and add enthusiasm:
or support via Bitcoin or Etherium:
16yfCfz9dZ8y8yuSwBFVfiAa3CNYdMh7Ts
You can automatically track new versions of this component and update it by HACS.
To enable debug logs use this configuration:
# Example configuration.yaml entry
logger:
default: info
logs:
custom_components.integration_blueprint: debug
... then restart HA.
This is an active open-source project. We are always open to people who want to use the code or contribute to it.
We have set up a separate document containing our contribution guidelines.
Thank you for being involved! 😍
The original setup of this component is by Andrey "Limych" Khrolenok.
For a full list of all authors and contributors, check the contributor's page.
creative commons Attribution-NonCommercial-ShareAlike 4.0 International License
See separate license file for full text.