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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13Windows x86

simt_emlite-1.2.7-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.7-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.7-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.7-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for simt_emlite-1.2.7-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 e2ddb6ca33cd57da5ab55ca2302516736d826bc191aead9aac997b9f87a34385
MD5 aabf4af45f2e0ab5441b408241d247ac
BLAKE2b-256 8dfd6b15ef6037164f90556043418c44037b4a2707028fc30e447ef313cfc5e6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: simt_emlite-1.2.7-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.7-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 a73f6cba6028912edd02e3740fbe289e438541290f3614a71bc53b7ef64d0a58
MD5 7d5808eb6e1e83942bbe6b706e21e58f
BLAKE2b-256 ca471c0920bbf31ee84e38e8f5c382802105aa934b1e2386540e0fe704cbc765

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for simt_emlite-1.2.7-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 25f772b1c9435fdab252790816eb22a4d667c6958771c74a247f6b9b112c0aa7
MD5 006e8fbc0ec5f50effe029cc6e89b2e5
BLAKE2b-256 3dbefae243250be99324196fc9c307750692056b94b26838ca429022afc885dd

See more details on using hashes here.

File details

Details for the file simt_emlite-1.2.7-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.7-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b011d845584129c1ceb74b54a5929fdaeefe13adafdc3fc716cd9fbce21ba8cb
MD5 d556b302765263ecce78decc84e60eb2
BLAKE2b-256 f674b37a29d3297e75e3462263cdc41844d1a2c7e9dfa5106e04a2260fc04a21

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for simt_emlite-1.2.7-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 18e4100d2ee8a4acea87667549c5973e7ab37d00e9340fb3d6e4c4dadbc8b37d
MD5 97963b8e25f18c0ed582efb52a205ddf
BLAKE2b-256 57006dff9d865526bfb4c5b9f7ead1b69ceac0eff44067821a2b56ce3c5e1d59

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