Skip to main content

PyIskra

PyIskra is a Python package designed to provide interface for Iskra devices using SG and it's RestAPI or ModbusTCP/RTU.

Installation

You can install PyIskra using pip:

pip install pyiskra

Features

  • Object-oriented mapping for energy meters
  • Access to measurements
  • Access to Energy counters

Supported devices

  • Smart Gateway
  • IE38
  • IE14
  • MCXXX
  • iMCXXX
  • MTXXX
  • iMTXXX

Usage

Here's a basic example of how to use PyIskra:

import asyncio
from pyiskra.devices import Device
from pyiskra.adapters import RestAPI


device_ip = "192.168.1.1"
device_auth = {"username": "admin", "password": "iskra"}

async def main():
    # Set device IP address

    # Create adapter
    adapter = RestAPI(ip_address=device_ip, authentication=device_auth)

    # Create device
    device = await Device.create_device(adapter)

    # Initalize device
    await device.init()

    devices = [device]


    if device.is_gateway:
        devices += device.get_child_devices()


    for device in devices:
        # Update device status
        print(f"Updating status for {device.model} {device.serial}")
        await device.update_status()

        if device.supports_measurements:
            for index, phase in enumerate(device.measurements.phases):
                print(f"Phase {index+1} - U: {phase.voltage.value} {phase.voltage.units}, I: {phase.current.value} {phase.current.units} P: {phase.active_power.value} {phase.active_power.units} Q: {phase.reactive_power.value} {phase.reactive_power.units} S: {phase.apparent_power.value} {phase.apparent_power.units} PF: {phase.power_factor.value} {phase.power_factor.units} PA: {phase.power_angle.value} {phase.power_angle.units} THD U: {phase.thd_voltage.value} {phase.thd_voltage.units} THD I: {phase.thd_current.value} {phase.thd_current.units}")

        if device.supports_counters:
            for counter in device.counters.non_resettable :
                print(f"Non-resettable counter - Name: {counter.name}, Value: {counter.value} {counter.units}, Direction: {counter.direction}")


            for counter in device.counters.resettable:
                print(f"Resettable counter - Name: {counter.name}, Value: {counter.value} {counter.units}, Direction: {counter.direction}")

asyncio.run(main())

Metadata

Release files for pyiskra 0.1.29

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

Source distribution (sdist)

Source distribution for pyiskra 0.1.29
File Size Uploaded
pyiskra-0.1.29.tar.gz 19.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyiskra 0.1.29
File Interpreter ABI Platform
pyiskra-0.1.29-py3-none-any.whl Python 3 none any Details

Total release size: 46.1 kB

Release files / pyiskra-0.1.29.tar.gz

Download URL pyiskra-0.1.29.tar.gz
Size 19.8 kB
Tags Source
SHA-256 checksum
How to use checksums
9fe14e7ebc3895be59ce5c6e754ef591a4b9804901063e6db0c113da604d83a8
BLAKE2b-256 checksum
How to use checksums
b3a6c682bfcf0f62d6fe6b56d701ab14f70a6709a78d6e8876dc54ec64afb1a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / pyiskra-0.1.29-py3-none-any.whl

Download URL pyiskra-0.1.29-py3-none-any.whl
Size 26.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8cbcde7981f14aa0ed4a0e646833048582a175599f1069e774e80e4de5edd326
BLAKE2b-256 checksum
How to use checksums
446edf42f4fe8ff62aed87fe0d56090af713782033d33d29c22bfa609bf10d7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25
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