Skip to main content

Konnected Python library

This is a simple Python library to talk to a Konnected device. Konnected is an open-source software for ESP8266 devices that enables simple wired binary sensors and actuators to talk to home automation frameworks such as Home Assistant and SmartThings. The most popular use case for Konnected is to connected a wired home alarm system to your Smart Home hub.

This library was written to support Home Assistant integration.

For more information see konnected.io

Usage


import aiohttp
import asyncio
import konnected

async def fetch(session, url):
    async with session.get(url) as response:
        return await response.text()

async def main():
    async with aiohttp.ClientSession() as session:
        k = konnected.Client('192.168.86.10', '17000', session)

        # Sync settings to the device

        print(await k.put_settings(sensors=[{"pin":1}], actuators=[], auth_token='secureToken', endpoint='http://example.com'))
        # True

        # Get status of each input pin

        print(await k.get_device())  
        # [{'state': 0, 'pin': 1}, {'state': 1, 'pin': 2}]

        # Get status of a single input pin

        print(await k.get_device(2))
        # [{'state': 1, 'pin': 2}]

        # Actuate an output pin

        print(await k.put_device(pin=8, state=1))
        # {'state': 1, 'pin': 8}

        # Get status of each input zone

        print(await k.get_zone())  
        # [{'state': 0, 'zone': 1}, {'state': 1, 'zone': 2}]

        # Get status of a single input zone

        print(await k.get_zone(2))
        # [{'state': 1, 'zone': 2}]

        # Actuate an output zone

        print(await k.put_zone(zone=8, state=1))
        # {'state': 1, 'zone': 8}

        # Get device status

        await k.get_status()
        # {'mac': '2c:3a:e8:43:8a:38', 'gw': '192.168.86.1', 'hwVersion': '2.0.5', 'rssi': -31, 'nm': '255.255.255.0', 'ip': '192.168.86.10', 'actuators': [{'trigger': 1, 'pin': 8}], 'port': 12426, 'uptime': 2349, 'heap': 23904, 'swVersion': '2.1.3', 'sensors': [{'state': 0, 'pin': 1}]}

if __name__ == '__main__':
    loop = asyncio.get_event_loop()
    loop.run_until_complete(main())

Python version

This library was designed to work with Python 3.5 and above.

Metadata

Release files for konnected 1.2.0

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

Source distribution (sdist)

Source distribution for konnected 1.2.0
File Size Uploaded Provenance Actions
konnected-1.2.0.tar.gz 3.4 kB Without provenance Details for konnected-1.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 7.7 kB

Release files / konnected-1.2.0.tar.gz

Download URL konnected-1.2.0.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b8b4e15c3228b01c9fad3651e09fea1654357ae8c333096e759a1b7d0eb4e789
BLAKE2b-256 checksum
How to use checksums
365efbecfc52432d7c819fc8a4424ca32a2fe08b8e9338548705785c06efb769
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.3.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.5

Release files / konnected-1.2.0-py3-none-any.whl

Download URL konnected-1.2.0-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
41ff41fef147902a5e41c8acf4506ea991a845310ccbe47121050a9681277df1
BLAKE2b-256 checksum
How to use checksums
5740bc5043ac6e4c98d5fc39623474fc0bb212b8b92247504c535c51fb4831c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.3.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.5

Security for konnected 1.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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