Skip to main content

Unofficial library for reading from The Energy Detective power meters

Project description

TEDpy

Unofficial library for reading from The Energy Detective power meters

This library supports the TED5000 and TED6000 devices.

It is based on @realumhelp's ted6000py, Home Assistant's ted5000 implementation, and @gtdiehl and @jesserizzo's envoy_reader. Also huge thanks to @realumhelp for helping write and review much of the code!

Usage

from tedpy import createTED

HOST = 'ted6000'

# Use asyncio to deal with the async methods
try:
    reader = await createTED(HOST)
    await reader.update()
    reader.print_to_console() # Print all information
    print(reader.energy()) # Total energy
    print(reader.consumption()) # Load energy only
    print(reader.production()) # Generated energy only

    print(reader.mtus[0].energy()) # Energy per MTU
    print(reader.mtus[0].power())
    print(reader.spyders[0].ctgroups[0].energy()) # Energy per ctgroup

except httpx.HTTPError:
    # Handle connection errors from createTED and update

Testing

To print out your energy meter's values, run poetry run python -m tedpy.

The module's tests can be run using poetry run pytest (make sure you poetry install first!).

Development

  1. Install dependencies: poetry install
  2. Install pre-commit hooks: poetry run pre-commit install
  3. Develop!

Notes

System types

The energy meter may be configured as 1 of 3 possible SystemTypes: NET, NET_GEN, and LOAD_GEN (referred to in documentation as NET_LOAD). NET, GEN, and LOAD are the possible MTU types defined as the following:

  • NET: Consumption from the grid
  • GEN: Solar power production
  • LOAD: Consumption from the grid, in the case where you are directly feeding the grid with solar

If you have not connected solar power to the meter, your system type is most likely NET. Otherwise, you are likely using NET_GEN type (measuring both grid consumption and solar power production). If you do not use an internal breaker for solar power and instead feed it directly back into the grid, you will have LOAD_GEN type.

The TED6000 API returns NET (net power), GEN (power generated), and LOAD (power consumed by appliances). Below is a table summarizing how these are populated for each system type. -(x) indicates x is negated. Calculated fields are italicized.

SystemType NET GEN LOAD
NET total consumption 0 0
NET_GEN grid consumption -(solar power produced) grid consumption + solar power produced
LOAD_GEN grid consumption - solar production -(solar power produced to grid) grid consumption

When using the .energy(), .production(), and .consumption() methods, the original values of the GEN column are inverted, and .consumption() is populated for the NET type:

SystemType .energy() .production() .consumption()
NET total consumption 0 total consumption
NET_GEN grid consumption solar power produced grid consumption + solar power produced
LOAD_GEN grid consumption - solar production solar power produced to grid grid consumption

Inverted GEN values

To keep consistency with the .consumption() method, MTUs configured as GEN will additionally return positive EnergyYield values (i.e. their negative values will be inverted to positive values). It is recommended you format MTU values as such:

data = "Production" if (mtu.type == MtuType.GENERATION) else "Consumption"
return f"{mtu.description} {data}: {mtu.energy()}"

TED5000 consumption and production

The TED5000 API does not return a total system .production() and .consumption() value, so the library calculates one itself. Production is defined as the energy sum of all MTUs marked as type "LOAD", and Consumption is defined as the energy sum of all MTUs marked as type "GEN".

NET and stand-alone types of MTUs are not included in these totals, whereas they are included in the .energy() total of the system.

TED5000 power factor

See #7 for info on how the power factor is calculated. There is a field returned by the API, but the documentation does not mention this field so the power factor is instead calculated manually.

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

tedpy-1.0.0.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

tedpy-1.0.0-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file tedpy-1.0.0.tar.gz.

File metadata

  • Download URL: tedpy-1.0.0.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.9.7 Darwin/20.6.0

File hashes

Hashes for tedpy-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e64fe57a333e885cc99a0b44f29312089d848ebc72d43057ee330b90c96dd3f8
MD5 619b34d83e13a8aacbc7d2a62a81584a
BLAKE2b-256 0922467f4605fc2ebf1fabee77d8704853e4f620ba1ac422874b6a1b959f4b2b

See more details on using hashes here.

File details

Details for the file tedpy-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: tedpy-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.9.7 Darwin/20.6.0

File hashes

Hashes for tedpy-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 abab63f52b27ee6aaa86a726c8b9a81b752521ceb98f5cde80293dd104b3866d
MD5 3d6010c774fb3e94fc7cd3a4d6e9e5d8
BLAKE2b-256 d5c057b942341201ad45a645508d37a2f1b92240e5d4d2d8eb4ef1936541cca8

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