Ripple Energy
A Python package For interacting with the Ripple Energy GraphQL API.
The primary purpose of this package is to create an interface for Home Assistant to communicate with the Ripple Energy GraphQL API however, the facility is available to develop this module further by adding additional queries / functions.
Disclaimer - I do not work for Ripple Energy however, I have memberships in some of their co-ops. While this module has been developed in consultation with Ripple Energy, I cannot guarantee it's long-term support or stability.
Table of Contents
To-Do
- Create exceptions
- Put functions into classes
- Add linting
- Create tests
- Create build pipeline
- Publish to PyPi
- Make Async?
Installation
From Package Index
It is recommended to use pip to pull the package from PyPi
pip install ripple-energy
From Repository
Clone this repository
git clone https://github.com/danieledwardgeorgehitchcock/ripple-energy.git
This project leverages the use of Hatch for project management - please follow the installation instructions there before continuing.
Once the above has completed, enter in to the project directory
cd ripple-energy
As this package is managed by Hatch, you can start an environment which automatically pulls the project dependencies
hatch shell start
You should then be able to use the package from within this environment.
Example
from ripple_energy import RippleEnergy, RippleEnergyCredentialAuth
import asyncio
from sys import platform
if(platform == "win32"):
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) #Avoid event loop selector policy error in Windows
async def main():
auth = RippleEnergyCredentialAuth(email="YOUR_RIPPLE_EMAIL", password="YOUR_RIPPLE_PASSWORD")
async with RippleEnergy(auth=auth) as ripple:
#Query filter
faqs = await ripple.faqs("business")
#Full object response
print(faqs)
member = await ripple.member()
#Filtered object response
print(member.address)
version = await ripple.version()
#Simple type response
print(version)
#More complex query with input parameters
insights = await ripple.insights_chart(input={"genFarmId": "1", "startDate": "2023-09-25T23:00:00.000Z", "endDate": "2023-09-26T16:02:24.272Z", "period":"Day"})
print(insights)
if __name__ == "__main__":
asyncio.run(main())
Contributing
To add a new query to this module, add the GraphQL query into the src/ripple_energy/graphql_queries folder as a file with the extension .graphql such as: my_example_query.graphql - please see the existing queries as an example of how to write them.
In a terminal, make sure you are in the Hatch shell environment:
hatch shell start
This project uses the Ariadne code generator. To run it:
ariadne-codegen
If there no errors, a new client should be generated in the src/ripple_energy/graphql_client folder.
Add the new function to src/ripple_energy/ripple_energy.py - please see the existing functions as an example of how to write them.
Commit the changes and create a Pull Request in this repo.
License
ripple-energy is distributed under the terms of the MIT license.
Metadata
Release files for ripple-energy 3.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ripple_energy-3.0.3.tar.gz | 31.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ripple_energy-3.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 80.2 kB
Release files / ripple_energy-3.0.3.tar.gz
| Download URL | ripple_energy-3.0.3.tar.gz |
|---|---|
| Size | 31.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3183cb164893ff93294da3be00b5fc715c68037863dfc979ca5b1b56f483389a
|
|
BLAKE2b-256 checksum How to use checksums |
6b06f93b5bbdb71688c503b5c2fe6ec304f20f3c674f8b001e5bfeeae6413b81
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.23.3
|
Release files / ripple_energy-3.0.3-py3-none-any.whl
| Download URL | ripple_energy-3.0.3-py3-none-any.whl |
|---|---|
| Size | 48.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
90d9b0b142689110f159619d0ac8224ac5bc6a7efad47ec37cf986ccc71f6768
|
|
BLAKE2b-256 checksum How to use checksums |
e67f463c18d6e30ae92151186d276b1d9214350e7b5fb19de5b5af40ae2762bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.23.3
|