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

Uploaded Source

Built Distribution

rox_icu-0.4.2-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rox_icu-0.4.2.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.2.tar.gz
Algorithm Hash digest
SHA256 8f0559c150117ac68301314276490687dfc3968f9750c5dd286ee38b97eb870b
MD5 761f12d4cf79f1600620777033a65d58
BLAKE2b-256 a0be9bcaafe671e77cd1faa8e769c1b9e7ca326037ae25bd499661e9d7d32161

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rox_icu-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 15.3 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a4784fa82515258e54f95e4c12b9ed3df2dfd96668df14865d5e788cf9df8897
MD5 2b9fd5982cb825f26b50d9ebd8764142
BLAKE2b-256 fb05e16b4f791cf39bfbdd5ff291103e3d0d8a5373137a64b6ee9522c2e50f2a

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