Automating Leafy Energy with Python
Many data and integration teams prefer Python. In the Leafy Energy demo we therefore introduce a fictional Python SDK that illustrates typical automation scenarios.
Installation (concept)
pip install leafyenergy-sdk
Sample script: show tomorrow's cheapest hour
from leafyenergy import LeafyClient
client = LeafyClient(
api_key="YOUR_SANDBOX_API_KEY",
base_url="https://api.sandbox.leafy.energy"
)
prices = client.pricing.get_day_ahead(site_id="home_001")
cheapest = min(prices.hours, key=lambda h: h.price)
print("Cheapest hour:", cheapest.timestamp, "price:", cheapest.price, prices.currency)
With scripts like this you can demonstrate how data scientists or energy analysts might work with Leafy Energy.
Comments
0 comments
Please sign in to leave a comment.