Skip to main content

Async Python driver for the DSC IT-100 serial integration module

Project description

dsc-it100

Async Python driver for the DSC IT-100 serial integration module.

Installation

pip install dsc-it100

Quick start

import asyncio
from dsc_it100 import IT100
from dsc_it100.constants import CMD_ZONE_OPEN, CMD_PARTITION_ARMED

def handle_zone_update(driver, pkt):
    d = pkt['parsed']
    if pkt['command'] == CMD_ZONE_OPEN:
        print(f"Zone {d['zone']} opened")

def handle_partition_update(driver, pkt):
    d = pkt['parsed']
    if pkt['command'] == CMD_PARTITION_ARMED:
        print(f"Partition {d['partition']} armed ({d['mode']})")

def handle_general_update(driver, pkt):
    print(f"Event {pkt['command']}: {pkt['parsed']}")

async def main():
    panel = IT100('/dev/ttyUSB0', baud=9600)
    panel.handler_zone_update      = handle_zone_update
    panel.handler_partition_update = handle_partition_update
    panel.handler_general_update   = handle_general_update
    await panel.connect()
    await asyncio.sleep(0)
    await panel.poll()
    await panel.request_status()
    await panel.request_labels()
    try:
        await asyncio.Future()
    except (KeyboardInterrupt, asyncio.CancelledError):
        pass
    finally:
        await panel.disconnect()

asyncio.run(main())

Event handlers

Property Fires when
handler_zone_update packet contains a zone field (open, close, alarm, tamper, fault)
handler_partition_update packet contains a partition field but no zone (ready, armed, disarmed, delay, alarm)
handler_general_update every incoming packet (catch-all)

Each handler receives (driver, packet) where packet is:

{
    'command':  '609',       # 3-digit IT-100 command code
    'data':     '001',       # raw data field
    'checksum': 'CC',
    'valid':    True,
    'parsed':   {'zone': 1}, # command-specific parsed fields
}

Handlers may be plain functions or coroutines.

Commands

await panel.poll()
await panel.request_status()
await panel.request_labels()
await panel.arm_away(partition=1)
await panel.arm_stay(partition=1)
await panel.arm_with_code(partition=1, code='1234')
await panel.disarm(partition=1, code='1234')
await panel.trigger_panic()
await panel.bypass_zone(zone=3, code='1234')

Requirements

  • Python 3.10+
  • pyserial

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

py_dsc_it100-1.0.0.tar.gz (172.5 kB view details)

Uploaded Source

Built Distribution

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

py_dsc_it100-1.0.0-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

Details for the file py_dsc_it100-1.0.0.tar.gz.

File metadata

  • Download URL: py_dsc_it100-1.0.0.tar.gz
  • Upload date:
  • Size: 172.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for py_dsc_it100-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ca74c27a4e1433402733867c0bdffc9c8d701036ff068d22f238a1492070e06c
MD5 dbf6fb562271e8fc3d51d2dd5d0fe926
BLAKE2b-256 abf9d8ac4f4a378c1d8bcde1964be48c9e254c8475e968126b6b75881f2d9e1e

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_dsc_it100-1.0.0.tar.gz:

Publisher: publish.yml on SG14-96/dsc_it100

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file py_dsc_it100-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: py_dsc_it100-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 13.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for py_dsc_it100-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ec2af59af3457db1fba31d3e90dcf0ff7efc81a7967372c40d0ce14bc17d6221
MD5 82020f154a4c98fcb15fde4a3159fe24
BLAKE2b-256 71dff3ec8ff3f88a949046b5b5f1a40442b66fae32928728be97fc2b871c7470

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_dsc_it100-1.0.0-py3-none-any.whl:

Publisher: publish.yml on SG14-96/dsc_it100

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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