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.

KeyTypeNotes
output_nointOutput number to control.
control_codeintOutput control code.
timer_countintTime 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.

KeyTypeNotes
readerintReader number.
led_numberintLED number on that reader.
control_codeintLED control code.
on_countintOn duration.
off_countintOff duration.
on_colorCommandLEDColorColor while on.
off_colorCommandLEDColorColor while off.
temporaryboolTrue for a temporary command.
timer_countintRequired only when temporary is True.

Buzzer — Command.Buzzer

Control the reader buzzer.

KeyTypeNotes
readerintReader number.
control_codeintBuzzer control code.
on_countintOn duration.
off_countintOff duration.
rep_countintNumber of times to repeat the on/off cycle.

Text — Command.Text

Show text on the reader display.

KeyTypeNotes
readerintReader number.
control_codeintText command control code.
offset_rowintRow to start at.
offset_colintColumn to start at.
temp_timeintDuration for temporary text.
datastrThe text to display.

Keyset — Command.Keyset

Set the PD's Secure Channel Base Key. See Secure Channel.

KeyTypeNotes
typeintKey type.
databytesKey bytes (≤ 16).

Comset — Command.Comset

Change a PD's address and baud rate.

KeyTypeNotes
addressintNew PD address.
baud_rateintNew baud rate.

Manufacturer — Command.Manufacturer

Send a vendor-specific command.

KeyTypeNotes
vendor_codeintIEEE-assigned vendor code.
databytesVendor-defined payload.

File Transfer — Command.FileTransfer

Kick off or cancel a file transfer.

KeyTypeNotes
idintFile identifier.
flagsintBitmask; use CommandFileTxFlags.Cancel to abort.

Status — Command.Status

Request a status report from the PD.

KeyTypeNotes
typeStatusReportTypeWhich report to request.

Notification — Command.Notification

KeyTypeNotes
typeintNotification type.
arg0intType-specific argument.
arg1intType-specific argument.