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.4.tar.gz (27.1 kB view details)

Uploaded Source

Built Distribution

EnydayPy-1.0.4-py3-none-any.whl (43.9 kB view details)

Uploaded Python 3

File details

Details for the file EnydayPy-1.0.4.tar.gz.

File metadata

  • Download URL: EnydayPy-1.0.4.tar.gz
  • Upload date:
  • Size: 27.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for EnydayPy-1.0.4.tar.gz
Algorithm Hash digest
SHA256 3b612f48cc6b5c33ec0df57f3f025ac4b2cc5840c6856b22a339fc8fa43b20e7
MD5 26c1016d450f3702191f3178049520ed
BLAKE2b-256 f755c414c4620120960d41cfaeb4d5271f9038e3419c9c4228fe231a5b292f17

See more details on using hashes here.

File details

Details for the file EnydayPy-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: EnydayPy-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 43.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for EnydayPy-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 48ddf64a84d256f97119a9cf7c7ea55fa0df3b13b9f37fe28c413963aaf8fae5
MD5 5c202b7d716806f3612bbd8d3fb0db83
BLAKE2b-256 a9f5e0d1164b48abaf6a26daa670063fee52e8b456456aa822c6d38954263ddc

See more details on using hashes here.

Supported by

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