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.0.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.0-py3-none-any.whl (26.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rox_icu-2.5.0.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.0.tar.gz
Algorithm Hash digest
SHA256 190b6a3e38c35a57a878830b4b8e0c0942e1eef89498db4fef5b28f696dae0bd
MD5 3a3a71caae830244f0d735f9cdb66cee
BLAKE2b-256 e73ddafaee9590ad47d6be37175a74d3ef329d9bacb53aef984d70107560b659

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rox_icu-2.5.0-py3-none-any.whl
  • Upload date:
  • Size: 26.8 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e7567cb53c682e56abbb0a376624a951226c1eb4a86ae844c70a4804bc7293cd
MD5 4fcaf5099c646d887550ec63fc4cad7f
BLAKE2b-256 9d31977183948d1d76863b69f44feaf1fffa56fb7e19612b4667b3a6966e082e

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