-
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.
Merge pull request #17 from faanskit/dev
Updated to a more comprehensice Readme.md and bumped the version
- Loading branch information
Showing
4 changed files
with
85 additions
and
25 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,44 +1,103 @@ | ||
# pyCheckwatt | ||
|
||
Python package for communicating with [CheckWatt](https://checkwatt.se/) [EnergyInBalance](https://energyinbalance.se/) targeted for [Home Assistant](https://home-assistant.io) integration. | ||
Python package for communicating with [CheckWatt](https://checkwatt.se/) [EnergyInBalance](https://energyinbalance.se/) targeted for [Home Assistant](https://home-assistant.io) integrations and other use-cases. | ||
|
||
## Warning | ||
This library is provided as-is, is not supported or sanctioned by CheckWatt. | ||
This library is provided **as-is** and is not supported or approved by CheckWatt. CheckWatt can implement breaking changes at any time that renders this module useless. The module may not be updated promptly, or not at all if the changes are not possible to reverse engineer. | ||
|
||
## Status | ||
The library is **expermental** and does nothing but to pull some basic info from [EnergyInBalance](https://energyinbalance.se/). | ||
The library is **experimental** and pulls basic info from [EnergyInBalance](https://energyinbalance.se/). | ||
Use with care as it loads the servers of CheckWatt | ||
|
||
## Example | ||
In the examples folder exist en example file that make use of this library. | ||
The following example will login to [EnergyInBalance](https://energyinbalance.se/) and reteive basic information. | ||
|
||
### Using the example | ||
Create a `.env` file that looks like this and contain your credentials to [EnergyInBalance](https://energyinbalance.se/). | ||
``` | ||
CHECKWATT_USERNAME=<username> | ||
CHECKWATT_PASSWORD=<password> | ||
Create a file called `example.py` that looks like this: | ||
```python | ||
"""Example file to test pyCheckwatt""" | ||
from pycheckwatt import CheckwattManager | ||
EIB_USERNAME="eib_username" | ||
EIB_PASSWORD="eib_password" | ||
|
||
async def main(): | ||
"""Test function for pyCheckwatt.""" | ||
async with CheckwattManager(EIB_USERNAME, EIB_PASSWORD) as cw_instance: | ||
try: | ||
# Login to EnergyInBalance | ||
if await cw_instance.login(): | ||
# Fetch customer detail | ||
await cw_instance.get_customer_details() | ||
print("System\n======") | ||
print(cw_instance.registred_owner) | ||
print(cw_instance.battery_make_and_model) | ||
print("\nFCR-D\n=====") | ||
print(f"FCR-D State: {cw_instance.fcrd_state}") | ||
print(f"FCR-D Percentage: {cw_instance.fcrd_percentage}") | ||
print(f"FCR-D Date: {cw_instance.fcrd_timestamp}") | ||
|
||
except Exception as e: | ||
print(f"An error occurred: {e}") | ||
|
||
if __name__ == "__main__": | ||
|
||
import asyncio | ||
|
||
loop = asyncio.new_event_loop() | ||
asyncio.set_event_loop(loop) | ||
loop.run_until_complete(main()) | ||
``` | ||
|
||
Create a virtual environment and install pyCheckwatt: | ||
```bash | ||
$ python -m venv venv | ||
$ ./venv/Scripts/activate | ||
$ pip install pycheckwatt | ||
``` | ||
Run a simple test: | ||
``` | ||
> python main.py | ||
$ python example.py | ||
``` | ||
|
||
Watch the output: | ||
``` | ||
Customer Details | ||
================ | ||
Firstname Lastname (Adress Zip City) | ||
System | ||
====== | ||
Inverter Brand Model | ||
Battery Brand Model (12.3kW, 12.0kWh) | ||
Energy supplier via Dso (BLE City) | ||
Firstname Lastname (Adress Zip City) | ||
Solax power T30 12.0 (12.3kW, 12.0kWh) | ||
Logbook Entries | ||
=============== | ||
#9999 Hugo 2023-01-01 | ||
20230101-1100-CET - Hugo - test:pass, timestamp:pass, lan-router:pass, 4G:pass, simnumber:pass | ||
20230101-1120-CET - Silas - unpacked | ||
FCR-D | ||
===== | ||
FCR-D State: ACTIVATED | ||
FCR-D Percentage: 99,0/2,9/97,7 % | ||
FCR-D Date: 2023-12-20 00:11:45 | ||
``` | ||
|
||
## Comprehensive Example | ||
A comprehensive example can can found in the [examples](https://github.com/faanskit/pyCheckwatt/tree/master/examples) folder. This example use additional modules, such as `dotenv` and `argparse`. | ||
These modules needs to be installed before the `main.py` is executed. | ||
|
||
```bash | ||
$ python -m venv venv | ||
$ ./venv/Scripts/activate | ||
$ pip install pycheckwatt python-dotenv argparse | ||
``` | ||
|
||
Run the comprehensice test: | ||
``` | ||
$ python main.py | ||
``` | ||
# Acknowledgements | ||
This module was developed as a team effort by the following contributors. | ||
|
||
- [@faanskit](https://github.com/faanskit) : Developer | ||
- [@flopp999](https://github.com/flopp999) : Developer | ||
- [@angoyd](https://github.com/angoyd) : CI/CD | ||
|
||
This integration could not have been made without the excellent work done by the Home Assistant team. | ||
|
||
If you like what have been done here and want to help I would recommend that you firstly look into supporting Home Assistant. | ||
|
||
You can do this by purchasing some swag from their [store](https://home-assistant-store.creator-spring.com/) or paying for a Nabu Casa subscription. None of this could happen without them. | ||
|
||
# Licenses | ||
The integration is provided as-is without any warranties and published under [The MIT License](https://opensource.org/license/mit/). |
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 |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
import os | ||
|
||
from dotenv import load_dotenv | ||
|
||
from pycheckwatt import CheckwattManager | ||
|
||
load_dotenv() | ||
|
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,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "pycheckwatt" | ||
version = "0.1.2" | ||
version = "0.1.3" | ||
description = "Read data from CheckWatts EnergyInBalance WEB API" | ||
authors = ["Marcus Karlsson <[email protected]>", "Anders Yderborg <[email protected]>", "Daniel Nilsson <[email protected]>"] | ||
license = "MIT License" | ||
|
@@ -19,7 +19,7 @@ include = [ | |
|
||
[tool.poetry.dependencies] | ||
python = ">=3.10,<3.13" | ||
aiohttp = "^3.8.1" | ||
aiohttp = "^3.9.1" | ||
python-dateutil = "^2.8.2" | ||
|
||
[build-system] | ||
|