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.4.0.tar.gz (803.1 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.4.0-py3-none-any.whl (26.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rox_icu-2.4.0.tar.gz
  • Upload date:
  • Size: 803.1 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.4.0.tar.gz
Algorithm Hash digest
SHA256 9d155a2d0c26985d6750443f477d56e190407278f328b5ba1b544996dfc1eadf
MD5 cf08c53633f42c4bb64bf8f455ec1710
BLAKE2b-256 b08090236d3213303e8c93fa583701b4512bf2beb7ef76c59b68a605168d7049

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rox_icu-2.4.0-py3-none-any.whl
  • Upload date:
  • Size: 26.7 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.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 707d60f226171066eda6dafca47b23c27ed5c344ef07bc44c09919248eb7ce9a
MD5 a560fc50518c37a911ee5456c7da9bf7
BLAKE2b-256 ae6fec025fe6b521016e628c11f2a03550147de67d2fb2e6187923ceeb703ad4

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