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.2.10-cp313-cp313-win_amd64.whl (2.4 MB view details)

Uploaded CPython 3.13Windows x86-64

simt_emlite-1.2.10-cp313-cp313-win32.whl (2.1 MB view details)

Uploaded CPython 3.13Windows x86

simt_emlite-1.2.10-cp313-cp313-musllinux_1_2_x86_64.whl (16.7 MB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

simt_emlite-1.2.10-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (17.1 MB view details)

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

simt_emlite-1.2.10-cp313-cp313-macosx_11_0_arm64.whl (2.4 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for simt_emlite-1.2.10-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 35ce2710edfa0206b5569cfbb7b75c47f8130403915f023486b1b5cb1bf2d6b5
MD5 f8a742e47336b217d31671534e8ef226
BLAKE2b-256 1cfdd3401764af2a1b38289f2992511187b614536f3d6150be4a6a5d79375712

See more details on using hashes here.

File details

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

File metadata

  • Download URL: simt_emlite-1.2.10-cp313-cp313-win32.whl
  • Upload date:
  • Size: 2.1 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.2.10-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 1c531f711437702a1edc1c2c0e9e31774ac64ae46886af90ecb8a811f1ea1106
MD5 0d7cf0affc4e6f19a2dde0b772c40c09
BLAKE2b-256 d4c3f6624c895d463f861a5cbf8dc76e32d0f3c8de3febbc9f9f536ea4345828

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for simt_emlite-1.2.10-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 d9777010877b5b20b97e3963023ab264dc77863aa68e7b17c5317f2eec83126d
MD5 c10b8eb4e0a54467140df7b130d201b0
BLAKE2b-256 0241bfcda10c7c7bdfb3d1c4ba1473025d582e5927bc73bd30122e1275b11096

See more details on using hashes here.

File details

Details for the file simt_emlite-1.2.10-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.2.10-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fcf0a7f914cfb1ca6552bb76d588e85af40f95a3d91165306715e32774f8b221
MD5 3331007eda98b49011cab0f2fdb47ebe
BLAKE2b-256 297893dd6555c92eeb50cf32318a712023ddfc1815c97a05981fabc347354917

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for simt_emlite-1.2.10-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b4ed38d0d94012110ac2f0148f5b7e9f887ce87c41b86a86db00056650c92eca
MD5 fa42fe760fba98e2bcac3f4dce48e648
BLAKE2b-256 fd20534f404cc13ad6bc7ab3d54b99633195b506cf10c422ec1e2da5df4efdef

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