Skip to content

Commit 5334bed

Browse files
committed
From template to working integration
1 parent cf7a899 commit 5334bed

34 files changed

+396
-549
lines changed

.devcontainer/configuration.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ default_config:
33
logger:
44
default: info
55
logs:
6-
custom_components.integration_blueprint: debug
6+
custom_components.knmi: debug
77

88
# If you need to debug uncommment the line below (doc: https://www.home-assistant.io/integrations/debugpy/)
99
# debugpy:

.github/workflows/pull.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
--timeout=9 \
5050
--durations=10 \
5151
-n auto \
52-
--cov custom_components.integration_blueprint \
52+
--cov custom_components.knmi \
5353
-o console_output_style=count \
5454
-p no:sugar \
5555
tests

.github/workflows/push.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
--timeout=9 \
5353
--durations=10 \
5454
-n auto \
55-
--cov custom_components.integration_blueprint \
55+
--cov custom_components.knmi \
5656
-o console_output_style=count \
5757
-p no:sugar \
5858
tests

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020 Joakim Sørensen @ludeeus
3+
Copyright (c) 2021 golles
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

+23-104
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,4 @@
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-
HAVE FUN! 😎
8-
9-
## Why?
10-
11-
This is simple, by having custom_components look (README + structure) the same
12-
it is easier for developers to help each other and for users to start using them.
13-
14-
If you are a developer and you want to add things to this "blueprint" that you think more
15-
developers will have use for, please open a PR to add it :)
16-
17-
## What?
18-
19-
This repository contains multiple files, here is a overview:
20-
21-
File | Purpose
22-
-- | --
23-
`.devcontainer/*` | Used for development/testing with VSCODE, more info in the readme file in that dir.
24-
`.github/ISSUE_TEMPLATE/feature_request.md` | Template for Feature Requests
25-
`.github/ISSUE_TEMPLATE/issue.md` | Template for issues
26-
`.github/settings.yml` | Probot settings to control the repository settings.
27-
`.vscode/tasks.json` | Tasks for the devcontainer.
28-
`custom_components/integration_blueprint/translations/*` | [Translation files.](https://developers.home-assistant.io/docs/internationalization/custom_integration)
29-
`custom_components/integration_blueprint/__init__.py` | The component file for the integration.
30-
`custom_components/integration_blueprint/api.py` | This is a sample API client.
31-
`custom_components/integration_blueprint/binary_sensor.py` | Binary sensor platform for the integration.
32-
`custom_components/integration_blueprint/config_flow.py` | Config flow file, this adds the UI configuration possibilities.
33-
`custom_components/integration_blueprint/const.py` | A file to hold shared variables/constants for the entire integration.
34-
`custom_components/integration_blueprint/manifest.json` | A [manifest file](https://developers.home-assistant.io/docs/en/creating_integration_manifest.html) for Home Assistant.
35-
`custom_components/integration_blueprint/sensor.py` | Sensor platform for the integration.
36-
`custom_components/integration_blueprint/switch.py` | Switch sensor platform for the integration.
37-
`tests/__init__.py` | Makes the `tests` folder a module.
38-
`tests/conftest.py` | Global [fixtures](https://docs.pytest.org/en/stable/fixture.html) used in tests to [patch](https://docs.python.org/3/library/unittest.mock.html#unittest.mock.patch) functions.
39-
`tests/test_api.py` | Tests for `custom_components/integration_blueprint/api.py`.
40-
`tests/test_config_flow.py` | Tests for `custom_components/integration_blueprint/config_flow.py`.
41-
`tests/test_init.py` | Tests for `custom_components/integration_blueprint/__init__.py`.
42-
`tests/test_switch.py` | Tests for `custom_components/integration_blueprint/switch.py`.
43-
`CONTRIBUTING.md` | Guidelines on how to contribute.
44-
`example.png` | Screenshot that demonstrate how it might look in the UI.
45-
`info.md` | An example on a info file (used by [hacs][hacs]).
46-
`LICENSE` | The license file for the project.
47-
`README.md` | The file you are reading now, should contain info about the integration, installation and configuration instructions.
48-
`requirements.txt` | Python packages used by this integration.
49-
`requirements_dev.txt` | Python packages used to provide [IntelliSense](https://code.visualstudio.com/docs/editor/intellisense)/code hints during development of this integration, typically includes packages in `requirements.txt` but may include additional packages
50-
`requirements_test.txt` | Python packages required to run the tests for this integration, typically includes packages in `requirements_dev.txt` but may include additional packages
51-
52-
## How?
53-
54-
If you want to use all the potential and features of this blueprint template you
55-
should use Visual Studio Code to develop in a container. In this container you
56-
will have all the tools to ease your python development and a dedicated Home
57-
Assistant core instance to run your integration. See `.devcontainer/README.md` for more information.
58-
59-
If you need to work on the python library in parallel of this integration
60-
(`sampleclient` in this example) there are different options. The following one seems
61-
easy to implement:
62-
63-
- Create a dedicated branch for your python library on a public git repository (example: branch
64-
`dev` on `https://github.com/ludeeus/sampleclient`)
65-
- Update in the `manifest.json` file the `requirements` key to point on your development branch
66-
( example: `"requirements": ["git+https://github.com/ludeeus/sampleclient.git@dev#devp==0.0.1beta1"]`)
67-
- Each time you need to make a modification to your python library, push it to your
68-
development branch and increase the number of the python library version in `manifest.json` file
69-
to ensure Home Assistant update the code of the python library. (example `"requirements": ["git+https://...==0.0.1beta2"]`).
70-
71-
72-
***
73-
README content if this was a published component:
74-
***
75-
76-
# integration_blueprint
1+
# knmi
772

783
[![GitHub Release][releases-shield]][releases]
794
[![GitHub Activity][commits-shield]][commits]
@@ -86,42 +11,37 @@ README content if this was a published component:
8611
[![Discord][discord-shield]][discord]
8712
[![Community Forum][forum-shield]][forum]
8813

89-
_Component to integrate with [integration_blueprint][integration_blueprint]._
14+
_Component to integrate with [knmi][knmi]._
9015

9116
**This component will set up the following platforms.**
9217

9318
Platform | Description
9419
-- | --
9520
`binary_sensor` | Show something `True` or `False`.
96-
`sensor` | Show info from blueprint API.
97-
`switch` | Switch something `True` or `False`.
98-
99-
![example][exampleimg]
21+
`weather` | Show weather provided by KNMI, https://weerlive.nl/.
10022

10123
## Installation
10224

10325
1. Using the tool of choice open the directory (folder) for your HA configuration (where you find `configuration.yaml`).
10426
2. If you do not have a `custom_components` directory (folder) there, you need to create it.
105-
3. In the `custom_components` directory (folder) create a new folder called `integration_blueprint`.
106-
4. Download _all_ the files from the `custom_components/integration_blueprint/` directory (folder) in this repository.
27+
3. In the `custom_components` directory (folder) create a new folder called `knmi`.
28+
4. Download _all_ the files from the `custom_components/knmi/` directory (folder) in this repository.
10729
5. Place the files you downloaded in the new directory (folder) you created.
10830
6. Restart Home Assistant
109-
7. In the HA UI go to "Configuration" -> "Integrations" click "+" and search for "Blueprint"
31+
7. In the HA UI go to "Configuration" -> "Integrations" click "+" and search for "knmi"
11032

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

11335
```text
114-
custom_components/integration_blueprint/translations/en.json
115-
custom_components/integration_blueprint/translations/nb.json
116-
custom_components/integration_blueprint/translations/sensor.nb.json
117-
custom_components/integration_blueprint/__init__.py
118-
custom_components/integration_blueprint/api.py
119-
custom_components/integration_blueprint/binary_sensor.py
120-
custom_components/integration_blueprint/config_flow.py
121-
custom_components/integration_blueprint/const.py
122-
custom_components/integration_blueprint/manifest.json
123-
custom_components/integration_blueprint/sensor.py
124-
custom_components/integration_blueprint/switch.py
36+
custom_components/knmi/translations/en.json
37+
custom_components/knmi/translations/nl.json
38+
custom_components/knmi/__init__.py
39+
custom_components/knmi/api.py
40+
custom_components/knmi/binary_sensor.py
41+
custom_components/knmi/config_flow.py
42+
custom_components/knmi/const.py
43+
custom_components/knmi/manifest.json
44+
custom_components/knmi/weather.py
12545
```
12646

12747
## Configuration is done in the UI
@@ -134,19 +54,18 @@ If you want to contribute to this please read the [Contribution guidelines](CONT
13454

13555
***
13656

137-
[integration_blueprint]: https://github.com/custom-components/integration_blueprint
138-
[buymecoffee]: https://www.buymeacoffee.com/ludeeus
57+
[knmi]: https://github.com/golles/ha-knmi
58+
[buymecoffee]: https://www.buymeacoffee.com/golles
13959
[buymecoffeebadge]: https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg?style=for-the-badge
140-
[commits-shield]: https://img.shields.io/github/commit-activity/y/custom-components/blueprint.svg?style=for-the-badge
141-
[commits]: https://github.com/custom-components/integration_blueprint/commits/master
60+
[commits-shield]: https://img.shields.io/github/commit-activity/y/golles/ha-knmi.svg?style=for-the-badge
61+
[commits]: https://github.com/golles/ha-knmi/commits/master
14262
[hacs]: https://github.com/custom-components/hacs
14363
[hacsbadge]: https://img.shields.io/badge/HACS-Custom-orange.svg?style=for-the-badge
14464
[discord]: https://discord.gg/Qa5fW2R
14565
[discord-shield]: https://img.shields.io/discord/330944238910963714.svg?style=for-the-badge
146-
[exampleimg]: example.png
14766
[forum-shield]: https://img.shields.io/badge/community-forum-brightgreen.svg?style=for-the-badge
14867
[forum]: https://community.home-assistant.io/
149-
[license-shield]: https://img.shields.io/github/license/custom-components/blueprint.svg?style=for-the-badge
150-
[maintenance-shield]: https://img.shields.io/badge/maintainer-Joakim%20Sørensen%20%40ludeeus-blue.svg?style=for-the-badge
151-
[releases-shield]: https://img.shields.io/github/release/custom-components/blueprint.svg?style=for-the-badge
152-
[releases]: https://github.com/custom-components/integration_blueprint/releases
68+
[license-shield]: https://img.shields.io/github/license/golles/ha-knmi.svg?style=for-the-badge
69+
[maintenance-shield]: https://img.shields.io/badge/maintainer-golles-blue.svg?style=for-the-badge
70+
[releases-shield]: https://img.shields.io/github/release/golles/ha-knmi.svg?style=for-the-badge
71+
[releases]: https://github.com/golles/ha-knmi/releases

custom_components/integration_blueprint/binary_sensor.py

-35
This file was deleted.

custom_components/integration_blueprint/const.py

-40
This file was deleted.

custom_components/integration_blueprint/manifest.json

-12
This file was deleted.

custom_components/integration_blueprint/sensor.py

-28
This file was deleted.

custom_components/integration_blueprint/switch.py

-40
This file was deleted.

custom_components/integration_blueprint/translations/fr.json

-31
This file was deleted.

0 commit comments

Comments
 (0)