pyiskra


Namepyiskra JSON
Version 0.1.14 PyPI version JSON
download
home_pagehttps://github.com/Iskramis/pyiskra
SummaryPython Iskra devices interface
upload_time2024-09-23 11:01:34
maintainerIskra <razvoj.mis@iskra.eu>
docs_urlNone
authorIskra d.o.o.
requires_python>=3.8
licenseGPL
keywords homeautomation iskra energy meter
VCS
bugtrack_url
requirements aiohttp pymodbus
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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:

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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Iskramis/pyiskra",
    "name": "pyiskra",
    "maintainer": "Iskra <razvoj.mis@iskra.eu>",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "homeautomation, iskra, energy meter",
    "author": "Iskra d.o.o.",
    "author_email": "razvoj.mis@iskra.eu",
    "download_url": "https://files.pythonhosted.org/packages/05/0c/ac3a484edcbe3ecf85e1dcd1bd0e79dbed2eabee3f64886f18c710ff4be6/pyiskra-0.1.14.tar.gz",
    "platform": null,
    "description": "# PyIskra\n\nPyIskra is a Python package designed to provide interface for Iskra devices using SG and it's RestAPI or ModbusTCP/RTU.\n\n## Installation\n\nYou can install PyIskra using pip:\n\n```bash\npip install pyiskra\n```\n\n## Features\n\n- Object-oriented mapping for energy meters\n- Access to measurements\n- Access to Energy counters\n\n## Supported devices\n\n- Smart Gateway\n- IE38\n- IE14\n- MCXXX\n- iMCXXX\n- MTXXX\n- iMTXXX\n\n\n## Usage\n\nHere's a basic example of how to use PyIskra:\n\n```\nimport asyncio\nfrom pyiskra.devices import Device\nfrom pyiskra.adapters import RestAPI\n\n\ndevice_ip = \"192.168.1.1\"\ndevice_auth = {\"username\": \"admin\", \"password\": \"iskra\"}\n\nasync def main():\n    # Set device IP address\n\n    # Create adapter\n    adapter = RestAPI(ip_address=device_ip, authentication=device_auth)\n\n    # Create device\n    device = await Device.create_device(adapter)\n\n    # Initalize device\n    await device.init()\n\n    devices = [device]\n\n\n    if device.is_gateway:\n        devices += device.get_child_devices()\n\n\n    for device in devices:\n        # Update device status\n        print(f\"Updating status for {device.model} {device.serial}\")\n        await device.update_status()\n\n        if device.supports_measurements:\n            for index, phase in enumerate(device.measurements.phases):\n                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}\")\n\n        if device.supports_counters:\n            for counter in device.counters.non_resettable :\n                print(f\"Non-resettable counter - Name: {counter.name}, Value: {counter.value} {counter.units}, Direction: {counter.direction}\")\n\n\n            for counter in device.counters.resettable:\n                print(f\"Resettable counter - Name: {counter.name}, Value: {counter.value} {counter.units}, Direction: {counter.direction}\")\n\nasyncio.run(main())\n```\n",
    "bugtrack_url": null,
    "license": "GPL",
    "summary": "Python Iskra devices interface",
    "version": "0.1.14",
    "project_urls": {
        "Homepage": "https://github.com/Iskramis/pyiskra"
    },
    "split_keywords": [
        "homeautomation",
        " iskra",
        " energy meter"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8ea4550e6aa0b00404ac5d0b7263e124ca633da6934be63627cbd43ef672d7d4",
                "md5": "8ff56fec4031fb4b33dc89f52c109608",
                "sha256": "065f48bae7bc132fff7962cc755e194a4216b5bc80be28572b48c7cfd278f373"
            },
            "downloads": -1,
            "filename": "pyiskra-0.1.14-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8ff56fec4031fb4b33dc89f52c109608",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 20277,
            "upload_time": "2024-09-23T11:01:32",
            "upload_time_iso_8601": "2024-09-23T11:01:32.867679Z",
            "url": "https://files.pythonhosted.org/packages/8e/a4/550e6aa0b00404ac5d0b7263e124ca633da6934be63627cbd43ef672d7d4/pyiskra-0.1.14-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "050cac3a484edcbe3ecf85e1dcd1bd0e79dbed2eabee3f64886f18c710ff4be6",
                "md5": "201b9365a1a322235cd5c5eb36df4a6b",
                "sha256": "3745f7f8eed32948ca5607476eac45013b43f0fc217db6a611034439c8dad2fe"
            },
            "downloads": -1,
            "filename": "pyiskra-0.1.14.tar.gz",
            "has_sig": false,
            "md5_digest": "201b9365a1a322235cd5c5eb36df4a6b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 14168,
            "upload_time": "2024-09-23T11:01:34",
            "upload_time_iso_8601": "2024-09-23T11:01:34.303334Z",
            "url": "https://files.pythonhosted.org/packages/05/0c/ac3a484edcbe3ecf85e1dcd1bd0e79dbed2eabee3f64886f18c710ff4be6/pyiskra-0.1.14.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-23 11:01:34",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Iskramis",
    "github_project": "pyiskra",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "aiohttp",
            "specs": []
        },
        {
            "name": "pymodbus",
            "specs": []
        }
    ],
    "lcname": "pyiskra"
}
        
Elapsed time: 0.32871s