generated from ludeeus/integration_blueprint
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sascha Thomsen
committed
Aug 19, 2024
1 parent
2b61ed9
commit 6fe02ab
Showing
30 changed files
with
542 additions
and
769 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,10 +20,10 @@ jobs: | |
- name: "ZIP the integration directory" | ||
shell: "bash" | ||
run: | | ||
cd "${{ github.workspace }}/custom_components/integration_blueprint" | ||
zip integration_blueprint.zip -r ./ | ||
cd "${{ github.workspace }}/custom_components/water_heater_template" | ||
zip water_heater_template.zip -r ./ | ||
- name: "Upload the ZIP file to the release" | ||
uses: "softprops/[email protected]" | ||
with: | ||
files: ${{ github.workspace }}/custom_components/integration_blueprint/integration_blueprint.zip | ||
files: ${{ github.workspace }}/custom_components/water_heater_template/water_heater_template.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,6 @@ __pycache__ | |
.coverage | ||
.vscode | ||
coverage.xml | ||
.ruff_cache | ||
|
||
|
||
# Home Assistant configuration | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,90 @@ | ||
# Notice | ||
|
||
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! 😎 | ||
|
||
## Why? | ||
|
||
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 :) | ||
|
||
## What? | ||
|
||
This repository contains multiple files, here is a overview: | ||
|
||
File | Purpose | Documentation | ||
-- | -- | -- | ||
`.devcontainer.json` | Used for development/testing with Visual Studio Code. | [Documentation](https://code.visualstudio.com/docs/remote/containers) | ||
`.github/ISSUE_TEMPLATE/*.yml` | Templates for the issue tracker | [Documentation](https://help.github.com/en/github/building-a-strong-community/configuring-issue-templates-for-your-repository) | ||
`.vscode/tasks.json` | Tasks for the devcontainer. | [Documentation](https://code.visualstudio.com/docs/editor/tasks) | ||
`custom_components/integration_blueprint/*` | Integration files, this is where everything happens. | [Documentation](https://developers.home-assistant.io/docs/creating_component_index) | ||
`CONTRIBUTING.md` | Guidelines on how to contribute. | [Documentation](https://help.github.com/en/github/building-a-strong-community/setting-guidelines-for-repository-contributors) | ||
`LICENSE` | The license file for the project. | [Documentation](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/licensing-a-repository) | ||
`README.md` | The file you are reading now, should contain info about the integration, installation and configuration instructions. | [Documentation](https://help.github.com/en/github/writing-on-github/basic-writing-and-formatting-syntax) | ||
`requirements.txt` | Python packages used for development/lint/testing this integration. | [Documentation](https://pip.pypa.io/en/stable/user_guide/#requirements-files) | ||
|
||
## How? | ||
|
||
1. Create a new repository in GitHub, using this repository as a template by clicking the "Use this template" button in the GitHub UI. | ||
1. Open your new repository in Visual Studio Code devcontainer (Preferably with the "`Dev Containers: Clone Repository in Named Container Volume...`" option). | ||
1. Rename all instances of the `integration_blueprint` to `custom_components/<your_integration_domain>` (e.g. `custom_components/awesome_integration`). | ||
1. Rename all instances of the `Integration Blueprint` to `<Your Integration Name>` (e.g. `Awesome Integration`). | ||
1. Run the `scripts/develop` to start HA and test out your new integration. | ||
|
||
## Next steps | ||
|
||
These are some next steps you may want to look into: | ||
- Add tests to your integration, [`pytest-homeassistant-custom-component`](https://github.com/MatthewFlamm/pytest-homeassistant-custom-component) can help you get started. | ||
- Add brand images (logo/icon) to https://github.com/home-assistant/brands. | ||
- Create your first release. | ||
- Share your integration on the [Home Assistant Forum](https://community.home-assistant.io/). | ||
- Submit your integration to [HACS](https://hacs.xyz/docs/publish/start). | ||
# Water Heater Template | ||
[](https://github.com/hacs/integration) | ||
[](https://github.com/sthomsen1/ha-water-heater-template/blob/main/LICENSE) | ||
[](https://github.com/psf/black) | ||
|
||
Welcome to the 'water_heater_template' integration for Home Assistant! This integration allows you to create a fully customizable water heater entity using templates and actions, giving you the flexibility to define its behavior and properties based on your specific needs. | ||
|
||
## Configuration | ||
|
||
|
||
| Name | Type | Description | Default Value | | ||
| -------------------------------- | ------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------- | | ||
| name | `string` | The name of the climate device. | "Template Water Heater" | | ||
| unique_id | `string` | The [unique id](https://developers.home-assistant.io/docs/entity_registry_index/#unique-id) of the climate entity.| None | | ||
| icon_template | [`template`](https://www.home-assistant.io/docs/configuration/templating) | Defines a template for the icon of the device. || | ||
| entity_picture_template | [`template`](https://www.home-assistant.io/docs/configuration/templating) | Defines a template for the entity picture of the device. || | ||
| availability_template | [`template`](https://www.home-assistant.io/docs/configuration/templating) | Defines a template to get the `available` state of the component. If the template returns `true`, the device is `available`. If the template returns any other value, the device will be `unavailable`. If `availability_template` is not configured, the component will always be `available`. | true | | ||
| current_temperature_template | [`template`](https://www.home-assistant.io/docs/configuration/templating) | Defines a template to get the current temperature. || | ||
| target_temperature_template | [`template`](https://www.home-assistant.io/docs/configuration/templating) | Defines a template to get the target temperature low temperature. || | ||
| target_temperature_high_template | [`template`](https://www.home-assistant.io/docs/configuration/templating) | Defines a template to get the target high temperature. || | ||
| target_temperature_low_template | [`template`](https://www.home-assistant.io/docs/configuration/templating) | Defines a template to get the target temperature low temperature. || | ||
| is_away_mode_on_template | [`template`](https://www.home-assistant.io/docs/configuration/templating) | Defines a template to check if the away mode is on. || | ||
| current_operation_template | [`template`](https://www.home-assistant.io/docs/configuration/templating) | Defines a template to get the current operation mode. || | ||
| temperature_min_template | [`template`](https://www.home-assistant.io/docs/configuration/templating) | Defines a template to get the minimum temperature. || | ||
| temperature_max_template | [`template`](https://www.home-assistant.io/docs/configuration/templating) | Defines a template to get the maximum temperature. || | ||
||| | ||
| set_temperature |[`action`](https://www.home-assistant.io/docs/scripts) | Action to be executed when the temperature is set. `temperature`, `target_temp_high`, `target_temp_low` variable can be used || | ||
| set_away_mode | [`action`](https://www.home-assistant.io/docs/scripts) | Action to be executed when the away mode is toggled. `away_mode` variable can be used || | ||
| set_operation | [`action`](https://www.home-assistant.io/docs/scripts) | Action to be executed when the operation mode is changed. `operation` variable can be used || | ||
||| | ||
| temperature_min | `float` | Minimum temperature that can be defined || | ||
| temperature_max | `float` | Maximum temperature that can be defined || | ||
| operation_modes | `list` | A list of supported operation modes. Only default values are allowed | ['eco', 'electric', 'performance', 'high_demand', 'heat_pump', 'gas', 'off'] | | ||
||| | ||
|
||
|
||
## Example Configuration | ||
|
||
```yaml | ||
- platform: water_heater_template | ||
name: "Warmwater" | ||
availability_template: "{{ is_state('sensor.warm_water_storage', 'on') }}" | ||
current_temperature_template: "{{ states('sensor.warm_water_storage_temp') }}" | ||
target_temperature_template: "{{ states('sensor.warm_water_storage_temp_desired') }}" | ||
temperature_min: 50 | ||
temperature_max: 70 | ||
target_temperature_high_template: "{{ float(states('sensor.warm_water_storage_temp_desired')) + float(states('sensor.warm_water_storage_temp_desired_offset')) }}" | ||
target_temperature_low_template: "{{ float(states('sensor.warm_water_storage_temp_desired')) - float(states('sensor.warm_water_storage_temp_hyst')) }}" | ||
current_operation_template: > | ||
{% if is_state('sensor.warm_water_state', 'off') %} | ||
off | ||
{% elif is_state('sensor.warm_water_state', 'load') %} | ||
performance | ||
{% elif is_state('sensor.warm_water_state', 'auto') %} | ||
eco | ||
{% else %} | ||
unknown | ||
{% endif %} | ||
operation_modes: ["eco", "off", "performance"] | ||
set_operation: | ||
choose: | ||
- conditions: | ||
- condition: template | ||
value_template: "{{ operation == 'performance' }}" | ||
sequence: | ||
- service: script.turn_on | ||
target: | ||
entity_id: script.heat_warm_water | ||
- conditions: | ||
- condition: template | ||
value_template: "{{ operation == 'eco' }}" | ||
sequence: | ||
- service: script.turn_on | ||
target: | ||
entity_id: script.warm_water_normal | ||
- conditions: | ||
- condition: template | ||
value_template: "{{ operation == 'off' }}" | ||
sequence: | ||
- service: script.turn_on | ||
target: | ||
entity_id: script.turn_off_warm_water | ||
default: [] | ||
set_temperature: | ||
- condition: template | ||
value_template: "{{ is_number(temperature) }}" | ||
- service: script.set_warm_water_via_mqtt | ||
data: | ||
temperature: "{{ temperature | float }}" | ||
``` |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.