Skip to main content

S2 Protocol Python Wrapper

Project description

PyPI - Version PyPI - Python Version PyPI - License

This Python package implements the message validation for the EN50491-12-2 “S2” standard for home and building energy management. This implementation is based on the asyncapi description of the protocol provided in the s2-ws-json repository.

Currently, the package supports the common and FILL RATE BASED CONTROL types and messages.

To Install

You can install this package using pip or any Python dependency manager that collects the packages from Pypi:

pip install s2-python

The packages on Pypi may be found here

Example

from s2python.common import PowerRange, CommodityQuantity

# create s2 messages as Python objects
number_range = PowerRange(
    start_of_range=4.0,
    end_of_range=5.0,
    commodity_quantity=CommodityQuantity.ELECTRIC_POWER_L1,
)
# serialize s2 messages
number_range.to_json()
# deserialize s2 messages
json_str = '{"start_of_range": 4.0, "end_of_range": 5.0, "commodity_quantity": "ELECTRIC.POWER.L1"}'
PowerRange.from_json(json_str)

Development

For development, you can install the required dependencies using the following command:

pip install -e .[testing,development]

The tests can be run using tox:

tox

To build the package, you can use tox as well:

tox -e build,clean

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

s2_python-0.2.0.tar.gz (25.0 kB view details)

Uploaded Source

Built Distribution

s2_python-0.2.0-py3-none-any.whl (40.3 kB view details)

Uploaded Python 3

File details

Details for the file s2_python-0.2.0.tar.gz.

File metadata

  • Download URL: s2_python-0.2.0.tar.gz
  • Upload date:
  • Size: 25.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for s2_python-0.2.0.tar.gz
Algorithm Hash digest
SHA256 90698e5f07b1fe624ba9baec252fd675668e95ee628d54345a43f31dbc0953cd
MD5 ff660ee659d04a6dfde3de0ce06fe7af
BLAKE2b-256 cccf729eb315e9a9932f8b5e65180bc9164ff6ee44a9fecaf1562b3327e6f79a

See more details on using hashes here.

File details

Details for the file s2_python-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: s2_python-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 40.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for s2_python-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2f4b1d4e3400ae23e497aad695aecfabe239533720104088e9bc990eec0617b0
MD5 cf311fcb27eae9265798f2381aa6bbfb
BLAKE2b-256 a5a3861b2601767bb67548505e0dbc8ba5ce58b5fbb89a6ef45f0c3c0bbf3a03

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