EnydayPy


NameEnydayPy JSON
Version 1.0.4 PyPI version JSON
download
home_pagehttps://github.com/bruadam/EnydayPy
SummaryEnyday API
upload_time2024-11-11 16:07:19
maintainerNone
docs_urlNone
authorBruno Adam
requires_pythonNone
licenseNone
keywords enyday api denmark energy management system ems home assistant
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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`:

```bash
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
```python
from EnydayPy import EnydayClient
from getpass import getpass
from datetime import datetime, timedelta
import pytz
```
2. Create an instance of the API class
You will need to provide your Enyday email and password to authenticate.
```python
username = input("Enter your Enyday email: ")
password = getpass("Enter your Enyday password: ")

client = EnydayClient()
client.connect(username, password)
```
3. Get the user details
Once authenticated, you can fetch the user details.
```python
User = client.get_user_details()
print(User.id)
```
4. Get the user's addresses
You can retrieve the addresses associated with your user ID.
```python
Addresses = client.get_address_by_user_id(User.id).addresses
print(Addresses)
```
5. Get the Eloverblik authorizations
This allows you to fetch the Eloverblik authorization data for the user.
```python
Eloverblik = client.get_eloverblik_authorization(User.id)
print(Eloverblik)
```
6. 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):
```python
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()}")
```
7. 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.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/bruadam/EnydayPy",
    "name": "EnydayPy",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "Enyday API, Denmark, Energy Management System, EMS, Home Assistant",
    "author": "Bruno Adam",
    "author_email": "bruno.adam@pm.me",
    "download_url": "https://files.pythonhosted.org/packages/f7/55/c414c4620120960d41cfaeb4d5271f9038e3419c9c4228fe231a5b292f17/EnydayPy-1.0.4.tar.gz",
    "platform": null,
    "description": "# EnydayPy Python Client\n\nEnydayPy 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.\n\n## Installation\n\nTo install the EnydayPy library, use `pip`:\n\n```bash\npip install EnydayPy\n```\n## Usage\n\nThe following is an example of how to use the EnydayPy client to interact with the Enyday API:\n\n1. Import the necessary libraries\n```python\nfrom EnydayPy import EnydayClient\nfrom getpass import getpass\nfrom datetime import datetime, timedelta\nimport pytz\n```\n2. Create an instance of the API class\nYou will need to provide your Enyday email and password to authenticate.\n```python\nusername = input(\"Enter your Enyday email: \")\npassword = getpass(\"Enter your Enyday password: \")\n\nclient = EnydayClient()\nclient.connect(username, password)\n```\n3. Get the user details\nOnce authenticated, you can fetch the user details.\n```python\nUser = client.get_user_details()\nprint(User.id)\n```\n4. Get the user's addresses\nYou can retrieve the addresses associated with your user ID.\n```python\nAddresses = client.get_address_by_user_id(User.id).addresses\nprint(Addresses)\n```\n5. Get the Eloverblik authorizations\nThis allows you to fetch the Eloverblik authorization data for the user.\n```python\nEloverblik = client.get_eloverblik_authorization(User.id)\nprint(Eloverblik)\n```\n6. Get the power consumption\nYou 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):\n```python\nbegin = datetime(2024, 11, 8, 0, 0, 0)\nend = datetime(2024, 11, 8, 0, 0, 0)\n\n# Set the timezone to Europe/Copenhagen\nbegin = pytz.timezone(\"Europe/Copenhagen\").localize(begin)\nend = pytz.timezone(\"Europe/Copenhagen\").localize(end)\n\n# Convert datetime from Europe/Copenhagen to UTC\nbegin = begin.astimezone(pytz.utc)\nend = end.astimezone(pytz.utc)\n\nprint(f\"Begin: {begin}\")\nprint(f\"End: {end}\")\n\nPower = client.get_power_consumption_by_user_and_address_ids(\n    User.id, \n    Addresses[0].id, \n    begin, \n    end, \n    as_dataframe=True\n)\n\n# Print the sum of the power consumption\nprint(f\"Power from PV: {Power['power_internal'].sum()}\")\nprint(f\"Power from grid: {Power['power_external'].sum()}\")\n```\n7. Notes\nThe EnydayPy client requires a valid Enyday user account for authentication.\nAll time-related data is converted to UTC for consistency.\nThe library supports retrieval of power consumption, addresses, and Eloverblik authorizations.\n\n## License\n\nThis project is licensed under the MIT License.\n\nMIT License\n\nCopyright (c) [2024] [Bruno Adam]\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Enyday API",
    "version": "1.0.4",
    "project_urls": {
        "Homepage": "https://github.com/bruadam/EnydayPy"
    },
    "split_keywords": [
        "enyday api",
        " denmark",
        " energy management system",
        " ems",
        " home assistant"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a9f5e0d1164b48abaf6a26daa670063fee52e8b456456aa822c6d38954263ddc",
                "md5": "5c202b7d716806f3612bbd8d3fb0db83",
                "sha256": "48ddf64a84d256f97119a9cf7c7ea55fa0df3b13b9f37fe28c413963aaf8fae5"
            },
            "downloads": -1,
            "filename": "EnydayPy-1.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5c202b7d716806f3612bbd8d3fb0db83",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 43883,
            "upload_time": "2024-11-11T16:07:18",
            "upload_time_iso_8601": "2024-11-11T16:07:18.189551Z",
            "url": "https://files.pythonhosted.org/packages/a9/f5/e0d1164b48abaf6a26daa670063fee52e8b456456aa822c6d38954263ddc/EnydayPy-1.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f755c414c4620120960d41cfaeb4d5271f9038e3419c9c4228fe231a5b292f17",
                "md5": "26c1016d450f3702191f3178049520ed",
                "sha256": "3b612f48cc6b5c33ec0df57f3f025ac4b2cc5840c6856b22a339fc8fa43b20e7"
            },
            "downloads": -1,
            "filename": "EnydayPy-1.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "26c1016d450f3702191f3178049520ed",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 27110,
            "upload_time": "2024-11-11T16:07:19",
            "upload_time_iso_8601": "2024-11-11T16:07:19.947545Z",
            "url": "https://files.pythonhosted.org/packages/f7/55/c414c4620120960d41cfaeb4d5271f9038e3419c9c4228fe231a5b292f17/EnydayPy-1.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-11 16:07:19",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "bruadam",
    "github_project": "EnydayPy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "enydaypy"
}
        
Elapsed time: 4.74187s