Skip to main content

Enyday API

Project description

EnydayPy Python Client

EnydayPy is a Python client library for interacting with the Enyday API. This library provides access to user authentication, user details, authorization data, address information, and power consumption data.

Installation

To install the EnydayPy library, use pip:

pip install EnydayPy

Usage

The following is an example of how to use the EnydayPy client to interact with the Enyday API:

  1. Import the necessary libraries
from EnydayPy import EnydayClient
from getpass import getpass
from datetime import datetime, timedelta
import pytz
  1. Create an instance of the API class You will need to provide your Enyday email and password to authenticate.
username = input("Enter your Enyday email: ")
password = getpass("Enter your Enyday password: ")

client = EnydayClient()
client.connect(username, password)
  1. Get the user details Once authenticated, you can fetch the user details.
User = client.get_user_details()
print(User.id)
  1. Get the user's addresses You can retrieve the addresses associated with your user ID.
Addresses = client.get_address_by_user_id(User.id).addresses
print(Addresses)
  1. Get the Eloverblik authorizations This allows you to fetch the Eloverblik authorization data for the user.
Eloverblik = client.get_eloverblik_authorization(User.id)
print(Eloverblik)
  1. Get the power consumption You can fetch the power consumption data by specifying a date range. The following example shows how to get power consumption between two dates (using the Europe/Copenhagen timezone):
begin = datetime(2024, 11, 8, 0, 0, 0)
end = datetime(2024, 11, 8, 0, 0, 0)

# Set the timezone to Europe/Copenhagen
begin = pytz.timezone("Europe/Copenhagen").localize(begin)
end = pytz.timezone("Europe/Copenhagen").localize(end)

# Convert datetime from Europe/Copenhagen to UTC
begin = begin.astimezone(pytz.utc)
end = end.astimezone(pytz.utc)

print(f"Begin: {begin}")
print(f"End: {end}")

Power = client.get_power_consumption_by_user_and_address_ids(
    User.id, 
    Addresses[0].id, 
    begin, 
    end, 
    as_dataframe=True
)

# Print the sum of the power consumption
print(f"Power from PV: {Power['power_internal'].sum()}")
print(f"Power from grid: {Power['power_external'].sum()}")
  1. Notes The EnydayPy client requires a valid Enyday user account for authentication. All time-related data is converted to UTC for consistency. The library supports retrieval of power consumption, addresses, and Eloverblik authorizations.

License

This project is licensed under the MIT License.

MIT License

Copyright (c) [2024] [Bruno Adam]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

enydaypy-1.0.3.tar.gz (26.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

enydaypy-1.0.3-py3-none-any.whl (43.8 kB view details)

Uploaded Python 3

File details

Details for the file enydaypy-1.0.3.tar.gz.

File metadata

  • Download URL: enydaypy-1.0.3.tar.gz
  • Upload date:
  • Size: 26.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for enydaypy-1.0.3.tar.gz
Algorithm Hash digest
SHA256 5fa32098f6fd02b06e83985aa8090278e973a0c81b8f3466e2a8ebeb7404f399
MD5 2b76a73c2e6402a01d00633103e40c15
BLAKE2b-256 5ba8278ed42d8e00bb26d8a1d98ddaf5df5e94876be9f3ec976b6f8a7c7843ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for enydaypy-1.0.3.tar.gz:

Publisher: python-publish.yml on bruadam/EnydayPy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file enydaypy-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: enydaypy-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 43.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for enydaypy-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e9186556d54c968d522a9ebb23edb5763062eed1e30acf0be5624bdd51263cdc
MD5 a3fefea077ab63d5f3191b019b81dec3
BLAKE2b-256 01830458d7ab12b96a1442190c3c3ac83c52a7365ca4b065e68ebd57cf46d0b0

See more details on using hashes here.

Provenance

The following attestation bundles were made for enydaypy-1.0.3-py3-none-any.whl:

Publisher: python-publish.yml on bruadam/EnydayPy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page