Skip to main content

Comwatt Python Client (Legacy)

Overview

The Comwatt Python Client (Legacy) is a Python library that provides a convenient way to interact with the legacy Comwatt API (go.comwatt.com/api). It allows you to authenticate users, retrieve authenticated user information, and access owner, box, product, device, and statistical data.

Please note that this client is intended for devices below gen4 and uses the deprecated go.comwatt.com. If you're looking for the client compatible with gen4 devices and the energy.comwatt.com, please refer to the python-comwatt-client.

Features

The client currently supports the following methods:

  • authenticate(self, username, password): Authenticates a user with the provided username and password.
  • get_authenticated_user(self): Retrieves information about the authenticated user.
  • get_owner_details(self, owner_id): Retrieves information about the owner's details.
  • get_box_details(self, macAddress): Retrieves information about the box's details.
  • get_products(self): Retrieves information about the products.
  • get_devices(self, indepbox_id): Retrieves a list of devices for the specified box.
  • get_networkstats(self, indepbox_id, level="HOUR", measure_kind="QUANTITY", start=datetime.now(), end=datetime.now()): Retrieves a list of network statistics for the specified box.
  • get_devices_stats(self, device_id, measure_kind="QUANTITY", measure_type_id="1", level="HOUR", start=datetime.now(), end=datetime.now()): Retrieves a list of device statistics for the specified device.

Installation

You can install the Comwatt Python Client (Legacy) using pip. Run the following command:

pip install comwatt-client-legacy

Usage

Here's a simple example of how to use the Comwatt Python Client (Legacy):

from comwatt.client import ComwattClient
from datetime import datetime, timedelta

# Create a Comwatt client instance
client = ComwattClient()

# Authenticate the user
client.authenticate('username', 'password')

# Get information about the authenticated user
user_info = client.get_authenticated_user()
print(user_info)

# Get owner details
owner_id = user_info['id']
owner_details = client.get_owner_details(owner_id)
print(owner_details)

# Get box details
macAddress = owner_details[0]['macAddress']
box_details = client.get_box_details(macAddress)
print(box_details)

# Get products
products = client.get_products()
print(products)

# Get devices for a specific box
indepbox_id = box_details['id']
devices = client.get_devices(indepbox_id)
print(devices)

# Get network statistics for a specific box
start_date = datetime.now() - timedelta(days=7)
end_date = datetime.now()
networkstats = client.get_networkstats(indepbox_id, start=start_date, end=end_date)
print(networkstats)

# Get device statistics for a specific device
device_id = devices[0]['id']
devices_stats = client.get_devices_stats(device_id, start=start_date, end=end_date)
print(devices_stats)

Make sure to replace 'username' and 'password' with the actual values for your Comwatt account.

Contributing

Contributions to the Comwatt Python Client (Legacy) are welcome! If you find any issues or have suggestions for improvement, please open an issue or submit a pull request on the GitHub repository.

Metadata

Release files for comwatt-client-legacy 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for comwatt-client-legacy 0.1.2
File Size Uploaded Provenance Actions
comwatt_client_legacy-0.1.2.tar.gz 5.4 kB Without provenance Details for comwatt_client_legacy-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for comwatt-client-legacy 0.1.2
File Interpreter ABI Platform Actions
comwatt_client_legacy-0.1.2-py3-none-any.whl Python 3 none any Details for comwatt_client_legacy-0.1.2-py3-none-any.whl

Total release size: 9.8 kB

Release files / comwatt_client_legacy-0.1.2.tar.gz

Download URL comwatt_client_legacy-0.1.2.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e32da41ca19d291e4a35d6764ea0354d0064a9d4182320b9af0417035ffe95c4
BLAKE2b-256 checksum
How to use checksums
6fcc4a5a69c188c4190275ce863ba5981ff116a42e93176093ba4470680dd20d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.7

Release files / comwatt_client_legacy-0.1.2-py3-none-any.whl

Download URL comwatt_client_legacy-0.1.2-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
176314aeda595814e72108eed5152b90fcf6cbab7e959c47ee4614a3dc36b36e
BLAKE2b-256 checksum
How to use checksums
cd1127f510d1cb32f0247d5389db7c0dc28f11341f40d336efaa3fcba7781910
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.7

Security for comwatt-client-legacy 0.1.2

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.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page