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
Release history Release notifications | RSS feed
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.6.tar.gz
(13.6 kB
view details)
Built Distribution
pyiskra-0.1.6-py3-none-any.whl
(19.7 kB
view details)
File details
Details for the file pyiskra-0.1.6.tar.gz
.
File metadata
- Download URL: pyiskra-0.1.6.tar.gz
- Upload date:
- Size: 13.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34fdb75e69a0765364e713df232a4d49aa2cd57768a8cbd2a8e155f8a2f00d7b |
|
MD5 | c3ca9ee8b9a45f29d5652157cc053b14 |
|
BLAKE2b-256 | 54a3cfaa0e96296b08922317656079c95b6ddab3b4d5e52a7ee3ed12a1347fc5 |
File details
Details for the file pyiskra-0.1.6-py3-none-any.whl
.
File metadata
- Download URL: pyiskra-0.1.6-py3-none-any.whl
- Upload date:
- Size: 19.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9445badde3d2b91725f39f6c3f804c1f1f73eb25e7f1c60a9a528f8a8505b380 |
|
MD5 | ae2d2b53e5f11483e3ff4e42082e7421 |
|
BLAKE2b-256 | 79d819588357c9f63c99a2259ef992393574e1b7c0a51ae97b68e9012a3de279 |