Skip to main content

Integrated control unit

Project description

ROX-ICU python driver

This package provides a high-level interface to ROX Integrated Control Unit.

For more information see product page

Cli

The package installs icu command line tool with fuctional commands

  mock     Mock ICU device on CAN bus
  monitor  Monitor ICU devices on CAN bus
  output   Set output state, provide hex value

Quick start

import asyncio
import logging

from rox_icu.core import ICU
from rox_icu.utils import run_main_async

NODE_ID = 1

SENSOR_PIN = 7
RELAY_PIN = 0

log = logging.getLogger("main")


async def handle_input(icu: ICU) -> None:
    log.info("Starting input handler")

    sensor = icu.pins[SENSOR_PIN]
    relay = icu.pins[RELAY_PIN]
    relay.state = False

    while True:
        log.info("Waiting for high state")
        await sensor.high_event.wait()
        log.info(f"Sensor state: {sensor.state}")

        # toggle relay
        relay.state = True
        await asyncio.sleep(0.1)
        relay.state = False


async def main() -> None:

    icu = ICU(NODE_ID)
    await icu.start()

    try:
        await handle_input(icu)
    finally:
        await icu.stop()
        print("Done")


if __name__ == "__main__":
    run_main_async(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

rox_icu-2.3.1.tar.gz (800.0 kB view details)

Uploaded Source

Built Distribution

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

rox_icu-2.3.1-py3-none-any.whl (26.5 kB view details)

Uploaded Python 3

File details

Details for the file rox_icu-2.3.1.tar.gz.

File metadata

  • Download URL: rox_icu-2.3.1.tar.gz
  • Upload date:
  • Size: 800.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.10

File hashes

Hashes for rox_icu-2.3.1.tar.gz
Algorithm Hash digest
SHA256 ff4e042cfebd39ef3a1a58548ecdb58fcd1a6a93cdb6e716315a757ae5538afc
MD5 aa38909e9df5f926556cbee735247bb7
BLAKE2b-256 2ac1a73cd1803267750dcd1f4d893845f10e2b60b9c04131017a1b31a1312825

See more details on using hashes here.

File details

Details for the file rox_icu-2.3.1-py3-none-any.whl.

File metadata

  • Download URL: rox_icu-2.3.1-py3-none-any.whl
  • Upload date:
  • Size: 26.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.10

File hashes

Hashes for rox_icu-2.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f6076e20e374ace3b18195ba511e408d81f4f20e049c6df2a249a5df9aff5506
MD5 e3b1c955cbb5ddfebac4772aff56a2f4
BLAKE2b-256 7270f76b45abd58a2e6b40adcf6a4c4dbf89e658a7154fa0917262400150f514

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