Read data from CheckWatts EnergyInBalance WEB API
Project description
pyCheckwatt
Python package for communicating with CheckWatt EnergyInBalance targeted for Home Assistant integrations and other use-cases.
Warning
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 experimental and pulls basic info from EnergyInBalance. Use with care as it loads the servers of CheckWatt
Example
The following example will login to EnergyInBalance and retrieve basic information.
Create a file called example.py
that looks like this:
"""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.registered_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:
$ python -m venv venv
$ ./venv/Scripts/activate
$ pip install pycheckwatt
Run a simple test:
$ python example.py
Watch the output:
System
======
First-name Last-name (Address Zip City)
Solax power T30 12.0 (12.3kW, 12.0kWh)
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 folder. This example use additional modules, such as dotenv
and argparse
.
These modules needs to be installed before the main.py
is executed.
$ python -m venv venv
$ ./venv/Scripts/activate
$ pip install pycheckwatt python-dotenv argparse
Run the comprehensive test:
$ python main.py
Acknowledgements
This module was developed as a team effort by the following contributors.
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 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for pycheckwatt-0.1.10-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | be872ffd707ed4ff52d5334a497e117ba1bfa9729fe3008b2eaa83a379c62dac |
|
MD5 | 8cca3f3befd6693fa11e2fe1ab140000 |
|
BLAKE2b-256 | 1b2bcd595478b290bf8fb48095d1991f2f907c90b47713db94228115ec25022e |