energiinfo
The energiinfo is a python wrapper for energiinfo API
The background color is #ffffff for light mode and #000000 for dark mode.
Simple code example:
from energiinfo.api import EnergiinfoClient
from datetime import datetime
siteid='13'
apiurl='https://api4.energiinfo.se'
username='username'
password='password'
# Initialize the api, this will not make an external call
api = EnergiinfoClient(apiurl,siteid)
# Authenticate against external api using username and password,
token = api.authenticate(username,password)
if api.getStatus() == "ERR":
errorMessage = api.getErrorMessage();
print(f"ErrorMessage: {errorMessage}")
exit(0)
else:
print(f"Successfully logged in token={token}")
# Initialize using token, this will make external call
token = api.get_access_token()
api = EnergiinfoClient(apiurl,'13',token)
if api.getStatus() == "OK":
print(f"Token successfully authenticated")
else:
errorMessage = api.getErrorMessage();
print(f"Failed to initialize with token: {errorMessage}")
exit(0)
# If you want a long-term token you need to call authenticateToken every now and then to validate token is still valid
# if not you may need to reauthenticate with username, password as above. the token if you plan on running this on a schedule
api.authenticateToken(token)
if api.getStatus() == "OK":
print("====== avbrottsinfo ======")
avbrottsinfo = api.get_interruptions()
print(avbrottsinfo)
print("====== meteringpoints ======")
meter_list = api.get_metering_points()
print(meter_list)
print("====== invoices ======")
invoices = api.get_invoices('2024')
print(invoices)
print("====== period 2023 ======")
period_data = api.get_period_values(meter_list[0]['meteringpoint_id'], '2023', 'ActiveEnergy', 'month')
print(period_data)
# Sum up the energy usage for the day
total = sum(float(value["value"]) for value in period_data)
print(f"Total energy use for the year 2023 {total}")
latest_hour_dict = max(period_data, key=lambda x: x['time'])
print(f"Latest hour for 2023: {latest_hour_dict['time']}")
print("====== period 202402 ======")
period_data = api.get_period_values(meter_list[0]['meteringpoint_id'], '202402', 'ActiveEnergy', 'day')
print(period_data)
print("====== period 20240225 ======")
period_data = api.get_period_values(meter_list[0]['meteringpoint_id'], '20240225', 'ActiveEnergy', 'hour')
print(period_data)
print("====== period 20240225-20240226 ======")
period_data = api.get_period_values(meter_list[0]['meteringpoint_id'], '20240225-20240226', 'ActiveEnergy', 'hour')
print(period_data)
print("====== period 2024030800 ======")
period_data = api.get_period_values(meter_list[0]['meteringpoint_id'], '2024030800', 'ActiveEnergy', 'quarter')
print(period_data)
# Invalidate token
api.logout()
else:
errorMessage = api.getErrorMessage();
print(f"Failed to authenticate token: {errorMessage}")
Metadata
Release files for energiinfo 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| energiinfo-1.0.4.tar.gz | 16.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| energiinfo-1.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 34.2 kB
Release files / energiinfo-1.0.4.tar.gz
| Download URL | energiinfo-1.0.4.tar.gz |
|---|---|
| Size | 16.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
460511a0e3031ab5ab6e1593003229aeeb23d02b1b7a2955e5141e16f373557c
|
|
BLAKE2b-256 checksum How to use checksums |
4bf34760a47fefce51ce5267b2b9f2d600e62cf834f5c1a18ac966459fe83c24
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.0
|
Release files / energiinfo-1.0.4-py3-none-any.whl
| Download URL | energiinfo-1.0.4-py3-none-any.whl |
|---|---|
| Size | 17.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
11a5cf300a8c7bfa5818752e3eb61d9ec30312a4b6fc2b61603c1b8ad127f41c
|
|
BLAKE2b-256 checksum How to use checksums |
7f153698f58b2705e5ed8d064305b4573cf0cfd6cb3d7b7900281ad20c79967f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.0
|
Security for energiinfo 1.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.