Documentation
Python Commands
Commands flow from a CP to a PD. In Python a command is a plain dict. Every command dict carries a command key set to a Command value; the remaining keys depend on that command. Send one with ControlPanel.send_command(address, cmd).
from osdp import Command, CommandLEDColor
cp.send_command(101, {
'command': Command.LED,
'reader': 1,
'led_number': 0,
'control_code': 1,
'on_count': 10,
'off_count': 10,
'on_color': CommandLEDColor.Red,
'off_color': CommandLEDColor.Black,
'temporary': False,
})
The keys below are the exact fields the binding marshals into the C structures; their semantics match the C Command Structure and the protocol's Commands and Replies.
Output — Command.Output
Control an output line.
| Key | Type | Notes |
|---|---|---|
output_no | int | Output number to control. |
control_code | int | Output control code. |
timer_count | int | Time in units defined by the control code. |
LED — Command.LED
Control a reader LED. When temporary is True, the settings apply for timer_count units and then revert.
| Key | Type | Notes |
|---|---|---|
reader | int | Reader number. |
led_number | int | LED number on that reader. |
control_code | int | LED control code. |
on_count | int | On duration. |
off_count | int | Off duration. |
on_color | CommandLEDColor | Color while on. |
off_color | CommandLEDColor | Color while off. |
temporary | bool | True for a temporary command. |
timer_count | int | Required only when temporary is True. |
Buzzer — Command.Buzzer
Control the reader buzzer.
| Key | Type | Notes |
|---|---|---|
reader | int | Reader number. |
control_code | int | Buzzer control code. |
on_count | int | On duration. |
off_count | int | Off duration. |
rep_count | int | Number of times to repeat the on/off cycle. |
Text — Command.Text
Show text on the reader display.
| Key | Type | Notes |
|---|---|---|
reader | int | Reader number. |
control_code | int | Text command control code. |
offset_row | int | Row to start at. |
offset_col | int | Column to start at. |
temp_time | int | Duration for temporary text. |
data | str | The text to display. |
Keyset — Command.Keyset
Set the PD's Secure Channel Base Key. See Secure Channel.
| Key | Type | Notes |
|---|---|---|
type | int | Key type. |
data | bytes | Key bytes (≤ 16). |
Comset — Command.Comset
Change a PD's address and baud rate.
| Key | Type | Notes |
|---|---|---|
address | int | New PD address. |
baud_rate | int | New baud rate. |
Manufacturer — Command.Manufacturer
Send a vendor-specific command.
| Key | Type | Notes |
|---|---|---|
vendor_code | int | IEEE-assigned vendor code. |
data | bytes | Vendor-defined payload. |
File Transfer — Command.FileTransfer
Kick off or cancel a file transfer.
| Key | Type | Notes |
|---|---|---|
id | int | File identifier. |
flags | int | Bitmask; use CommandFileTxFlags.Cancel to abort. |
Status — Command.Status
Request a status report from the PD.
| Key | Type | Notes |
|---|---|---|
type | StatusReportType | Which report to request. |
Notification — Command.Notification
| Key | Type | Notes |
|---|---|---|
type | int | Notification type. |
arg0 | int | Type-specific argument. |
arg1 | int | Type-specific argument. |