Skip to content

Commit

Permalink
Cleanup (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeeus authored May 31, 2021
1 parent bd80605 commit 69d6491
Show file tree
Hide file tree
Showing 15 changed files with 216 additions and 396 deletions.
17 changes: 0 additions & 17 deletions .devcontainer/Dockerfile

This file was deleted.

53 changes: 0 additions & 53 deletions .devcontainer/README.md

This file was deleted.

4 changes: 3 additions & 1 deletion .devcontainer/configuration.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
default_config:
logger:
default: error
default: info
logs:
custom_components.readme: debug

readme:
26 changes: 0 additions & 26 deletions .devcontainer/custom_component_helper

This file was deleted.

15 changes: 9 additions & 6 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
// See https://aka.ms/vscode-remote/devcontainer.json for format details.
{
"image": "ludeeus/container:integration-debian",
"name": "Blueprint integration development",
"context": "..",
"dockerFile": "Dockerfile",
"appPort": "8124:8123",
"runArgs": [
"-e",
"GIT_EDTIOR='code --wait'"
"appPort": [
"9123:8123"
],
"postCreateCommand": "container install",
"extensions": [
"ms-python.python",
"github.vscode-pull-request-github",
"tabnine.tabnine-vscode"
"ryanluker.vscode-coverage-gutters",
"ms-python.vscode-pylance"
],
"settings": {
"files.eol": "\n",
"editor.tabSize": 4,
"python.pythonPath": "/usr/local/bin/python",
"python.analysis.autoSearchPaths": false,
"python.linting.pylintEnabled": true,
"python.linting.enabled": true,
"python.formatting.provider": "black",
Expand Down
Binary file removed .devcontainer/images/reopen.png
Binary file not shown.
16 changes: 0 additions & 16 deletions .github/workflows/hassfest.yaml

This file was deleted.

35 changes: 35 additions & 0 deletions .github/workflows/validate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Validate


on:
push:
branches: [master]
pull_request:
branches: [master]
schedule:
- cron: "0 0 * * *"

jobs:
validate-hassfest:
runs-on: ubuntu-latest
name: With hassfest
steps:
- name: Check out repository
uses: actions/checkout@v2

- name: Hassfest validation
uses: "home-assistant/actions/hassfest@master"

validate-hacs:
runs-on: ubuntu-latest
name: With HACS Action
steps:
- name: Check out repository
uses: actions/checkout@v2

- name: HACS validation
uses: hacs/action@main
with:
category: integration
comment: false
ignore: brands
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.vs
custom_components/hacs
__pycache__
61 changes: 0 additions & 61 deletions .vscode/tasks.json

This file was deleted.

83 changes: 20 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,19 @@ custom_components/readme/services.yaml
readme:
```
## Configuration options
Key | Type | Required | Description
-- | -- | -- | --
`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.)

## Warnings!
## Warning!
This integration **will** replace your files!:
- README.md
- ui-lovelace.yaml (if you enable `convert_lovelace`)

## Configuration options

Key | Type | Required | Description
-- | -- | -- | --
`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.)

## Usage

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.
Expand All @@ -70,17 +70,18 @@ In addition to all [Jijna magic you can do](https://jinja.palletsprojects.com/en
Variable | Description
-- | --
`states` | This is the same as with the rest of Home Assistant.
`custom_components` | Gives you a list of information about your custom_components
`custom_components` | Gives you a list of information about your custom_integrations
`hacs_components` | Gives you a list of information about HACS installed integrations, plugins, and themes

The information about custom components are fetched from the integrations manifest.json file, the folowing keys are available:
The information about custom integrations are fetched from the integrations manifest.json file, the folowing keys are available:

- `domain`
- `name`
- `documentation`
- `codeowner`
- `codeowners`
- `version`

The information about HACS components are fetched from the storage hacs files, the folowing keys are available:
The information about integrations tracked with HACS are fetched from the storage hacs files, the folowing keys are available:

- `category`
- `name`
Expand Down Expand Up @@ -121,7 +122,7 @@ _{{custom_component_descriptions[integration.domain]}}_
**Example usage for documenting Alexa smart home utterances**
```
{%- set alexa_configuration =
{%- set alexa_configuration =
{
"domains": ["light", "camera", "vacuum", "fan"],
"entities": {
Expand Down Expand Up @@ -156,13 +157,13 @@ OFF | "off"

**What you say:**

_"Alexa, set thermostat to 70."_
_"Alexa, set the AC to 70."_
_"Alexa, make it warmer in here."_
_"Alexa, make it cooler in here."_
_"Alexa, set `DEVICE NAME` to `CLIMATE MODE`."_
_"Alexa, turn on the `CLIMATE MODE`."_
_"Alexa, turn off the `DEVICE NAME`."_
_"Alexa, set thermostat to 70."_
_"Alexa, set the AC to 70."_
_"Alexa, make it warmer in here."_
_"Alexa, make it cooler in here."_
_"Alexa, set `DEVICE NAME` to `CLIMATE MODE`."_
_"Alexa, turn on the `CLIMATE MODE`."_
_"Alexa, turn off the `DEVICE NAME`."_
{% endif %}
**Device Names:**
{%- for state in states[domain] %}
Expand All @@ -175,50 +176,6 @@ _"Alexa, turn off the `DEVICE NAME`."_
{%- endfor %}
```
### Sensors
Create a long-lived access token in Home Assistant
```yaml
sensor:
- platform: version
- platform: rest
name: Addons
resource: 'https://your-ha-url/api/hassio/supervisor/info'
headers:
Authorization: 'Bearer yourlonglivedaccesstoken'
json_attributes_path: "$.data"
json_attributes:
- addons
- addons_repositories
value_template: '{{ value_json.data.addons | count}}'
```

**Example usage of Home Assistant version badge**
```
[![HA Version](https://img.shields.io/badge/Home%20Assistant-{{states.sensor.current_version.state}}-brightgreen)](https://github.com/home-assistant/home-assistant/releases/{{states.sensor.current_version.state}})
```

**Example usage of listing addon repositories**
```
{% for repository in states.sensor.addons.attributes.addons_repositories | sort -%}
- {{ repository }}
{% endfor %}
```

**Example usage of listing addons**
```
{%- set addon_docs =
{
"core_samba": "https://github.com/home-assistant/hassio-addons/tree/master/samba",
"core_mariadb": "https://github.com/home-assistant/hassio-addons/tree/master/mariadb"
}
-%}
{% for addon in states.sensor.addons.attributes.addons | sort(attribute='name') -%}
- [{{ addon.name }}]({{addon_docs[addon.slug]}})
{% endfor %}
```

If you only use this integration the output of that will be:
```
Expand Down
Loading

0 comments on commit 69d6491

Please sign in to comment.