Skip to content

Commit 3a1e1c8

Browse files
committed
Initial commit for Readme
1 parent 1e57eaf commit 3a1e1c8

23 files changed

+398
-833
lines changed

.devcontainer/configuration.yaml

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,4 @@ default_config:
22
logger:
33
default: error
44
logs:
5-
custom_components.blueprint: debug
6-
7-
8-
9-
blueprint:
10-
username: my_username
11-
password: my_password
12-
binary_sensor:
13-
- enabled: true
14-
name: My custom name
15-
sensor:
16-
- enabled: true
17-
name: My custom name
18-
switch:
19-
- enabled: true
20-
name: My custom name
5+
custom_components.readme: debug

.devcontainer/devcontainer.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@
99
],
1010
"extensions": [
1111
"ms-python.python",
12+
"github.vscode-pull-request-github",
1213
"tabnine.tabnine-vscode"
1314
],
1415
"settings": {
16+
"editor.tabSize": 4,
1517
"python.pythonPath": "/usr/local/bin/python",
1618
"python.linting.pylintEnabled": true,
1719
"python.linting.enabled": true,

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ In short, when you submit code changes, your submissions are understood to be un
2424

2525
## Report bugs using Github's [issues](../../issues)
2626

27-
GitHub issues are used to track public bugs.
27+
GitHub issues are used to track public bugs.
2828
Report a bug by [opening a new issue](../../issues/new/choose); it's that easy!
2929

3030
## Write bug reports with detail, background, and sample code

README.md

Lines changed: 59 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -1,151 +1,103 @@
1-
# Notice
2-
3-
The component and platforms in this repository are not meant to be used by a
4-
user, but as a "blueprint" that custom component developers can build
5-
upon, to make more awesome stuff.
6-
7-
This blueprint uses ['sampleclient'](https://github.com/ludeeus/sampleclient) to simulate what you actually might use in your integration.
8-
9-
HAVE FUN! 😎
10-
11-
## Why?
12-
13-
This is simple, by having custom_components look (README + structure) the same
14-
it is easier for developers to help each other and for users to start using them.
15-
16-
If you are a developer and you want to add things to this "blueprint" that you think more
17-
developers will have use for, please open a PR to add it :)
18-
19-
## What?
20-
21-
This repository contains multiple files, here is a overview:
22-
23-
File | Purpose
24-
-- | --
25-
`.devcontainer/*` | Used for development/testing with VSCODE, more info in the readme file in that dir.
26-
`.github/ISSUE_TEMPLATE/feature_request.md` | Template for Feature Requests
27-
`.github/ISSUE_TEMPLATE/issue.md` | Template for issues
28-
`.github/settings.yml` | Probot settings to control the repository settings.
29-
`.vscode/taks.json` | Tasks for the devcontainer.
30-
`custom_components/blueprint/.translations/*` | [Translation files.](https://developers.home-assistant.io/docs/en/next/internationalization_custom_component_localization.html#translation-strings)
31-
`custom_components/blueprint/__init__.py` | The component file for the integration.
32-
`custom_components/blueprint/binary_sensor.py` | Binary sensor platform for the integration.
33-
`custom_components/blueprint/config_flow.py` | Config flow file, this adds the UI configuration possibilities.
34-
`custom_components/blueprint/const.py` | A file to hold shared variables/constants for the entire integration.
35-
`custom_components/blueprint/manifest.json` | A [manifest file](https://developers.home-assistant.io/docs/en/creating_integration_manifest.html) for Home Assistant.
36-
`custom_components/blueprint/sensor.py` | Sensor platform for the integration.
37-
`custom_components/blueprint/switch.py` | Switch sensor platform for the integration.
38-
`CONTRIBUTING.md` | Guidelines on how to contribute.
39-
`example.png` | Screenshot that demonstrate how it might look in the UI.
40-
`info.md` | An example on a info file (used by [hacs][hacs]).
41-
`LICENSE` | The license file for the project.
42-
`README.md` | The file you are reading now, should contain info about the integration, installation and configuration instructions.
43-
`requirements.txt` | Python packages used by this integration.
44-
45-
***
46-
README content if this was a published component:
47-
***
48-
49-
# blueprint
1+
# Readme
502

513
[![GitHub Release][releases-shield]][releases]
524
[![GitHub Activity][commits-shield]][commits]
535
[![License][license-shield]](LICENSE.md)
546

55-
[![hacs][hacsbadge]][hacs]
7+
[![hacs][hacsbadge]](hacs)
568
![Project Maintenance][maintenance-shield]
579
[![BuyMeCoffee][buymecoffeebadge]][buymecoffee]
5810

5911
[![Discord][discord-shield]][discord]
6012
[![Community Forum][forum-shield]][forum]
6113

62-
_Component to integrate with [blueprint][blueprint]._
14+
_Use Jinja and data from Home Assistant to generate your README.md file_
6315

64-
**This component will set up the following platforms.**
65-
66-
Platform | Description
67-
-- | --
68-
`binary_sensor` | Show something `True` or `False`.
69-
`sensor` | Show info from blueprint API.
70-
`switch` | Switch something `True` or `False`.
71-
72-
![example][exampleimg]
7316

7417
## Installation
7518

7619
1. Using the tool of choice open the directory (folder) for your HA configuration (where you find `configuration.yaml`).
7720
2. If you do not have a `custom_components` directory (folder) there, you need to create it.
78-
3. In the `custom_components` directory (folder) create a new folder called `blueprint`.
79-
4. Download _all_ the files from the `custom_components/blueprint/` directory (folder) in this repository.
21+
3. In the `custom_components` directory (folder) create a new folder called `readme`.
22+
4. Download _all_ the files from the `custom_components/readme/` directory (folder) in this repository.
8023
5. Place the files you downloaded in the new directory (folder) you created.
8124
6. Restart Home Assistant
8225
7. Choose:
83-
- Add `blueprint:` to your HA configuration.
84-
- In the HA UI go to "Configuration" -> "Integrations" click "+" and search for "Blueprint"
26+
- Add `readme:` to your HA configuration.
27+
- In the HA UI go to "Configuration" -> "Integrations" click "+" and search for "Generate readme"
8528

8629
Using your HA configuration directory (folder) as a starting point you should now also have this:
8730

8831
```text
89-
custom_components/blueprint/.translations/en.json
90-
custom_components/blueprint/.translations/nb.json
91-
custom_components/blueprint/.translations/sensor.nb.json
92-
custom_components/blueprint/__init__.py
93-
custom_components/blueprint/binary_sensor.py
94-
custom_components/blueprint/config_flow.py
95-
custom_components/blueprint/const.py
96-
custom_components/blueprint/manifest.json
97-
custom_components/blueprint/sensor.py
98-
custom_components/blueprint/switch.py
32+
custom_components/readme/.translations/en.json
33+
custom_components/readme/__init__.py
34+
custom_components/readme/config_flow.py
35+
custom_components/readme/const.py
36+
custom_components/readme/default.j2
37+
custom_components/readme/manifest.json
38+
custom_components/readme/services.yaml
9939
```
10040

10141
## Example configuration.yaml
10242

10343
```yaml
104-
blueprint:
105-
username: my_username
106-
password: my_password
107-
binary_sensor:
108-
- enabled: true
109-
name: My custom name
110-
sensor:
111-
- enabled: true
112-
name: My custom name
113-
switch:
114-
- enabled: true
115-
name: My custom name
44+
readme:
11645
```
11746
11847
## Configuration options
11948
12049
Key | Type | Required | Description
12150
-- | -- | -- | --
122-
`username` | `string` | `False` | Username for the client.
123-
`password` | `string` | `False` | Password for the client.
124-
`binary_sensor` | `list` | `False` | Configuration for the `binary_sensor` platform.
125-
`sensor` | `list` | `False` | Configuration for the `sensor` platform.
126-
`switch` | `list` | `False` | Configuration for the `switch` platform.
51+
`convert_lovelace` | `boolean` | `False` | Generate a `ui.lovelace.yaml` file (only usefull if you use the UI to edit lovelace and want to share that in a yaml format.)
52+
53+
## Warnings!
54+
55+
This integration **will** replace your files!:
56+
57+
- README.md
58+
- ui-lovelace.yaml (if you enable `convert_lovelace`)
12759

128-
### Configuration options for `binary_sensor` list
60+
## Usage
12961

130-
Key | Type | Required | Default | Description
131-
-- | -- | -- | -- | --
132-
`enabled` | `boolean` | `False` | `True` | Boolean to enable/disable the platform.
133-
`name` | `string` | `False` | `blueprint` | Custom name for the entity.
62+
In the root of your configuration directory (folder) you will get a new directory (folder) called "templates" in that directory (folder) there will be a file called "README.j2" this is where you change the template that will be used for generation of the README.md file.
13463

135-
### Configuration options for `sensor` list
64+
When you are happy with how the template look, run the service `readme.generate` in Home Assistant, this will generate the README.md file, and the ui-lovelace.yaml file if you enabled that.
65+
66+
## Usable variables
67+
68+
In addition to all [Jijna magic you can do](https://jinja.palletsprojects.com/en/2.10.x/templates/), there is also some additional variables you can use in the templates.
69+
70+
Variable | Description
71+
-- | --
72+
`states` | This is the same as with the rest of Home Assistant.
73+
`custom_components` | Gives you a list of information about your custom_components
13674

137-
Key | Type | Required | Default | Description
138-
-- | -- | -- | -- | --
139-
`enabled` | `boolean` | `False` | `True` | Boolean to enable/disable the platform.
140-
`name` | `string` | `False` | `blueprint` | Custom name for the entity.
75+
The information about custom components are fetched from the integrations manifest.json file, the folowing keys are aviable:
14176

77+
- `domain`
78+
- `name`
79+
- `documentation`
80+
- `codeowner`
14281

143-
### Configuration options for `switch` list
82+
**Example usage of the `custom_components` variable:**
14483

145-
Key | Type | Required | Default | Description
146-
-- | -- | -- | -- | --
147-
`enabled` | `boolean` | `False` | `True` | Boolean to enable/disable the platform.
148-
`name` | `string` | `False` | `blueprint` | Custom name for the entity.
84+
```
85+
{%- set custom_component_descriptions = {"readme": "Generates this awesome readme file."} -%}
86+
{% for integration in custom_components %}
87+
### [{{integration.name}}]({{integration.documentation}})
88+
{% if integration.domain in custom_component_descriptions %}
89+
_{{custom_component_descriptions[integration.domain]}}_
90+
{% endif -%}
91+
{% endfor -%}
92+
```
93+
94+
If you only use this integration the output of that will be:
95+
96+
```
97+
### [Generate readme](https://github.com/custom-components/readme)
98+
99+
_Generates this awesome readme file._
100+
```
149101
150102
## Contributions are welcome!
151103
@@ -159,7 +111,7 @@ If you want to contribute to this please read the [Contribution guidelines](CONT
159111
[commits-shield]: https://img.shields.io/github/commit-activity/y/custom-components/blueprint.svg?style=for-the-badge
160112
[commits]: https://github.com/custom-components/blueprint/commits/master
161113
[hacs]: https://github.com/custom-components/hacs
162-
[hacsbadge]: https://img.shields.io/badge/HACS-Custom-orange.svg?style=for-the-badge
114+
[hacsbadge]: https://img.shields.io/badge/HACS-Default-orange.svg?style=for-the-badge
163115
[discord]: https://discord.gg/Qa5fW2R
164116
[discord-shield]: https://img.shields.io/discord/330944238910963714.svg?style=for-the-badge
165117
[exampleimg]: example.png

custom_components/blueprint/.translations/en.json

Lines changed: 0 additions & 21 deletions
This file was deleted.

custom_components/blueprint/.translations/nb.json

Lines changed: 0 additions & 21 deletions
This file was deleted.

custom_components/blueprint/.translations/sensor.nb.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)