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 CR (\r).
  • Commands are typically lowercase and comma-separated (examples below).

Examples:

camcommand --com COM15 acs200 state
camcommand --com COM15 acs200 locks
camcommand --com COM15 acs200 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.7.tar.gz (25.6 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.7-py3-none-any.whl (33.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: camcommand-0.3.7.tar.gz
  • Upload date:
  • Size: 25.6 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.7.tar.gz
Algorithm Hash digest
SHA256 59120055aab3371e59498d1e8b53bf62721ff1bdef5441933059404accdf4d6d
MD5 60411c1c4f24493e8224a4c29872e6e5
BLAKE2b-256 fd6b35af1b473ee0d39c996b5d26db502ff9b838e486ee581929746e36ddff20

See more details on using hashes here.

File details

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

File metadata

  • Download URL: camcommand-0.3.7-py3-none-any.whl
  • Upload date:
  • Size: 33.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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 117b39e624afd652eed13954dc8946071e529e092de872e5c08a51a88b0b4e35
MD5 4adc87d7f24b0eeebb8128882a6e3589
BLAKE2b-256 5f2be2753d7b7a7369e8ccce80e3e7fd099b5226490557ed7ce8b956d1986d76

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