Skip to main content

pyecodevices-rt2 - Python GCE Ecodevices RT2

https://img.shields.io/pypi/v/pyecodevices_rt2.svg https://img.shields.io/pypi/pyversions/pyecodevices_rt2.svg Documentation Status Updates https://codecov.io/gh/pcourbin/pyecodevices_rt2/branch/main/graph/badge.svg pre-commit Black Project Maintenance BuyMeCoffee
Get information from GCE Ecodevices RT2.

This work is originally developed for use with Home Assistant and the custom component ecodevices_rt2.

Features

# Example with indexes
from pyecodevices_rt2 import EcoDevicesRT2
ecodevices = EcoDevicesRT2('192.168.0.20','80',"mysuperapikey")
ecodevices.get('Index','All') # Get all indexes as JSON
ecodevices.get('Index','All','Index_TI1') # Get specific value
  • Define a simple object such as Counter, DigitalInput, EnOcean Switch or Sensor, Post and Sub-Post, Relay, SupplierIndex, Toroid, VirtualOutput, X4FP (Heaters), XTHL:

# Example with a Relay
from pyecodevices_rt2 import EcoDevicesRT2, Relay
ecodevices = EcoDevicesRT2('192.168.0.20','80',"mysuperapikey")
# Relay number 1
test = Relay(ecodevices, 1)
print("Current status: %r" % test.status)
test.off() # Change relay to off
test.on() # Change relay to on
test.toggle() # Invert relay status
test.status = True # Change relay to on
  • Play with cached variables. You can defined a maximum value (in milliseconds) during which you consider an API value do not need to be updated:

from pyecodevices_rt2 import EcoDevicesRT2

# Create the ecodevices object with a default "cached" value of 1s
ecodevices = EcoDevicesRT2('192.168.0.20','80',"mysuperapikey", cached_ms=1000)

print("# All Indexes")
print(ecodevices.get('Index','All')) # Call the API
print(ecodevices.get('Index','All')) # Do not call the API since the last value was retrieved less than 1s (1000ms) ago
print(ecodevices.get('Index','All',cached_ms=0)) # Force to call the API even if the last value was retrieved less than 1s (1000ms) ago

# For each property in other objects, you can call "get_PROPERTY(cached_ms=XX)"
# Example with Counter 1:
test = Counter(ecodevices, 1)
print("Current value: %d" % test.value) # Call the API
print("Current price: %d" % test.price) # Call the API
print("Current value: %d" % test.value) # Do not call the API since the last value was retrieved less than 1s (1000ms) ago
print("Current price: %d" % test.price) # Do not call the API since the last value was retrieved less than 1s (1000ms) ago
print("Current value: %d" % test.get_value()) # Do not call the API since the last value was retrieved less than 1s (1000ms) ago
print("Current price: %d" % test.get_price()) # Do not call the API since the last value was retrieved less than 1s (1000ms) ago
print("Current value: %d" % test.get_value(cached_ms=0)) # Force to call the API even if the last value was retrieved less than 1s (1000ms) ago
print("Current price: %d" % test.get_price(cached_ms=0)) # Force to call the API even if the last value was retrieved less than 1s (1000ms) ago
print("Current value: %d" % test.get_value(cached_ms=2000)) # Do not call the API if the last value was retrieved less than 2s (2000ms) ago
print("Current price: %d" % test.get_price(cached_ms=2000)) # Do not call the API if the last value was retrieved less than 2s (2000ms) ago

Credits

This work is inspired by the work of Aohzan.
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

History

1.3.1 (2022-08-07)

  • Add option with cached_ms<0 to force use the cache, or return None

1.3.0 (2022-08-07)

  • Update Toroid API, using new EcoRT2 version 3.00.02

1.2.1 (2021-05-15)

  • Add “get_all_cached” function to call all resquests to get a cached value.

1.2.0 (2021-05-14)

  • Add “cached” possibilities to reduce the number of call to the API.

  • The cached possibilities can be defined directly to the ecodevices_rt2 object (applicable to each call), or to a specific call on a property.

1.1.0 (2021-04-17)

  • Add classes such as Counter, DigitalInput, EnOcean Switch or Sensor, Post and Sub-Post, Relay, SupplierIndex, Toroid, VirtualOutput, X4FP (Heaters), XTHL for ease of use

  • Add tests to cover majority of code

  • Add full examples in documentation

1.0.1 (2021-04-12)

1.0.0 (2021-04-08)

  • First release on PyPI.

Metadata

Release files for pyecodevices-rt2 1.3.4

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

Source distribution (sdist)

Source distribution for pyecodevices-rt2 1.3.4
File Size Uploaded Provenance Actions
pyecodevices_rt2-1.3.4.tar.gz 22.4 kB Without provenance Details for pyecodevices_rt2-1.3.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyecodevices-rt2 1.3.4
File Interpreter ABI Platform Actions
pyecodevices_rt2-1.3.4-py2.py3-none-any.whl Python 2, Python 3 none any Details for pyecodevices_rt2-1.3.4-py2.py3-none-any.whl

Total release size: 38.2 kB

Release files / pyecodevices_rt2-1.3.4.tar.gz

Download URL pyecodevices_rt2-1.3.4.tar.gz
Size 22.4 kB
Tags Source
SHA-256 checksum
How to use checksums
4ed00e5c03e68e033ebe20fd9bfc1a6653e4bde2f26411c650f2858f1df6e8c6
BLAKE2b-256 checksum
How to use checksums
ef634304d4a88e4cbb3bd65551a5819e01cfb0c0fcf90b8f0b90df6b6985fa66
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.14

Release files / pyecodevices_rt2-1.3.4-py2.py3-none-any.whl

Download URL pyecodevices_rt2-1.3.4-py2.py3-none-any.whl
Size 15.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
1772e0213de7434891606a1690cc0577faa729cf7591b2213650314d8ea3e2b4
BLAKE2b-256 checksum
How to use checksums
80b66c3bfd8c96bb8663ec0773b27111dc8383218bb5f9dee565cff16bba6e0c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.14

Security for pyecodevices-rt2 1.3.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.

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