Skip to main content

API and CLI for communicating with the Emlite meters via EMOP

Project description

Simtricity Emlite Python APIs and CLI

This repository contains:

  • API to connect to and send EMOP messages to Emlite meters
  • a CLI (emop) for sending messages to the meters

Configure

Configuration steps:

  • create file ~/.simt/emlite.prod.env from Lastpass secret 'emop-cli-env-file (prod)'
  • create file ~/.simt/emlite.qa.env from Lastpass secret 'emop-cli-env-file (qa)'
  • ln -s ~/.simt/emlite.<qa|prod|custom>.env ~/.simt/emlite.env

NOTE:

  • FLY_DNS_SERVER needs the DNS that wireguard uses (on Linux look under resolvectl status for the interface and DNS)

see also https://www.notion.so/Emop-and-mediators-CLI-setup-834d32be5c794add8716399ab186abe8

Use

emop

emop env_show
emop env_set prod

emop --help

emop prepay_balance EML2137555666
emop csq EML2137555666
emop profile_log_1 --timestamp 2024-07-19T00:00 EML2137555666

Python API

You can also use the library directly in your Python scripts. The library offers two main client classes:

  • EmliteMediatorAPI: The core client for standard meter operations (reads, basic writes).
  • EmlitePrepayAPI: Extends the core API with prepay-specific functionality (balance, tokens, tariffs).

Initialization and Logging

The EmliteMediatorAPI constructor allows you to configure the connection and log verbosity.

import logging
from simt_emlite.mediator.api_core import EmliteMediatorAPI

# Initialize the client
# The logging_level parameter controls the verbosity of the internal logger.
# It uses the standard python logging module levels (DEBUG, INFO, WARNING, ERROR).
client = EmliteMediatorAPI(
    mediator_address="localhost:50051",
    logging_level=logging.WARNING  # Set to logging.DEBUG for verbose output
)

# Example Usage
serial = "EML2137555666"
try:
    voltage = client.instantaneous_voltage(serial)
    print(f"Meter {serial} voltage: {voltage}V")
except Exception as e:
    print(f"Error: {e}")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

simt_emlite-1.1.0-cp313-cp313-win_amd64.whl (2.3 MB view details)

Uploaded CPython 3.13Windows x86-64

simt_emlite-1.1.0-cp313-cp313-win32.whl (2.0 MB view details)

Uploaded CPython 3.13Windows x86

simt_emlite-1.1.0-cp313-cp313-musllinux_1_2_x86_64.whl (16.1 MB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

simt_emlite-1.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (16.4 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

simt_emlite-1.1.0-cp313-cp313-macosx_11_0_arm64.whl (2.3 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

File details

Details for the file simt_emlite-1.1.0-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for simt_emlite-1.1.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 e80ae7f43b889b45e7d9eb6710fdb1d6b719f8e3216f5b3adccb07da37d54ef0
MD5 008025f1900c658a8a5fe95aa3a1c946
BLAKE2b-256 4cf939aa0203d5bc33fc8f46350ad492e03778a15b202c1a9be998712b5f9a5a

See more details on using hashes here.

File details

Details for the file simt_emlite-1.1.0-cp313-cp313-win32.whl.

File metadata

  • Download URL: simt_emlite-1.1.0-cp313-cp313-win32.whl
  • Upload date:
  • Size: 2.0 MB
  • Tags: CPython 3.13, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for simt_emlite-1.1.0-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 d55d42d5ad980ab43752c69f54e21b1d9b6d6a87f3209989fb4295bf04f152dc
MD5 5d3ba7143d5f7a2aae4327968f57d303
BLAKE2b-256 d7c1099889f28f51b0402fb576f11d53d5764de20584eae280e27e43f465dd94

See more details on using hashes here.

File details

Details for the file simt_emlite-1.1.0-cp313-cp313-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for simt_emlite-1.1.0-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 9068d1cd6328ac212e37c8592c931f5b741d584811dab8c50e2160e4a251c4ad
MD5 567504b225bb4b2df9f3c137e38558e9
BLAKE2b-256 d1dab3f7bf531cd268665a8810a8496f9d136aa8da836614a064b54f60e87bde

See more details on using hashes here.

File details

Details for the file simt_emlite-1.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for simt_emlite-1.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 98ea4a1b565a182ddf5a75ad8cf45dbd567063731b5fad8b34b077d221f2ab54
MD5 e47a2f91967b1fc543617d34368eb103
BLAKE2b-256 b6d381e3458f8a755136005ac0f6b4a3ddd0b5675f60677a95260243d4fc9093

See more details on using hashes here.

File details

Details for the file simt_emlite-1.1.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for simt_emlite-1.1.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9a2e8154c146bb6ddbdc224c4b219473d3f5750ad3cdbd6c688188ccd9b51d16
MD5 06cfd430994899786e5503dfe8683bf6
BLAKE2b-256 941817a2e960b88df97f2e5b7c960898451a8cffd69d8086e612f50167a6b421

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page