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.5.1.tar.gz (803.6 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.5.1-py3-none-any.whl (26.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rox_icu-2.5.1.tar.gz
  • Upload date:
  • Size: 803.6 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.5.1.tar.gz
Algorithm Hash digest
SHA256 e18fa9f3006ed51463b913b183691c84d113db7a065a26698985289ea689d712
MD5 e30583c3c7cad95a2ebde9cc49e43a63
BLAKE2b-256 d544822d4f29ebb309697ff38f76366baa40f76386847ed95917b6eb7fd4f2da

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rox_icu-2.5.1-py3-none-any.whl
  • Upload date:
  • Size: 26.9 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.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ea9071e10d6b9e2f34d55285679f0100a3a4b64f9d8b50da1562fd96dc89d68c
MD5 d05b9c38eb9baaa6204cf0fa9caa9b86
BLAKE2b-256 2a2b676874842f0cb8a2f739725288786bfeee0efc932528b459b62c61239a60

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