-
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
Showing
27 changed files
with
1,090 additions
and
195 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,19 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_style = space | ||
indent_size = 4 | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
ident_size = 4 | ||
|
||
[*.py] | ||
max_line_length = 120 | ||
[*.md] | ||
ident_size = 2 | ||
trim_trailing_whitespace = false | ||
|
||
[*.yml] | ||
indent_size = 2 | ||
[*.json] | ||
ident_size = 2 | ||
|
||
[{.gitignore,.gitkeep,.editorconfig}] | ||
ident_size = 2 |
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 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,32 +1,32 @@ | ||
repos: | ||
- repo: https://github.com/commitizen-tools/commitizen | ||
rev: 3.6.0 | ||
hooks: | ||
- id: commitizen | ||
- id: commitizen-branch | ||
stages: [ push ] | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.4.0 | ||
hooks: | ||
- id: check-yaml | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.0.284 | ||
hooks: | ||
- id: ruff | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.4.0 | ||
hooks: | ||
- id: no-commit-to-branch | ||
args: | ||
- --branch=main | ||
- repo: local | ||
hooks: | ||
- id: test | ||
name: test | ||
entry: task tests | ||
language: system | ||
types: | ||
- python | ||
pass_filenames: false | ||
- repo: https://github.com/commitizen-tools/commitizen | ||
rev: 3.7.0 | ||
hooks: | ||
- id: commitizen | ||
- id: commitizen-branch | ||
stages: [ push ] | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.4.0 | ||
hooks: | ||
- id: check-yaml | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.0.286 | ||
hooks: | ||
- id: ruff | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.4.0 | ||
hooks: | ||
- id: no-commit-to-branch | ||
args: | ||
- --branch=main | ||
- repo: local | ||
hooks: | ||
- id: test | ||
name: test | ||
entry: task tests | ||
language: system | ||
types: | ||
- python | ||
pass_filenames: false |
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 |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# EAU par Agur | ||
|
||
[![GitHub Release][releases-shield]][releases] | ||
[![GitHub Activity][commits-shield]][commits] | ||
[![License][license-shield]](LICENSE) | ||
|
||
[![hacs][hacsbadge]][hacs] | ||
![Project Maintenance][maintenance-shield] | ||
|
||
_Integration to integrate with [EAU par Agur][eau_agur]._ | ||
|
||
🌏 | ||
[**Français**](README.md) | | ||
English | ||
|
||
**This integration will set up the following platforms.** | ||
|
||
| Platform | Description | Unit | Implemented | | ||
|-------------------|--------------|------|--------------------| | ||
| `sensor.total_m3` | Number of m3 | m3 | :white_check_mark: | | ||
|
||
## Installation | ||
|
||
## Automatic | ||
|
||
[![Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.](https://my.home-assistant.io/badges/hacs_repository.svg)](https://my.home-assistant.io/redirect/hacs_repository/?owner=acesyde&repository=hassio_agur_integration&category=integration) | ||
|
||
## Manual | ||
|
||
1. Using the tool of choice open the directory (folder) for your HA configuration (where you find `configuration.yaml`). | ||
2. If you do not have a `custom_components` directory (folder) there, you need to create it. | ||
3In the `custom_components` directory (folder) create a new folder called `eau_agur`. | ||
3. Download _all_ the files from the `custom_components/eau_agur/` directory (folder) in this repository. | ||
4. Place the files you downloaded in the new directory (folder) you created. | ||
5. Restart Home Assistant | ||
6. In the HA UI go to "Configuration" -> "Integrations" click "+" and search for "EAU par Agur" | ||
|
||
## Configuration is done in the UI | ||
|
||
## Contributions are welcome! | ||
|
||
If you want to contribute to this please read the [Contribution guidelines](CONTRIBUTING.md) | ||
|
||
*** | ||
|
||
[eau_agur]: https://www.agur.fr/ | ||
|
||
[commits-shield]: https://img.shields.io/github/commit-activity/y/acesyde/hassio_agur_integration.svg?style=for-the-badge | ||
|
||
[commits]: https://github.com/acesyde/hassio_agur_integration/commits/main | ||
|
||
[hacs]: https://github.com/hacs/integration | ||
|
||
[hacsbadge]: https://img.shields.io/badge/HACS-Custom-orange.svg?style=for-the-badge | ||
|
||
[license-shield]: https://img.shields.io/github/license/acesyde/hassio_agur_integration.svg?style=for-the-badge | ||
|
||
[maintenance-shield]: https://img.shields.io/badge/maintainer-Pierre%20Emmanuel%20Mercier%20%40acesyde-blue.svg?style=for-the-badge | ||
|
||
[releases-shield]: https://img.shields.io/github/release/acesyde/hassio_agur_integration.svg?style=for-the-badge | ||
|
||
[releases]: https://github.com/acesyde/hassio_agur_integration/releases |
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from homeassistant.config_entries import ConfigEntry | ||
from homeassistant.core import HomeAssistant | ||
from homeassistant.helpers.aiohttp_client import async_get_clientsession | ||
|
||
from .api import AgurApiClient | ||
from .const import DOMAIN, PLATFORMS, COORDINATOR | ||
from .coordinator import EauAgurDataUpdateCoordinator | ||
|
||
|
||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: | ||
"""Set up EAU par Agur from a config entry.""" | ||
session = async_get_clientsession(hass) | ||
client = AgurApiClient( | ||
session=session, | ||
) | ||
|
||
local_coordinator = EauAgurDataUpdateCoordinator(hass=hass, api_client=client, entry=entry) | ||
|
||
hass.data.setdefault(DOMAIN, {})[entry.entry_id] = {COORDINATOR: local_coordinator} | ||
|
||
# https://developers.home-assistant.io/docs/integration_fetching_data#coordinated-single-api-poll-for-data-for-all-entities | ||
await local_coordinator.async_config_entry_first_refresh() | ||
|
||
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) | ||
entry.async_on_unload(entry.add_update_listener(async_reload_entry)) | ||
|
||
return True | ||
|
||
|
||
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: | ||
"""Handle removal of an entry.""" | ||
if unloaded := await hass.config_entries.async_unload_platforms( | ||
entry, PLATFORMS | ||
): | ||
hass.data[DOMAIN].pop(entry.entry_id) | ||
return unloaded | ||
|
||
|
||
async def async_reload_entry(hass: HomeAssistant, entry: ConfigEntry) -> None: | ||
"""Reload config entry.""" | ||
await async_unload_entry(hass, entry) | ||
await async_setup_entry(hass, entry) |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
"""Api package for EAU par Agur.""" | ||
from .agur_api_client import AgurApiClient | ||
from .exceptions import AgurApiConnectionError, AgurApiError, AgurApiUnauthorizedError | ||
|
||
__all__ = ["AgurApiClient", "AgurApiConnectionError", "AgurApiError", "AgurApiUnauthorizedError"] |
Oops, something went wrong.