Skip to main content

Python Iskra devices interface

Project description

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())

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

pyiskra-0.1.23.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

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

pyiskra-0.1.23-py3-none-any.whl (22.3 kB view details)

Uploaded Python 3

File details

Details for the file pyiskra-0.1.23.tar.gz.

File metadata

  • Download URL: pyiskra-0.1.23.tar.gz
  • Upload date:
  • Size: 15.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.23

File hashes

Hashes for pyiskra-0.1.23.tar.gz
Algorithm Hash digest
SHA256 f91d19ef7c441761dad657b298988f6865af9994fa19b7efc5011491d5a9b673
MD5 a7a8065bd2542ef9a8263ddf417e235e
BLAKE2b-256 791db35b892e022386c8e47589cedea9f65e105ef34f83bc6091223f5844d6e9

See more details on using hashes here.

File details

Details for the file pyiskra-0.1.23-py3-none-any.whl.

File metadata

  • Download URL: pyiskra-0.1.23-py3-none-any.whl
  • Upload date:
  • Size: 22.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.23

File hashes

Hashes for pyiskra-0.1.23-py3-none-any.whl
Algorithm Hash digest
SHA256 f2f8a2e5f6dfc8119e3192a1c0dd5e372d4f0a18e11f7c1e6168e1056536c0b4
MD5 45daf72486a8f72098ad8bc77c5d8e74
BLAKE2b-256 222201fb3319bb0a48cfd46672da023552d597133f2e5c8b41d0c46abf2b431f

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