SecurityKeypad¶
Overview¶
Security keypad for intrusion panel control, with display state reporting, function/mode keys, user-code administration, and panic buttons. Models the operator-facing keypad of an intrusion system — what it displays, the codes entered on it, and the emergency buttons pressed at it.
The keypad reflects panel/area state for display purposes (disarmed, armed, entry/exit delay) and raises events for code management and panic activations. Arming logic itself belongs to the Partition function; SecurityKeypad is the human interface to it.
- Added in: PQ Framework 2.1
- Namespace:
Pq.Adapters.Framework
When to Use¶
- Wall-mounted or door-side intrusion keypads with a display
- Keypads with dedicated fire / medical / police panic buttons
- Devices that report user-code creation, modification, lockout, and deletion
- Installer/master programming-mode entry and exit reporting
Do NOT use for:
- Area arming/disarming state machine (use
Partition) - Access-control card/PIN readers on doors (use
Reader)
States¶
| State | Status String | Description |
|---|---|---|
Disarmed |
pq.state.intrusion.disarmed |
Keypad shows ready/disarmed (default idle state) |
Armed |
pq.state.intrusion.armed |
Keypad shows armed indication |
EntryDelay |
pq.state.intrusion.entry |
Keypad shows entry delay countdown |
ExitDelay |
pq.state.intrusion.exit |
Keypad shows exit delay countdown |
Maintenance |
pq.state.lifecycle.maintenance |
Installer/master programming mode active |
Stopped |
pq.state.lifecycle.stopped |
Keypad disabled, no input accepted |
Panic |
pq.state.emergency.panic |
A panic button is active |
Actions¶
Panic Buttons¶
Panic(timestamp)
- Description: Generic panic button activated
- Target State:
Panic - Events:
pq.event.safety.panic
PanicFire(timestamp)
- Description: Fire panic button activated
- Target State:
Panic - Events:
pq.event.safety.panic.fire
PanicMedical(timestamp)
- Description: Medical panic button activated
- Target State:
Panic - Events:
pq.event.safety.panic.medical
PanicPolice(timestamp)
- Description: Police/holdup panic button activated
- Target State:
Panic - Events:
pq.event.safety.panic.police
PanicCleared(timestamp)
- Description: Panic condition cleared
- Target State:
Disarmed - Events:
pq.event.safety.panic.cleared
Display State¶
DisplayReady(timestamp)
- Description: Keypad shows ready state (all zones secure)
- Target State:
Disarmed - Events: None
DisplayArmed(timestamp)
- Description: Keypad shows armed indication
- Target State:
Armed - Events: None
DisplayEntryDelay(timestamp)
- Description: Keypad shows entry delay countdown
- Target State:
EntryDelay - Events: None
DisplayExitDelay(timestamp)
- Description: Keypad shows exit delay countdown
- Target State:
ExitDelay - Events: None
Programming and User Codes¶
ProgrammingEntered(timestamp)
- Description: Installer/master programming mode entered
- Target State:
Maintenance - Events:
pq.event.security.admin.entered
ProgrammingExited(timestamp)
- Description: Programming mode exited
- Target State:
Disarmed - Events:
pq.event.security.admin.exited
CodeCreated(timestamp)
- Description: New user code created
- Target State: — (no transition)
- Events:
pq.event.security.code.created
CodeModified(timestamp)
- Description: User code modified
- Target State: — (no transition)
- Events:
pq.event.security.code.modified
CodeDeleted(timestamp)
- Description: User code deleted
- Target State: — (no transition)
- Events:
pq.event.security.code.deleted
CodeLocked(timestamp)
- Description: User code locked after failed attempts
- Target State: — (no transition)
- Events:
pq.event.security.code.locked
CodeUnlocked(timestamp)
- Description: User code unlocked
- Target State: — (no transition)
- Events:
pq.event.security.code.unlocked
InvalidPin(timestamp)
- Description: Invalid PIN entered on keypad
- Target State: — (no transition)
- Events:
pq.event.access.denied.pin
Mode and Input¶
ChimeModeEnabled(timestamp)
- Description: Chime mode enabled (beep on zone activity)
- Target State: — (no transition)
- Events: None
SilentModeEnabled(timestamp)
- Description: Silent mode enabled (no audible feedback)
- Target State: — (no transition)
- Events: None
KeypadDisabled(timestamp)
- Description: Keypad disabled (no input accepted)
- Target State:
Stopped - Events:
pq.event.system.device.disabled
KeypadEnabled(timestamp)
- Description: Keypad enabled (normal operation)
- Target State:
Disarmed - Events:
pq.event.system.device.enabled
UserCommandEntered(timestamp)
- Description: User command code entered at keypad
- Target State: — (no transition)
- Events:
pq.event.security.keypad.command
Properties¶
None — adapter-specific. Define keypad options (e.g., display backlight timeout, panic button mapping) as properties in adapter-registration.yaml if your device exposes them.
YAML Example¶
device_types:
- type_id: AreaKeypad
name: "Intrusion Keypad"
functions:
ConnectionBase:
SecurityKeypad:
properties:
has_fire_panic:
type: "bool"
default: true
description: "Keypad exposes a fire panic button"
has_medical_panic:
type: "bool"
default: false
description: "Keypad exposes a medical panic button"
Code Usage¶
public class AreaKeypadThing : Thing
{
public SecurityKeypadFunction Keypad { get; }
protected override async Task HandleDeviceEvent(KeypadEvent evt, CancellationToken ct)
{
switch (evt.Type)
{
// mirror panel display so operators see live state
case KeypadEventType.ArmedDisplay:
await Keypad.DisplayArmed(evt.Timestamp);
break;
case KeypadEventType.ExitCountdown:
await Keypad.DisplayExitDelay(evt.Timestamp);
break;
// emergency button
case KeypadEventType.FirePanic:
await Keypad.PanicFire(evt.Timestamp);
break;
// code administration
case KeypadEventType.UserCodeAdded:
await Keypad.CodeCreated(evt.Timestamp);
break;
case KeypadEventType.BadPin:
await Keypad.InvalidPin(evt.Timestamp);
break;
}
}
}
Notes¶
- Display vs Arming:
Display*actions only reflect what the keypad shows. The authoritative arming state machine lives in thePartitionfunction — keep the two in sync but do not duplicate arming logic here. - No-Transition Actions: Code administration (
Code*),InvalidPin,ChimeModeEnabled,SilentModeEnabled, andUserCommandEnteredraise events without changing the keypad state. - Panic Recovery: Any
Panic*action enters thePanicstate; onlyPanicCleared()returns the keypad toDisarmed. - Disable/Enable:
KeypadDisabled()moves toStopped;KeypadEnabled()returns toDisarmed. - Silent Alarm: Panic events are safety-critical — treat them as high priority regardless of current display state.