Pop open cash drawer with http GET request
Project description
cdpop
Pop open cash drawer using http or https GET request:
GET /status Return cash drawer status
GET /open Request cash drawer open
If authentication is configured, supply user and/or auth as query parameters, eg:
GET /status?auth=Ricim8Knak
Requests to open drawer will return successfully (200) as soon as possible, but will be processed in turn once access to the attached device is available. No feedback is provided for an open request.
Requests for status will block until a valid status can be read from the attached device. In the case of a hardware error, status requests will return Internal Server Error (500).
Usage
$ cdpop [config.json]
Requirements
- python >= 3.9
- tornado
- posiflex-hidcd
Configuration
Copy example config to a new file and edit as required. Available configuration options:
- port (int) TCP service port, default: 41514 (optional)
- host (string) Listen address, default: "localhost" (optional)
- cert (string) TLS certificate path, default: None (optional)
- key (string) TLS private key path, default: None (optional)
- auth (string) Authorisation key, default: None (optional)
- user (string) Authorisation username, default: None (optional)
- drawer (int) Cash drawer number, default: None (optional)
Notes:
- If drawer number is not specified, cdpop will connect to the first hid cash drawer found. See related project posiflex-hidcd for details.
- To listen on all addresses, specify the empty string "" for host.
MacOS Installation
Install xcode developer tools:
$ xcode-select --install
Install brew according to brew website.
Install hidapi using brew:
$ brew install hidapi
Install python3 if not already installed:
$ brew install python@3.12
Using python, create a venv and install cdpop packages using pip:
$ python3 -m venv cdpop --system-site-packages
$ ./cdpop/bin/pip install cdpop
Optionally, create a cdpop config file.
Create launch agent plist file (see example cdpop.plist), copy to ~/Library/LaunchAgents and enable using launchctl:
$ cp cdpop.plist /Library/LaunchAgents
$ launchctl load ~/Library/LaunchAgents/cdpop.plist
$ launchctl enable xxx/yyy/cdpop
$ launchctl kickstart -k xxx/yyy/cdpop
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
Built Distribution
File details
Details for the file cdpop-1.0.0.tar.gz
.
File metadata
- Download URL: cdpop-1.0.0.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4bade716310c8b6ea0b575f114308446741dfac3142941c38f212afa83812ea |
|
MD5 | 296abb57dd4193c39ff7e122c710f414 |
|
BLAKE2b-256 | 53749aae6297ac2b06a2e41b639ba3db64534df6429da5c71e456169ab4daafb |
File details
Details for the file cdpop-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: cdpop-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 459fa696d3ff7812c62f20d675c251abe782cba3b3ef1be4da9dd52329959c71 |
|
MD5 | ab7e51d9a97161c4118b0663578f51c6 |
|
BLAKE2b-256 | 9b73d0f11eb26d2357b506a649306a711e6d92433b99913f02b5ccf0916ae726 |