-
Notifications
You must be signed in to change notification settings - Fork 2
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
Stéphane Senart
committed
Dec 21, 2024
1 parent
077d5d1
commit 3df6e08
Showing
6 changed files
with
134 additions
and
22 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,2 +1,104 @@ | ||
# gazpar2haws | ||
Gazpar2HAWS is a gateway that reads data history from the GrDF (French gas provider) meter and send it to Home Assistant using WebSocket interface | ||
Gazpar2HAWS is a gateway that reads data history from the GrDF (French gas provider) meter and send it to Home Assistant using WebSocket interface. | ||
|
||
It is compatible with Home Assistant Energy Dashboard and permits to upload the history and keep it updated with the latest readings. | ||
|
||
## Installation | ||
|
||
Gazpar2HAWS can be installed on any host as a standalone program. | ||
|
||
### 1. Using source files | ||
|
||
The project requires [Poetry](https://python-poetry.org/) tool for dependency and package management. | ||
|
||
```sh | ||
$ cd /path/to/my_install_folder/ | ||
|
||
$ git clone https://github.com/ssenart/gazpar2haws.git | ||
|
||
$ cd gazpar2haws | ||
|
||
$ poetry install | ||
|
||
$ poetry shell | ||
|
||
``` | ||
|
||
### 2. Using PIP package | ||
|
||
```sh | ||
$ cd /path/to/my_install_folder/ | ||
|
||
$ mkdir gazpar2haws | ||
|
||
$ cd gazpar2haws | ||
|
||
$ python -m venv .venv | ||
|
||
$ source .venv/bin/activate | ||
|
||
$ pip install gazpar2haws | ||
|
||
``` | ||
|
||
## Usage | ||
|
||
### Command line | ||
|
||
```sh | ||
$ python -m gazpar2haws --config /path/to/configuration.yaml --secrets /path/to/secrets.yaml | ||
``` | ||
|
||
### Configuration file | ||
|
||
The default configuration file is below. | ||
|
||
```yaml | ||
logging: | ||
file: log/gazpar2haws.log | ||
console: true | ||
level: debug | ||
format: '%(asctime)s %(levelname)s [%(name)s] %(message)s' | ||
|
||
grdf: | ||
scan_interval: 0 # Number of minutes between each data retrieval (0 means no scan: a single data retrieval at startup, then stops). | ||
devices: | ||
- name: gazpar2haws | ||
username: "!secret grdf.username" | ||
password: "!secret grdf.password" | ||
pce_identifier: "!secret grdf.pce_identifier" | ||
timezone: Europe/Paris | ||
last_days: 365 # Number of days of data to retrieve | ||
reset: false # If true, the data will be reset before the first data retrieval | ||
|
||
homeassistant: | ||
host: "!secret homeassistant.host" | ||
port: "!secret homeassistant.port" | ||
token: "!secret homeassistant.token" | ||
``` | ||
The default secret file: | ||
```yaml | ||
grdf.username: ${GRDF_USERNAME} | ||
grdf.password: ${GRDF_PASSWORD} | ||
grdf.pce_identifier: ${GRDF_PCE_IDENTIFIER} | ||
|
||
homeassistant.host: ${HA_HOST} | ||
homeassistant.port: ${HA_PORT} | ||
homeassistant.token: ${HA_TOKEN} | ||
``` | ||
## Contributing | ||
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. | ||
Please make sure to update tests as appropriate. | ||
## License | ||
[MIT](https://choosealicense.com/licenses/mit/) | ||
## Project status | ||
Gazpar2HAWS has been initiated for integration with [Home Assistant](https://www.home-assistant.io/) energy dashboard. | ||
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,22 +1,21 @@ | ||
logging: | ||
file: log/gazpar2haws.log | ||
console: true | ||
level: debug | ||
level: info | ||
format: '%(asctime)s %(levelname)s [%(name)s] %(message)s' | ||
|
||
grdf: | ||
scan_interval: 0 # Number of minutes between each data retrieval (0 means no scan: a single data retrieval at startup, then stops). | ||
scan_interval: 1440 # Number of minutes between each data retrieval (0 means no scan: a single data retrieval at startup, then stops). | ||
devices: | ||
- name: gazpar2haws | ||
- name: gazpar2haws # Name of the device in home assistant. It will be used as the entity_id: sensor.${name}. | ||
username: "!secret grdf.username" | ||
password: "!secret grdf.password" | ||
pce_identifier: "!secret grdf.pce_identifier" | ||
timezone: Europe/Paris | ||
last_days: 365 # Number of days of data to retrieve | ||
reset: true # If true, the data will be reset before the first data retrieval | ||
last_days: 365 # Number of days of data to retrieve. | ||
reset: false # If true, the data will be reset before the first data retrieval. If false, the data will be kept and new data will be added. | ||
|
||
homeassistant: | ||
host: "!secret homeassistant.host" | ||
port: "!secret homeassistant.port" | ||
token: "!secret homeassistant.token" | ||
|
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 @@ | ||
from gazpar2haws.version import __version__ # noqa: F401 |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import pytest | ||
from gazpar2haws import __main__ | ||
import sys | ||
|
||
|
||
# ---------------------------------- | ||
@pytest.mark.asyncio | ||
async def test_main(): | ||
|
||
# Simulate command line arguments | ||
sys.argv = ["gazpar2haws", "-c", "config/configuration.yaml", "-s", "config/secrets.yaml"] | ||
|
||
await __main__.main() |