Skip to main content

Python CLI + library for Camlock USB-serial access control devices (CH340).

Project description

camcommand

Windows-first Python CLI + library for communicating with Camlock USB serial devices (CH340), including PICO Hub-style line commands.

Install

pip install camcommand

CLI usage

camcommand list
camcommand connect
camcommand send STATE
camcommand send UNLOCK
camcommand send TEMP
camcommand temp
camcommand interactive
camcommand --com COM15 reflash firmware.hex
camcommand --com COM15 dump backup.hex
camcommand --com COM15 acs200 send state
camcommand --com COM15 acs200 send unlock,3

ACS-200 (CAMCOMMAND hub) quickstart

ACS-200 uses different serial settings and command syntax than the 115200-baud lock devices:

  • Serial settings: 9600 8N1, newline terminator LF (\n).
  • Commands are typically lowercase and comma-separated (examples below).
  • camcommand disables DTR/RTS by default for ACS-200 to avoid device resets on connect caused by control-line toggling (use --dtr on / --rts on only if your hardware requires it).
  • camcommand waits briefly after opening the serial port before sending commands (default: 2 seconds) to allow the controller to finish initialization; override with --connect-delay.
  • Some firmware variants prefix responses with a numeric status/event code (e.g. 6); camcommand will print a short decode to stderr and return that non-zero code as the process exit code.

Examples:

camcommand --com COM15 acs200 state
camcommand --com COM15 acs200 locks
camcommand --com COM15 acs200 unlock 3
camcommand --com COM15 acs200 --trace unlock 3
camcommand --com COM15 acs200 hold on
camcommand --com COM15 acs200 unlock all
camcommand --com COM15 acs200 output 1 on
camcommand --com COM15 acs200 outputs off
camcommand --com COM15 acs200 temp 10
camcommand --com COM15 acs200 interactive

Raw passthrough is still available if you want to send exactly what the firmware expects:

camcommand --com COM15 acs200 send get_state
camcommand --com COM15 acs200 send set_relock_duration,10

Optional multi-channel flag (reserved for ACS200-style devices):

camcommand send STATE --port 3

Python usage

from camcommand import SerialManager
from camcommand.serial_manager import SerialConfig

with SerialManager(SerialConfig(port="COM15")) as mgr:
    print(mgr.send_and_read_response("STATE"))

Example app

Run the included example script:

python examples\basic_demo.py
python examples\basic_demo.py --com COM15

Notes

  • Commands are sent as complete lines terminated by \n (never character-by-character).
  • Responses are read as line-based text; multi-line responses are collected until a blank line or timeout.
  • Serial speed is fixed at 115200 baud.
  • Package name on PyPI and the import/package name are both camcommand.
  • For development installs from source, you can use pip install -e . from the project folder.
  • reflash is standalone (no extra Python deps beyond pyserial) and targets the Camlock UPDI setup used by the reference flashing app.
  • dump reads the entire flash over UPDI and saves an Intel HEX file.
  • reflash vendors a subset of the pyupdi project (MIT); see camcommand/_pyupdi/LICENSE in the source distribution.

Linux quickstart

  • Install: pip install camcommand
  • List ports: camcommand list
  • If you get PermissionError opening /dev/ttyUSB0, add your user to the dialout group and re-login:
    • sudo usermod -a -G dialout $USER

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

camcommand-0.3.8.tar.gz (27.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

camcommand-0.3.8-py3-none-any.whl (35.1 kB view details)

Uploaded Python 3

File details

Details for the file camcommand-0.3.8.tar.gz.

File metadata

  • Download URL: camcommand-0.3.8.tar.gz
  • Upload date:
  • Size: 27.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for camcommand-0.3.8.tar.gz
Algorithm Hash digest
SHA256 c929bff96723cdf2ac5c70f8e509ce4bbd76908562024aea26d344eb325abba8
MD5 6ba329a2fdbe558c6853313b6fd54d11
BLAKE2b-256 ca8f1b8b7b6619584e2de72e0070f24861972b8753795a79815c2b292ad63b60

See more details on using hashes here.

File details

Details for the file camcommand-0.3.8-py3-none-any.whl.

File metadata

  • Download URL: camcommand-0.3.8-py3-none-any.whl
  • Upload date:
  • Size: 35.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for camcommand-0.3.8-py3-none-any.whl
Algorithm Hash digest
SHA256 f79566ad7990f56cffdfd799acc5110be91e6b7efdf6fe5ca1af4ac04ffe960a
MD5 1e1a7159e227e8bf086a64ebdf611aef
BLAKE2b-256 480a7a65ab2caf0746832cbbcd01500a49441535fdbee2341c912a130e1bcaa6

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