]> git.basschouten.com Git - openhab-addons.git/blob
684da2bf573cf789453df96446d963f796755cbe
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.dscalarm.internal;
14
15 import java.util.HashMap;
16 import java.util.Map;
17
18 /**
19  * Enumerator for DSCAlarm Command and Message Codes.
20  *
21  * @author Russell Stephens - Initial Contribution
22  */
23 public enum DSCAlarmCode {
24     // Command Codes
25     Poll("000", "Poll", "000: The poll command."),
26     StatusReport("001", "Status Report", "001: Request a status report command."),
27     LabelsRequest("002", "Labels Request", "002: IT-100 labels request command."),
28     NetworkLogin("005", "Network Login", "005: Envisalink login command."),
29     DumpZoneTimers("008", "Dump Zone Timers", "008: Dump the internal Envisalink Zone Timers command."),
30     SetTimeDate("010", "Set Time and Date", "010: Set the time and date command."),
31     CommandOutputControl("020", "Command Output Control", "020: Activate the selected Command Output command."),
32     PartitionArmControlAway("030", "Partition Arm Control - Away", "030: Arm the partition in AWAY mode."),
33     PartitionArmControlStay("031", "Partition Arm Control - Stay", "031: Arm the partition in STAY mode."),
34     PartitionArmControlZeroEntryDelay("032", "Partition Arm Control - Zero Entry Delay",
35             "032: Arm the partition with zero entry delay."),
36     PartitionArmControlWithUserCode("033", "Partition Arm Control - With User Code",
37             "033: Arm the partition with user code."),
38     PartitionDisarmControl("040", "Partition Disarm Control", "040: Disarm the partition with user code."),
39     TimeStampControl("055", "Time Stamp Control", "055: Prepend all messages with a timestamp."),
40     TimeDateBroadcastControl("056", "Time/Date Broadcast Control",
41             "056: Periodically transmit system time broadcasts."),
42     TemperatureBroadcastControl("057", "Temperature Broadcast Control",
43             "057: Periodically transmit the interior and exterior temperatures."),
44     VirtualKeypadControl("058", "Virtual Keypad Control", "058: Enable/Disable the virtual keypad command."),
45     TriggerPanicAlarm("060", "Trigger Panic Alarm",
46             "060: Emulates the FAP (Fire, Ambulance, Police) panic keys on a DSC keypad."),
47     KeyStroke("070", "Key Stroke", "070: Send a single keystroke on Partition 1 only."),
48     KeySequence("071", "Key Stroke Sequence", "071: Send a keystroke string."),
49     EnterUserCodeProgramming("072", "Enter User Code Programming",
50             "072: Cause the partition to enter user code (*5) programming."),
51     EnterUserProgramming("073", "Enter User Programming",
52             "073: Cause the partition to enter user code (*6) programming."),
53     KeepAlive("074", "Keep Alive", "074: Reset the time-out timer on the panel."),
54     BaudRateChange("080", "Baud Rate Change", "080: Change the baud rate on the IT-100."),
55     GetTemperatureSetPoint("095", "Get Temperature Set Points", "095: Request the thermostat temperature set points."),
56     TemperatureChange("096", "Temperature Change", "096: Change the thermostat temperature."),
57     SaveTemperatureSetting("097", "Save Temperature Setting", "097: Save the thermostat temperature."),
58     CodeSend("200", "Code Send", "200: Send a user code."),
59
60     // Message Codes
61     CommandAcknowledge("500", "Command Acknowledge", "500: A command has been received successfully."),
62     CommandError("501", "Command Error", "501: A command has been received with a bad checksum."),
63     SystemError("502", "System Error", "502: An error has been detected."),
64     LoginResponse("505", "Login Interaction",
65             "505: Login response (failed=0, success=1, time out=2, password request=3)."),
66     KeypadLEDState("510", "Keypad LED State - Partition 1 Only",
67             "510: A change of state in the Partition 1 keypad LEDs."),
68     KeypadLEDFlashState("511", "Keypad LED Flash State - Partition 1 Only",
69             "511: A change of state in the Partition 1 keypad LEDs as to whether to flash or not."),
70     TimeDateBroadcast("550", "Time-Date Broadcast", "550: The current security system time."),
71     RingDetected("560", "Ring Detected", "560: A ring on the telephone line."),
72     IndoorTemperatureBroadcast("561", "Indoor Temperature Broadcast",
73             "561: The interior temperature and the thermostat number."),
74     OutdoorTemperatureBroadcast("562", "Outdoor Temperature Broadcast",
75             "562: The exterior temperature and the thermostat number."),
76     ThermostatSetPoints("563", "Thermostat Set Points",
77             "563: Cooling and heating set points and the thermostat number."),
78     BroadcastLabels("570", "Broadcast Labels", "570: Labels stored in the DSC Alarm."),
79     BaudRateSet("580", "Baud Rate Set", "580: Baud Rate of the serial interface."),
80
81     ZoneAlarm("601", "Zone Alarm", "601: A zone has gone into alarm."),
82     ZoneAlarmRestore("602", "Zone Alarm Restore", "602: A zone alarm has been restored."),
83     ZoneTamper("603", "Zone Tamper", "603: A zone has a tamper condition."),
84     ZoneTamperRestore("604", "Zone Tamper Restored", "604: A zone tamper condition has been restored."),
85     ZoneFault("605", "Zone Fault", "605: A zone has a fault condition."),
86     ZoneFaultRestore("606", "Zone Fault Restored", "606: A zone fault condition has been restored."),
87     ZoneOpen("609", "Zone Open", "609: General status of the zone - open."),
88     ZoneRestored("610", "Zone Restored", "610: General status of the zone - restored."),
89     EnvisalinkZoneTimerDump("615", "Envisalink Zone Timer Dump",
90             "615: The raw zone timers used inside the Envisalink."),
91     DuressAlarm("620", "Duress Alarm", "620: A duress code has been entered on a system keypad."),
92     FireKeyAlarm("621", "Fire Key Alarm", "621: A Fire key alarm has been activated."),
93     FireKeyRestored("622", "Fire Key Alarm Restore", "622: A Fire key alarm has been restored."),
94     AuxiliaryKeyAlarm("623", "Auxiliary Key Alarm", "623: An Auxiliary key alarm has been activated."),
95     AuxiliaryKeyRestored("624", "Auxiliary Key Alarm Restore", "624: An Auxiliary key alarm has been restored."),
96     PanicKeyAlarm("625", "Panic Key Alarm", "625: A Panic key alarm has been activated."),
97     PanicKeyRestored("626", "Panic Key Alarm Restore", "626: A Panic key alarm has been restored."),
98     AuxiliaryInputAlarm("631", "2-Wire Smoke/Aux Alarm", "631: A 2-wire smoke/Auxiliary alarm has been activated."),
99     AuxiliaryInputAlarmRestored("632", "2-Wire Smoke/Aux Alarm Restore",
100             "632: A 2-wire smoke/Auxiliary alarm has been restored."),
101     PartitionReady("650", "Partition Ready", "650: Partition can now be armed."),
102     PartitionNotReady("651", "Partition Not Ready", "651: Partition can not be armed."),
103     PartitionArmed("652", "Partition Armed", "652: Partition has been armed."),
104     PartitionReadyForceArming("653", "Partition Ready - Force Arming Enabled",
105             "653: Partition can now be armed (Force Arming Enabled)."),
106     PartitionInAlarm("654", "Partition In Alarm", "654: A partition is in alarm."),
107     PartitionDisarmed("655", "Partition Disarmed", "655: A partition has been disarmed."),
108     ExitDelayInProgress("656", "Exit Delay in Progress", "656: A partition is in Exit Delay."),
109     EntryDelayInProgress("657", "Entry Delay in Progress", "657: A partition is in Entry Delay."),
110     KeypadLockout("658", "Keypad Lock-out", "658: A partition is in Keypad Lockout."),
111     PartitionFailedToArm("659", "Partition Failed to Arm", "659: An attempt to arm the partition has failed."),
112     PGMOutputInProgress("660", "PGM Output is in Progress", "660: *71, *72, *73, or *74 has been pressed."),
113     ChimeEnabled("663", "Chime Enabled", "663: The door chime feature has been enabled."),
114     ChimeDisabled("664", "Chime Disabled", "664: The door chime feature has been disabled."),
115     InvalidAccessCode("670", "Invalid Access Code", "670: An access code that was entered was invalid."),
116     FunctionNotAvailable("671", "Function Not Available", "671: A function that was selected is not available."),
117     FailureToArm("672", "Failure to Arm", "672: An attempt was made to arm the partition and it failed."),
118     PartitionBusy("673", "Partition is Busy", "673: The partition is busy."),
119     SystemArmingInProgress("674", "System Arming in Progress",
120             "674: This system is auto-arming and is in arm warning delay."),
121     SystemInInstallerMode("680", "System in Installers Mode", "680: The whole system is in installers mode."),
122
123     UserClosing("700", "User Closing", "700: A partition has been armed by a user."),
124     SpecialClosing("701", "Special Closing",
125             "701: A partition has been armed by one of the following methods: Quick Arm, Auto Arm, Keyswitch, DLS software, Wireless Key."),
126     PartialClosing("702", "Partial Closing",
127             "702: A partition has been armed but one or more zones have been bypassed."),
128     UserOpening("750", "User Opening", "750: A partition has been disarmed by a user."),
129     SpecialOpening("751", "Special Opening",
130             "751: A partition has been disarmed by one of the following methods: Quick Arm, Auto Arm, Keyswitch, DLS software, Wireless Key."),
131
132     PanelBatteryTrouble("800", "Panel Battery Trouble", "800: The panel has a low battery."),
133     PanelBatteryTroubleRestore("801", "Panel Battery Trouble Restore",
134             "801: The panel low battery trouble has been restored."),
135     PanelACTrouble("802", "Panel AC Trouble", "802: AC power to the panel has been removed."),
136     PanelACRestore("803", "Panel AC Restore", "803: AC power to the panel has been restored."),
137     SystemBellTrouble("806", "System Bell Trouble",
138             "806: An open circuit has been detected across the bell terminals."),
139     SystemBellTroubleRestore("807", "System Bell Trouble Restore", "807: The bell trouble has been restored."),
140     TLMLine1Trouble("810", "TML Line 1 Trouble", "810: The phone line is an open or shorted condition."),
141     TLMLine1TroubleRestore("811", "TML Line 1 Trouble Restore",
142             "811: The phone line trouble condition has been restored."),
143     TLMLine2Trouble("812", "TML Line 2 Trouble", "812: The phone line is an open or shorted condition."),
144     TLMLine2TroubleRestore("813", "TML Line 2 Trouble Restore",
145             "813: The phone line trouble condition has been restored."),
146     FTCTrouble("814", "FTC Trouble",
147             "814: The panel has failed to communicate successfully to the monitoring station."),
148     BufferNearFull("816", "Buffer Near Full",
149             "816: The panel event buffer is 75% full from when it was last uploaded to DLS."),
150     GeneralDeviceLowBattery("821", "General Device Low Battery", "821: A wireless zone has a low battery."),
151     GeneralDeviceLowBatteryRestore("822", "General Device Low Battery Restore",
152             "822: A wireless zone has a low battery."),
153     WirelessKeyLowBatteryTrouble("825", "Wireless Key Low Battery Trouble", "825: A wireless key has a low battery."),
154     WirelessKeyLowBatteryTroubleRestore("826", "Wireless Key Low Battery Trouble Restore",
155             "826: A wireless key low battery condition has been restored."),
156     HandheldKeypadLowBatteryTrouble("827", "Handheld Keypad Low Battery Trouble",
157             "827: A handhekd keypad has a low battery."),
158     HandheldKeypadLowBatteryTroubleRestore("828", "Handheld Keypad Low Battery Trouble Restore",
159             "828: A handhekd keypad low battery condition has been restored."),
160     GeneralSystemTamper("829", "General System Tamper", "829: A tamper has occurred with a system module."),
161     GeneralSystemTamperRestore("830", "General System Tamper Restore",
162             "830: A general system Tamper has been restored."),
163     HomeAutomationTrouble("831", "Home Automation Trouble", "831: Escort 5580 module trouble."),
164     HomeAutomationTroubleRestore("832", "Home Automation Trouble Restore",
165             "832: Escort 5580 module trouble has been restored."),
166     TroubleLEDOn("840", "Trouble LED ON", "840: The trouble LED on a keypad is ON."),
167     TroubleLEDOff("841", "Trouble LED OFF", "841: The trouble LED on a keypad is OFF."),
168     FireTroubleAlarm("842", "Fire Trouble Alarm", "842: Fire trouble alarm."),
169     FireTroubleAlarmRestore("843", "Fire Trouble Alarm Restore", "843: Fire trouble alarm restored."),
170     VerboseTroubleStatus("849", "Verbose Trouble Status",
171             "849: a trouble appears on the system and roughly every 5 minutes until the trouble is cleared."),
172     KeybusFault("896", "Keybus Fault", "896: Keybus fault condition."),
173     KeybusFaultRestore("897", "Keybus Fault Restore", "897: Keybus fault has been restored."),
174
175     CodeRequired("900", "Code Required", "900: Tells the API to enter an access code."),
176     LCDUpdate("901", "LCD Update", "901: Text of the IT-100 menu has changed."),
177     LCDCursor("902", "LCD Cursor", "902: Cursor position has changed."),
178     LEDStatus("903", "LED Status", "903: LED Status has changed."),
179     BeepStatus("904", "Beep Status", "904: Beep status sent."),
180     ToneStatus("905", "Tone Status", "905: Tone status sent."),
181     BuzzerStatus("906", "Buzzer Status", "906: Buzzer status sent."),
182     DoorChimeStatus("907", "Door Chime Status", "907: Door Chime status sent."),
183     SoftwareVersion("908", "Software Version", "908: Current software version."),
184     CommandOutputPressed("912", "Command Output Pressed", "912: Tells the API to enter an access code."),
185     MasterCodeRequired("921", "Master Code Required", "921: Tells the API to enter a master access code."),
186     InstallersCodeRequired("922", "Installers Code Required", "922: Tells the API to enter an installers access code."),
187
188     UnknownCode("-1", "Unknown Code", "Unknown code received.");
189
190     private String code;
191     private String name;
192     private String description;
193
194     /**
195      * Lookup map to get a DSCAlarmCode value from its string code.
196      */
197     private static Map<String, DSCAlarmCode> codeToDSCAlarmCodeValue;
198
199     /**
200      * Constructor
201      *
202      * @param code
203      */
204     private DSCAlarmCode(String code, String name, String description) {
205         this.code = code;
206         this.name = name;
207         this.description = description;
208     }
209
210     /**
211      * Initialize the lookup map that gets a DSCAlarmCode value from a string code.
212      */
213     private static void initMapping() {
214         codeToDSCAlarmCodeValue = new HashMap<>();
215         for (DSCAlarmCode s : values()) {
216             codeToDSCAlarmCodeValue.put(s.code, s);
217         }
218     }
219
220     /**
221      * The DSC Alarm command/message code string (example '005').
222      */
223     public String getCode() {
224         return code;
225     }
226
227     /**
228      * The DSC Alarm command/message name string (example 'Poll Command').
229      */
230     public String getName() {
231         return name;
232     }
233
234     /**
235      * The DSC Alarm command/message description string.
236      */
237     public String getDescription() {
238         return description;
239     }
240
241     /**
242      * Lookup function to return the DSCAlarmCode value based on the string code. Returns 'UnknownCode' if the string
243      * code is not found.
244      *
245      * @param code
246      * @return enum value
247      */
248     public static DSCAlarmCode getDSCAlarmCodeValue(String code) {
249         DSCAlarmCode dscAlarmCode;
250
251         if (codeToDSCAlarmCodeValue == null) {
252             initMapping();
253         }
254
255         dscAlarmCode = codeToDSCAlarmCodeValue.get(code);
256
257         if (dscAlarmCode == null) {
258             dscAlarmCode = UnknownCode;
259         }
260
261         return dscAlarmCode;
262     }
263 }