Skip to main content

grated 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-0.4.1.tar.gz (783.0 kB view details)

Uploaded Source

Built Distribution

rox_icu-0.4.1-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for rox_icu-0.4.1.tar.gz
Algorithm Hash digest
SHA256 4178f795e4e7df49c59165e545c98f4e4475be0c581d16cee1c93712750e8e92
MD5 29fcc4051dd39330806df82bf3ee69bf
BLAKE2b-256 0e5014d4c21cdd19f40e8eff138bf6e7e20b0add40447b76da744efa5ff71676

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for rox_icu-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 976d74d4d72dda4bd217355059347ea736ce1c5e3d87e725776a63c4fe0c33eb
MD5 b62ce60dfaded204be0309c86cdc436c
BLAKE2b-256 3853b7711ebe918de963cdc1bce9c50c5e43eb8cd7522d12f2c73cc69b519bc1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page