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
Release history Release notifications | RSS feed
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.1.0.tar.gz
(795.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
rox_icu-2.1.0-py3-none-any.whl
(18.2 kB
view details)
File details
Details for the file rox_icu-2.1.0.tar.gz.
File metadata
- Download URL: rox_icu-2.1.0.tar.gz
- Upload date:
- Size: 795.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
410cbbee67a6ebb28dc77ebe047c5a7c3587ce8bd9594f4174779356c9203f0c
|
|
| MD5 |
1c844730d8e676185a9df908ecfc94f1
|
|
| BLAKE2b-256 |
d0b48db53848d7ce6f3762bebd1d2d30d968eeb4723bfb855e09db94d45540fe
|
File details
Details for the file rox_icu-2.1.0-py3-none-any.whl.
File metadata
- Download URL: rox_icu-2.1.0-py3-none-any.whl
- Upload date:
- Size: 18.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66e6caa42165f65d3f1c463c5edbfd34d736c0e49d6115db2a82f56cee25f775
|
|
| MD5 |
6cc3407c07234107f3780a984b7c8548
|
|
| BLAKE2b-256 |
e6c99a6856b8e17eff96336981bcad6517b4c968122f58abc211226b533dbe3d
|