Skip to content

Commit

Permalink
Init commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Sascha Thomsen committed Aug 19, 2024
1 parent 2b61ed9 commit 6fe02ab
Show file tree
Hide file tree
Showing 30 changed files with 542 additions and 769 deletions.
8 changes: 2 additions & 6 deletions .devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "ludeeus/integration_blueprint",
"name": "sthomsen1/ha-water-heater-template",
"image": "mcr.microsoft.com/devcontainers/python:3.12",
"postCreateCommand": "scripts/setup",
"forwardPorts": [
Expand All @@ -14,7 +14,6 @@
"customizations": {
"vscode": {
"extensions": [
"charliermarsh.ruff",
"github.vscode-pull-request-github",
"ms-python.python",
"ms-python.vscode-pylance",
Expand All @@ -29,10 +28,7 @@
"files.trimTrailingWhitespace": true,
"python.analysis.typeCheckingMode": "basic",
"python.analysis.autoImportCompletions": true,
"python.defaultInterpreterPath": "/usr/local/bin/python",
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff"
}
"python.defaultInterpreterPath": "/usr/local/bin/python"
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ body:
required: true
- label: This issue only contains 1 issue (if you have multiple issues, open one issue for each issue).
required: true
- label: This issue is not a duplicate issue of any [previous issues](https://github.com/ludeeus/integration_blueprint/issues?q=is%3Aissue+label%3A%22Bug%22+)..
- label: This issue is not a duplicate issue of any [previous issues](https://github.com/sthomsen1/ha-water-heater-template/issues?q=is%3Aissue+label%3A%22Bug%22+)..
required: true
- type: textarea
attributes:
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ body:
required: true
- label: This only contains 1 feature request (if you have multiple feature requests, open one feature request for each feature request).
required: true
- label: This issue is not a duplicate feature request of [previous feature requests](https://github.com/ludeeus/integration_blueprint/issues?q=is%3Aissue+label%3A%22Feature+Request%22+).
- label: This issue is not a duplicate feature request of [previous feature requests](https://github.com/sthomsen1/ha-water-heater-template/issues?q=is%3Aissue+label%3A%22Feature+Request%22+).
required: true

- type: textarea
Expand Down
32 changes: 0 additions & 32 deletions .github/workflows/lint.yml

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,4 @@ jobs:
uses: "hacs/action@main"
with:
category: "integration"
# Remove this 'ignore' key when you have added brand images for your integration to https://github.com/home-assistant/brands
ignore: "brands"
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ __pycache__
.coverage
.vscode
coverage.xml
.ruff_cache


# Home Assistant configuration
Expand Down
26 changes: 0 additions & 26 deletions .ruff.toml

This file was deleted.

137 changes: 90 additions & 47 deletions README.md
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
[![HACS Badge](https://img.shields.io/badge/HACS-Custom-41BDF5.svg?style=for-the-badge)](https://github.com/hacs/integration)
[![License](https://img.shields.io/github/license/sthomsen1/ha-water-heater-template?=style=for-the-badge)](https://github.com/sthomsen1/ha-water-heater-template/blob/main/LICENSE)
[![Code style](https://img.shields.io/badge/code%20style-black-000000.svg?style=for-the-badge)](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 }}"
```
56 changes: 0 additions & 56 deletions README_EXAMPLE.md

This file was deleted.

2 changes: 1 addition & 1 deletion config/configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ homeassistant:
logger:
default: info
logs:
custom_components.integration_blueprint: debug
custom_components.water_heater_template: debug
Loading

0 comments on commit 6fe02ab

Please sign in to comment.