| panel_primary_keypad_function_without_pin | Switch | Configuration | Primary Keypad Function without PIN |
| panel_secondary_keypad_function | Switch | Configuration | Secondary Keypad Function |
| panel_zone_bypass_toggle | Switch | Configuration | Zone Bypass Toggle |
+| panel_ac_fail | Switch | Configuration | AC fail |
+| panel_ac_power_on | Switch | Configuration | AC Power on |
+| panel_low_battery_memory | Switch | Configuration | Low Battery Memory |
| partition_bypass_code_required | Switch | Partition Condition | Bypass code required |
| partition_fire_trouble | Switch | Partition Condition | Fire trouble |
| partition_fire | Switch | Partition Condition | Fire |
@SuppressWarnings("null")
private void messageDispatchLoop() {
- int @Nullable [] expectedMessageNumbers = null;
-
- @Nullable
+ int[] expectedMessageNumbers = null;
CaddxMessage outgoingMessage = null;
boolean skipTransmit = true;
+ CaddxMessageContext context = null;
try {
// loop until the thread is interrupted, sending out messages
while (!Thread.currentThread().isInterrupted()) {
// Initialize the state
outgoingMessage = null;
+ context = null;
expectedMessageNumbers = null;
if (!skipTransmit) {
out.flush();
expectedMessageNumbers = outgoingMessage.getReplyMessageNumbers();
+ context = outgoingMessage.getContext();
// Log message
if (logger.isDebugEnabled()) {
if (incomingMessage.hasAcknowledgementFlag()) {
if (incomingMessage.isChecksumCorrect()) {
// send ACK
- transmitFirst(new CaddxMessage(CaddxMessageType.POSITIVE_ACKNOWLEDGE, ""));
+ transmitFirst(new CaddxMessage(CaddxMessageContext.NONE,
+ CaddxMessageType.POSITIVE_ACKNOWLEDGE, ""));
} else {
// Send NAK
- transmitFirst(new CaddxMessage(CaddxMessageType.NEGATIVE_ACKNOWLEDGE, ""));
+ transmitFirst(new CaddxMessage(CaddxMessageContext.NONE,
+ CaddxMessageType.NEGATIVE_ACKNOWLEDGE, ""));
}
}
}
if (incomingMessage != null) {
if (incomingMessage.isChecksumCorrect()) {
for (CaddxPanelListener listener : listenerQueue) {
- listener.caddxMessage(this, incomingMessage);
+ if (context != null) {
+ incomingMessage.setContext(context);
+ }
+ listener.caddxMessage(incomingMessage);
}
} else {
logger.warn(
logger.trace("Offering received message");
// Full message received in data byte array
- CaddxMessage caddxMessage = new CaddxMessage(message, true);
+ CaddxMessage caddxMessage = new CaddxMessage(CaddxMessageContext.NONE, message, true);
if (!exchanger.offer(caddxMessage, 3, TimeUnit.SECONDS)) {
logger.debug("Offered message was not received");
}
public @Nullable Integer getKeypad() {
return keypad;
}
+
+ /**
+ * Returns a string representation of a CaddxEvent.
+ *
+ */
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+
+ sb.append(String.format("partition: %d, zone: %d, keypad: %d\r\n", partition, zone, keypad));
+ sb.append(caddxMessage.toString());
+
+ return sb.toString();
+ }
}
private final byte checksum2In;
private final byte checksum1Calc;
private final byte checksum2Calc;
+ private CaddxMessageContext context;
- public CaddxMessage(byte[] message, boolean withChecksum) {
+ public CaddxMessage(CaddxMessageContext context, byte[] message, boolean withChecksum) {
if (withChecksum && message.length < 3) {
logger.debug("CaddxMessage: The message should be at least 3 bytes long.");
throw new IllegalArgumentException("The message should be at least 3 bytes long");
}
// Received data
+ this.context = context;
byte[] msg = message;
// Fill in the checksum
processCaddxMessage();
}
- public CaddxMessage(CaddxMessageType type, String data) {
+ public CaddxMessage(CaddxMessageContext context, CaddxMessageType type, String data) {
int length = type.length;
String[] tokens = data.split("\\,");
if (length != 1 && tokens.length != length - 1) {
throw new IllegalArgumentException("CaddxMessage: data has not the correct format.");
}
+ this.context = context;
byte[] msg = new byte[length];
msg[0] = (byte) type.number;
for (int i = 0; i < length - 1; i++) {
processCaddxMessage();
}
+ public CaddxMessageContext getContext() {
+ return context;
+ }
+
+ public void setContext(CaddxMessageContext context) {
+ this.context = context;
+ }
+
public byte getChecksum1In() {
return checksum1In;
}
return "Unknown message type";
}
+ sb.append(String.format("Context: %s", context.toString()));
+ sb.append(System.lineSeparator());
+
sb.append("Message: ");
sb.append(String.format("%2s", Integer.toHexString(message[0])));
sb.append(" ");
--- /dev/null
+/**
+ * Copyright (c) 2010-2021 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.caddx.internal;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+
+/**
+ * Used to map thing types from the binding string to a ENUM value.
+ *
+ * @author Georgios Moutsos - Initial contribution
+ */
+@NonNullByDefault
+public enum CaddxMessageContext {
+ NONE,
+ DISCOVERY,
+ COMMAND;
+}
false),
// Byte 3 Zone 1 & 2 (+offset) status flags
- new CaddxProperty("", 3, 1, 0, 1, CaddxPropertyType.BIT, "Zone 1 faulted (or delayed trip)", false),
- new CaddxProperty("", 3, 1, 1, 1, CaddxPropertyType.BIT, "Zone 1 bypass (or inhibited)", false),
+ new CaddxProperty("zone_1_faulted", 3, 1, 0, 1, CaddxPropertyType.BIT, "Zone 1 faulted (or delayed trip)",
+ false),
+ new CaddxProperty("zone_1_bypassed", 3, 1, 1, 1, CaddxPropertyType.BIT, "Zone 1 bypass (or inhibited)",
+ false),
new CaddxProperty("zone_1_trouble", 3, 1, 2, 1, CaddxPropertyType.BIT,
"Zone 1 trouble (tamper, low battery, or lost)", false),
- new CaddxProperty("", 3, 1, 3, 1, CaddxPropertyType.BIT, "Zone 1 alarm memory", false),
- new CaddxProperty("", 3, 1, 4, 1, CaddxPropertyType.BIT, "Zone 2 faulted (or delayed trip)", false),
- new CaddxProperty("", 3, 1, 5, 1, CaddxPropertyType.BIT, "Zone 2 bypass (or inhibited)", false),
+ new CaddxProperty("zone_1_alarm_memory", 3, 1, 3, 1, CaddxPropertyType.BIT, "Zone 1 alarm memory", false),
+ new CaddxProperty("zone_2_faulted", 3, 1, 4, 1, CaddxPropertyType.BIT, "Zone 2 faulted (or delayed trip)",
+ false),
+ new CaddxProperty("zone_2_bypassed", 3, 1, 5, 1, CaddxPropertyType.BIT, "Zone 2 bypass (or inhibited)",
+ false),
new CaddxProperty("zone_2_trouble", 3, 1, 6, 1, CaddxPropertyType.BIT,
"Zone 2 trouble (tamper, low battery, or lost)", false),
- new CaddxProperty("", 3, 1, 7, 1, CaddxPropertyType.BIT, "Zone 2 alarm memory", false),
+ new CaddxProperty("zone_2_alarm_memory", 3, 1, 7, 1, CaddxPropertyType.BIT, "Zone 2 alarm memory", false),
// Byte 4 Zone 3 & 4 status flags (see byte 3)
- new CaddxProperty("", 4, 1, 0, 1, CaddxPropertyType.BIT, "Zone 3 faulted (or delayed trip)", false),
- new CaddxProperty("", 4, 1, 1, 1, CaddxPropertyType.BIT, "Zone 3 bypass (or inhibited)", false),
+ new CaddxProperty("zone_3_faulted", 4, 1, 0, 1, CaddxPropertyType.BIT, "Zone 3 faulted (or delayed trip)",
+ false),
+ new CaddxProperty("zone_3_bypassed", 4, 1, 1, 1, CaddxPropertyType.BIT, "Zone 3 bypass (or inhibited)",
+ false),
new CaddxProperty("zone_3_trouble", 4, 1, 2, 1, CaddxPropertyType.BIT,
"Zone 3 trouble (tamper, low battery, or lost)", false),
- new CaddxProperty("", 4, 1, 3, 1, CaddxPropertyType.BIT, "Zone 3 alarm memory", false),
- new CaddxProperty("", 4, 1, 4, 1, CaddxPropertyType.BIT, "Zone 4 faulted (or delayed trip)", false),
- new CaddxProperty("", 4, 1, 5, 1, CaddxPropertyType.BIT, "Zone 4 bypass (or inhibited)", false),
+ new CaddxProperty("zone_3_alarm_memory", 4, 1, 3, 1, CaddxPropertyType.BIT, "Zone 3 alarm memory", false),
+ new CaddxProperty("zone_4_faulted", 4, 1, 4, 1, CaddxPropertyType.BIT, "Zone 4 faulted (or delayed trip)",
+ false),
+ new CaddxProperty("zone_4_bypassed", 4, 1, 5, 1, CaddxPropertyType.BIT, "Zone 4 bypass (or inhibited)",
+ false),
new CaddxProperty("zone_4_trouble", 4, 1, 6, 1, CaddxPropertyType.BIT,
"Zone 4 trouble (tamper, low battery, or lost)", false),
- new CaddxProperty("", 4, 1, 7, 1, CaddxPropertyType.BIT, "Zone 4 alarm memory", false),
+ new CaddxProperty("zone_4_alarm_memory", 4, 1, 7, 1, CaddxPropertyType.BIT, "Zone 4 alarm memory", false),
// Byte 5 Zone 5 & 6 status flags (see byte 3)
- new CaddxProperty("", 5, 1, 0, 1, CaddxPropertyType.BIT, "Zone 5 faulted (or delayed trip)", false),
- new CaddxProperty("", 5, 1, 1, 1, CaddxPropertyType.BIT, "Zone 5 bypass (or inhibited)", false),
+ new CaddxProperty("zone_5_faulted", 5, 1, 0, 1, CaddxPropertyType.BIT, "Zone 5 faulted (or delayed trip)",
+ false),
+ new CaddxProperty("zone_5_bypassed", 5, 1, 1, 1, CaddxPropertyType.BIT, "Zone 5 bypass (or inhibited)",
+ false),
new CaddxProperty("zone_5_trouble", 5, 1, 2, 1, CaddxPropertyType.BIT,
"Zone 5 trouble (tamper, low battery, or lost)", false),
- new CaddxProperty("", 5, 1, 3, 1, CaddxPropertyType.BIT, "Zone 5 alarm memory", false),
- new CaddxProperty("", 5, 1, 4, 1, CaddxPropertyType.BIT, "Zone 6 faulted (or delayed trip)", false),
- new CaddxProperty("", 5, 1, 5, 1, CaddxPropertyType.BIT, "Zone 6 bypass (or inhibited)", false),
+ new CaddxProperty("zone_5_alarm_memory", 5, 1, 3, 1, CaddxPropertyType.BIT, "Zone 5 alarm memory", false),
+ new CaddxProperty("zone_6_faulted", 5, 1, 4, 1, CaddxPropertyType.BIT, "Zone 6 faulted (or delayed trip)",
+ false),
+ new CaddxProperty("zone_6_bypassed", 5, 1, 5, 1, CaddxPropertyType.BIT, "Zone 6 bypass (or inhibited)",
+ false),
new CaddxProperty("zone_6_trouble", 5, 1, 6, 1, CaddxPropertyType.BIT,
"Zone 6 trouble (tamper, low battery, or lost)", false),
- new CaddxProperty("", 5, 1, 7, 1, CaddxPropertyType.BIT, "Zone 6 alarm memory", false),
+ new CaddxProperty("zone_6_alarm_memory", 5, 1, 7, 1, CaddxPropertyType.BIT, "Zone 6 alarm memory", false),
// Byte 6 Zone 7 & 8 status flags (see byte 3)
- new CaddxProperty("", 6, 1, 0, 1, CaddxPropertyType.BIT, "Zone 7 faulted (or delayed trip)", false),
- new CaddxProperty("", 6, 1, 1, 1, CaddxPropertyType.BIT, "Zone 7 bypass (or inhibited)", false),
+ new CaddxProperty("zone_7_faulted", 6, 1, 0, 1, CaddxPropertyType.BIT, "Zone 7 faulted (or delayed trip)",
+ false),
+ new CaddxProperty("zone_7_bypassed", 6, 1, 1, 1, CaddxPropertyType.BIT, "Zone 7 bypass (or inhibited)",
+ false),
new CaddxProperty("zone_7_trouble", 6, 1, 2, 1, CaddxPropertyType.BIT,
"Zone 7 trouble (tamper, low battery, or lost)", false),
- new CaddxProperty("", 6, 1, 3, 1, CaddxPropertyType.BIT, "Zone 7 alarm memory", false),
- new CaddxProperty("", 6, 1, 4, 1, CaddxPropertyType.BIT, "Zone 8 faulted (or delayed trip)", false),
- new CaddxProperty("", 6, 1, 5, 1, CaddxPropertyType.BIT, "Zone 8 bypass (or inhibited)", false),
+ new CaddxProperty("zone_7_alarm_memory", 6, 1, 3, 1, CaddxPropertyType.BIT, "Zone 7 alarm memory", false),
+ new CaddxProperty("zone_8_faulted", 6, 1, 4, 1, CaddxPropertyType.BIT, "Zone 8 faulted (or delayed trip)",
+ false),
+ new CaddxProperty("zone_8_bypassed", 6, 1, 5, 1, CaddxPropertyType.BIT, "Zone 8 bypass (or inhibited)",
+ false),
new CaddxProperty("zone_8_trouble", 6, 1, 6, 1, CaddxPropertyType.BIT,
"Zone 8 trouble (tamper, low battery, or lost)", false),
- new CaddxProperty("", 6, 1, 7, 1, CaddxPropertyType.BIT, "Zone 8 alarm memory", false),
+ new CaddxProperty("zone_8_alarm_memory", 6, 1, 7, 1, CaddxPropertyType.BIT, "Zone 8 alarm memory", false),
// Byte 7 Zone 9 & 10 status flags (see byte 3)
- new CaddxProperty("", 7, 1, 0, 1, CaddxPropertyType.BIT, "Zone 9 faulted (or delayed trip)", false),
- new CaddxProperty("", 7, 1, 1, 1, CaddxPropertyType.BIT, "Zone 9 bypass (or inhibited)", false),
+ new CaddxProperty("zone_9_faulted", 7, 1, 0, 1, CaddxPropertyType.BIT, "Zone 9 faulted (or delayed trip)",
+ false),
+ new CaddxProperty("zone_9_bypassed", 7, 1, 1, 1, CaddxPropertyType.BIT, "Zone 9 bypass (or inhibited)",
+ false),
new CaddxProperty("zone_9_trouble", 7, 1, 2, 1, CaddxPropertyType.BIT,
"Zone 9 trouble (tamper, low battery, or lost)", false),
- new CaddxProperty("", 7, 1, 3, 1, CaddxPropertyType.BIT, "Zone 9 alarm memory", false),
- new CaddxProperty("", 7, 1, 4, 1, CaddxPropertyType.BIT, "Zone 10 faulted (or delayed trip)", false),
- new CaddxProperty("", 7, 1, 5, 1, CaddxPropertyType.BIT, "Zone 10 bypass (or inhibited)", false),
+ new CaddxProperty("zone_9_alarm_memory", 7, 1, 3, 1, CaddxPropertyType.BIT, "Zone 9 alarm memory", false),
+ new CaddxProperty("zone_10_faulted", 7, 1, 4, 1, CaddxPropertyType.BIT, "Zone 10 faulted (or delayed trip)",
+ false),
+ new CaddxProperty("zone_10_bypassed", 7, 1, 5, 1, CaddxPropertyType.BIT, "Zone 10 bypass (or inhibited)",
+ false),
new CaddxProperty("zone_10_trouble", 7, 1, 6, 1, CaddxPropertyType.BIT,
"Zone 10 trouble (tamper, low battery, or lost)", false),
- new CaddxProperty("", 7, 1, 7, 1, CaddxPropertyType.BIT, "Zone 10 alarm memory", false),
+ new CaddxProperty("zone_10_alarm_memory", 7, 1, 7, 1, CaddxPropertyType.BIT, "Zone 10 alarm memory", false),
// Byte 8 Zone 11 & 12 status flags (see byte 3)
- new CaddxProperty("", 8, 1, 0, 1, CaddxPropertyType.BIT, "Zone 11 faulted (or delayed trip)", false),
- new CaddxProperty("", 8, 1, 1, 1, CaddxPropertyType.BIT, "Zone 11 bypass (or inhibited)", false),
+ new CaddxProperty("zone_11_faulted", 8, 1, 0, 1, CaddxPropertyType.BIT, "Zone 11 faulted (or delayed trip)",
+ false),
+ new CaddxProperty("zone_11_bypassed", 8, 1, 1, 1, CaddxPropertyType.BIT, "Zone 11 bypass (or inhibited)",
+ false),
new CaddxProperty("zone_11_trouble", 8, 1, 2, 1, CaddxPropertyType.BIT,
"Zone 11 trouble (tamper, low battery, or lost)", false),
- new CaddxProperty("", 8, 1, 3, 1, CaddxPropertyType.BIT, "Zone 11 alarm memory", false),
- new CaddxProperty("", 8, 1, 4, 1, CaddxPropertyType.BIT, "Zone 12 faulted (or delayed trip)", false),
- new CaddxProperty("", 8, 1, 5, 1, CaddxPropertyType.BIT, "Zone 12 bypass (or inhibited)", false),
+ new CaddxProperty("zone_11_alarm_memory", 8, 1, 3, 1, CaddxPropertyType.BIT, "Zone 11 alarm memory", false),
+ new CaddxProperty("zone_12_faulted", 8, 1, 4, 1, CaddxPropertyType.BIT, "Zone 12 faulted (or delayed trip)",
+ false),
+ new CaddxProperty("zone_12_bypassed", 8, 1, 5, 1, CaddxPropertyType.BIT, "Zone 12 bypass (or inhibited)",
+ false),
new CaddxProperty("zone_12_trouble", 8, 1, 6, 1, CaddxPropertyType.BIT,
"Zone 12 trouble (tamper, low battery, or lost)", false),
- new CaddxProperty("", 8, 1, 7, 1, CaddxPropertyType.BIT, "Zone 12 alarm memory", false),
+ new CaddxProperty("zone_12_alarm_memory", 8, 1, 7, 1, CaddxPropertyType.BIT, "Zone 12 alarm memory", false),
// Byte 9 Zone 13 & 14 status flags (see byte 3)
- new CaddxProperty("", 9, 1, 0, 1, CaddxPropertyType.BIT, "Zone 13 faulted (or delayed trip)", false),
- new CaddxProperty("", 9, 1, 1, 1, CaddxPropertyType.BIT, "Zone 13 bypass (or inhibited)", false),
+ new CaddxProperty("zone_13_faulted", 9, 1, 0, 1, CaddxPropertyType.BIT, "Zone 13 faulted (or delayed trip)",
+ false),
+ new CaddxProperty("zone_13_bypassed", 9, 1, 1, 1, CaddxPropertyType.BIT, "Zone 13 bypass (or inhibited)",
+ false),
new CaddxProperty("zone_13_trouble", 9, 1, 2, 1, CaddxPropertyType.BIT,
"Zone 13 trouble (tamper, low battery, or lost)", false),
- new CaddxProperty("", 9, 1, 3, 1, CaddxPropertyType.BIT, "Zone 13 alarm memory", false),
- new CaddxProperty("", 9, 1, 4, 1, CaddxPropertyType.BIT, "Zone 14 faulted (or delayed trip)", false),
- new CaddxProperty("", 9, 1, 5, 1, CaddxPropertyType.BIT, "Zone 14 bypass (or inhibited)", false),
+ new CaddxProperty("zone_13_alarm_memory", 9, 1, 3, 1, CaddxPropertyType.BIT, "Zone 13 alarm memory", false),
+ new CaddxProperty("zone_14_faulted", 9, 1, 4, 1, CaddxPropertyType.BIT, "Zone 14 faulted (or delayed trip)",
+ false),
+ new CaddxProperty("zone_14_bypassed", 9, 1, 5, 1, CaddxPropertyType.BIT, "Zone 14 bypass (or inhibited)",
+ false),
new CaddxProperty("zone_14_trouble", 9, 1, 6, 1, CaddxPropertyType.BIT,
"Zone 14 trouble (tamper, low battery, or lost)", false),
- new CaddxProperty("", 9, 1, 7, 1, CaddxPropertyType.BIT, "Zone 14 alarm memory", false),
+ new CaddxProperty("zone_14_alarm_memory", 9, 1, 7, 1, CaddxPropertyType.BIT, "Zone 14 alarm memory", false),
// Byte 10 Zone 15 & 16 status flags (see byte 3)
- new CaddxProperty("", 10, 1, 0, 1, CaddxPropertyType.BIT, "Zone 15 faulted (or delayed trip)", false),
- new CaddxProperty("", 10, 1, 1, 1, CaddxPropertyType.BIT, "Zone 15 bypass (or inhibited)", false),
+ new CaddxProperty("zone_15_faulted", 10, 1, 0, 1, CaddxPropertyType.BIT,
+ "Zone 15 faulted (or delayed trip)", false),
+ new CaddxProperty("zone_15_bypassed", 10, 1, 1, 1, CaddxPropertyType.BIT, "Zone 15 bypass (or inhibited)",
+ false),
new CaddxProperty("zone_15_trouble", 10, 1, 2, 1, CaddxPropertyType.BIT,
"Zone 15 trouble (tamper, low battery, or lost)", false),
- new CaddxProperty("", 10, 1, 3, 1, CaddxPropertyType.BIT, "Zone 15 alarm memory", false),
- new CaddxProperty("", 10, 1, 4, 1, CaddxPropertyType.BIT, "Zone 16 faulted (or delayed trip)", false),
- new CaddxProperty("", 10, 1, 5, 1, CaddxPropertyType.BIT, "Zone 16 bypass (or inhibited)", false),
+ new CaddxProperty("zone_15_alarm_memory", 10, 1, 3, 1, CaddxPropertyType.BIT, "Zone 15 alarm memory",
+ false),
+ new CaddxProperty("zone_16_faulted", 10, 1, 4, 1, CaddxPropertyType.BIT,
+ "Zone 16 faulted (or delayed trip)", false),
+ new CaddxProperty("zone_16_bypassed", 10, 1, 5, 1, CaddxPropertyType.BIT, "Zone 16 bypass (or inhibited)",
+ false),
new CaddxProperty("zone_16_trouble", 10, 1, 6, 1, CaddxPropertyType.BIT,
"Zone 16 trouble (tamper, low battery, or lost)", false),
- new CaddxProperty("", 10, 1, 7, 1, CaddxPropertyType.BIT, "Zone 16 alarm memory", false)),
+ new CaddxProperty("zone_16_alarm_memory", 10, 1, 7, 1, CaddxPropertyType.BIT, "Zone 16 alarm memory",
+ false)),
PARTITION_STATUS_MESSAGE(0x06, null, 9, "Partition Status Message",
"This message will contain all information relevant to a single partition in the system.",
new CaddxProperty("", 4, 1, 4, 1, CaddxPropertyType.BIT, "Box tamper", false),
new CaddxProperty("", 4, 1, 5, 1, CaddxPropertyType.BIT, "Siren tamper / trouble", false),
new CaddxProperty("", 4, 1, 6, 1, CaddxPropertyType.BIT, "Low Battery", false),
- new CaddxProperty("", 4, 1, 7, 1, CaddxPropertyType.BIT, "AC fail", false),
+ new CaddxProperty("panel_ac_fail", 4, 1, 7, 1, CaddxPropertyType.BIT, "AC fail", false),
// Byte 5
new CaddxProperty("", 5, 1, 0, 1, CaddxPropertyType.BIT, "Expander box tamper", false),
// Byte 7
new CaddxProperty("", 7, 1, 0, 1, CaddxPropertyType.BIT, "Dynamic battery test", false),
- new CaddxProperty("", 7, 1, 1, 1, CaddxPropertyType.BIT, "AC power on", false),
- new CaddxProperty("", 7, 1, 2, 1, CaddxPropertyType.BIT, "Low battery memory", false),
+ new CaddxProperty("panel_ac_power_on", 7, 1, 1, 1, CaddxPropertyType.BIT, "AC power on", false),
+ new CaddxProperty("panel_low_battery_memory", 7, 1, 2, 1, CaddxPropertyType.BIT, "Low battery memory",
+ false),
new CaddxProperty("", 7, 1, 3, 1, CaddxPropertyType.BIT, "Ground fault memory", false),
new CaddxProperty("", 7, 1, 4, 1, CaddxPropertyType.BIT, "Fire alarm verification being timed", false),
new CaddxProperty("", 7, 1, 5, 1, CaddxPropertyType.BIT, "Smoke power reset", false),
*/
@NonNullByDefault
public interface CaddxPanelListener {
- public void caddxMessage(CaddxCommunicator communicator, CaddxMessage message);
+ public void caddxMessage(CaddxMessage message);
}
public static final String SERIAL_PORT = "serialPort";
public static final String BAUD = "baud";
public static final String MAX_ZONE_NUMBER = "maxZoneNumber";
+ public static final String IGNORE_ZONE_STATUS_TRANSITIONS = "ignoreZoneStatusTransitions";
private CaddxProtocol protocol = CaddxProtocol.Binary;
private @Nullable String serialPort;
private int baudrate = 9600;
private int maxZoneNumber = 16;
+ private boolean ignoreZoneStatusTransitions = false;
public CaddxProtocol getProtocol() {
return protocol;
public int getMaxZoneNumber() {
return maxZoneNumber;
}
+
+ public boolean isIgnoreZoneStatusTransitions() {
+ return ignoreZoneStatusTransitions;
+ }
}
*/
private int partitionNumber;
- /**
- * The User Number of the user that will execute commands against the partition.
- */
- private int userNumber;
-
public int getPartitionNumber() {
return partitionNumber;
}
-
- public int getUserNumber() {
- return userNumber;
- }
}
/** Partition */
private int partitionNumber;
- private int userNumber;
/** Zone */
private int zoneNumber;
case PARTITION:
CaddxPartitionConfiguration partitionConfiguration = getConfigAs(CaddxPartitionConfiguration.class);
setPartitionNumber(partitionConfiguration.getPartitionNumber());
- setUserNumber(partitionConfiguration.getUserNumber());
break;
case ZONE:
CaddxZoneConfiguration zoneConfiguration = getConfigAs(CaddxZoneConfiguration.class);
case KEYPAD:
CaddxKeypadConfiguration keypadConfiguration = getConfigAs(CaddxKeypadConfiguration.class);
setKeypadAddress(keypadConfiguration.getKeypadAddress());
+ setTerminalModeSeconds(keypadConfiguration.getTerminalModeSeconds());
default:
break;
}
this.partitionNumber = partitionNumber;
}
- /**
- * Get User Number.
- *
- * @return userNumber
- */
- public int getUserNumber() {
- return userNumber;
- }
-
- /**
- * Set User Number.
- *
- * @param userNumber
- */
- public void setUserNumber(int userNumber) {
- this.userNumber = userNumber;
- }
-
/**
* Get Zone Number.
*
/**
* Get Keypad Terminal Mode Seconds.
*
- * @return keypadAddress
+ * @return terminalModeSeconds
*/
public int getTerminalModeSeconds() {
return terminalModeSeconds;
}
/**
- * Set Keypad Address.
+ * Set Keypad Terminal Mode Seconds.
*
- * @param keypadAddress
+ * @param terminalModeSeconds
*/
public void setTerminalModeSeconds(int terminalModeSeconds) {
this.terminalModeSeconds = terminalModeSeconds;
import org.openhab.binding.caddx.internal.CaddxCommunicator;
import org.openhab.binding.caddx.internal.CaddxEvent;
import org.openhab.binding.caddx.internal.CaddxMessage;
+import org.openhab.binding.caddx.internal.CaddxMessageContext;
import org.openhab.binding.caddx.internal.CaddxMessageType;
import org.openhab.binding.caddx.internal.CaddxPanelListener;
import org.openhab.binding.caddx.internal.CaddxProtocol;
private String serialPortName = "";
private int baudRate;
private int maxZoneNumber;
+ private boolean isIgnoreZoneStatusTransitions;
private @Nullable CaddxCommunicator communicator = null;
// Things served by the bridge
protocol = configuration.getProtocol();
baudRate = configuration.getBaudrate();
maxZoneNumber = configuration.getMaxZoneNumber();
+ isIgnoreZoneStatusTransitions = configuration.isIgnoreZoneStatusTransitions();
updateStatus(ThingStatus.OFFLINE);
// create & start panel interface
comm.addListener(this);
// Send discovery commands for the zones
- comm.transmit(new CaddxMessage(DISCOVERY_ZONES_SNAPSHOT_REQUEST_00, false));
- comm.transmit(new CaddxMessage(DISCOVERY_ZONES_SNAPSHOT_REQUEST_10, false));
- comm.transmit(new CaddxMessage(DISCOVERY_ZONES_SNAPSHOT_REQUEST_20, false));
- comm.transmit(new CaddxMessage(DISCOVERY_ZONES_SNAPSHOT_REQUEST_30, false));
- comm.transmit(new CaddxMessage(DISCOVERY_ZONES_SNAPSHOT_REQUEST_40, false));
- comm.transmit(new CaddxMessage(DISCOVERY_ZONES_SNAPSHOT_REQUEST_50, false));
- comm.transmit(new CaddxMessage(DISCOVERY_ZONES_SNAPSHOT_REQUEST_60, false));
- comm.transmit(new CaddxMessage(DISCOVERY_ZONES_SNAPSHOT_REQUEST_70, false));
- comm.transmit(new CaddxMessage(DISCOVERY_ZONES_SNAPSHOT_REQUEST_80, false));
- comm.transmit(new CaddxMessage(DISCOVERY_ZONES_SNAPSHOT_REQUEST_90, false));
- comm.transmit(new CaddxMessage(DISCOVERY_ZONES_SNAPSHOT_REQUEST_A0, false));
- comm.transmit(new CaddxMessage(DISCOVERY_ZONES_SNAPSHOT_REQUEST_B0, false));
+ comm.transmit(new CaddxMessage(CaddxMessageContext.DISCOVERY, DISCOVERY_ZONES_SNAPSHOT_REQUEST_00, false));
+ comm.transmit(new CaddxMessage(CaddxMessageContext.DISCOVERY, DISCOVERY_ZONES_SNAPSHOT_REQUEST_10, false));
+ comm.transmit(new CaddxMessage(CaddxMessageContext.DISCOVERY, DISCOVERY_ZONES_SNAPSHOT_REQUEST_20, false));
+ comm.transmit(new CaddxMessage(CaddxMessageContext.DISCOVERY, DISCOVERY_ZONES_SNAPSHOT_REQUEST_30, false));
+ comm.transmit(new CaddxMessage(CaddxMessageContext.DISCOVERY, DISCOVERY_ZONES_SNAPSHOT_REQUEST_40, false));
+ comm.transmit(new CaddxMessage(CaddxMessageContext.DISCOVERY, DISCOVERY_ZONES_SNAPSHOT_REQUEST_50, false));
+ comm.transmit(new CaddxMessage(CaddxMessageContext.DISCOVERY, DISCOVERY_ZONES_SNAPSHOT_REQUEST_60, false));
+ comm.transmit(new CaddxMessage(CaddxMessageContext.DISCOVERY, DISCOVERY_ZONES_SNAPSHOT_REQUEST_70, false));
+ comm.transmit(new CaddxMessage(CaddxMessageContext.DISCOVERY, DISCOVERY_ZONES_SNAPSHOT_REQUEST_80, false));
+ comm.transmit(new CaddxMessage(CaddxMessageContext.DISCOVERY, DISCOVERY_ZONES_SNAPSHOT_REQUEST_90, false));
+ comm.transmit(new CaddxMessage(CaddxMessageContext.DISCOVERY, DISCOVERY_ZONES_SNAPSHOT_REQUEST_A0, false));
+ comm.transmit(new CaddxMessage(CaddxMessageContext.DISCOVERY, DISCOVERY_ZONES_SNAPSHOT_REQUEST_B0, false));
// Send discovery commands for the partitions
- comm.transmit(new CaddxMessage(DISCOVERY_PARTITIONS_SNAPSHOT_REQUEST, false));
+ comm.transmit(
+ new CaddxMessage(CaddxMessageContext.DISCOVERY, DISCOVERY_PARTITIONS_SNAPSHOT_REQUEST, false));
// Send status commands to the zones and partitions
- thingZonesMap.forEach((k, v) -> sendCommand(CaddxBindingConstants.ZONE_STATUS_REQUEST,
- k.subtract(BigDecimal.ONE).toString()));
- thingPartitionsMap.forEach((k, v) -> sendCommand(CaddxBindingConstants.PARTITION_STATUS_REQUEST,
- k.subtract(BigDecimal.ONE).toString()));
+ thingZonesMap.forEach((k, v) -> sendCommand(CaddxMessageContext.COMMAND,
+ CaddxBindingConstants.ZONE_STATUS_REQUEST, k.subtract(BigDecimal.ONE).toString()));
+ thingPartitionsMap.forEach((k, v) -> sendCommand(CaddxMessageContext.COMMAND,
+ CaddxBindingConstants.PARTITION_STATUS_REQUEST, k.subtract(BigDecimal.ONE).toString()));
}
// list all channels
data = tokens[1];
}
- sendCommand(cmd, data);
+ sendCommand(CaddxMessageContext.COMMAND, cmd, data);
updateState(channelUID, new StringType(""));
}
* @param command The command to be send
* @param data The associated command data
*/
- public boolean sendCommand(String command, String data) {
+ public boolean sendCommand(CaddxMessageContext context, String command, String data) {
logger.trace("sendCommand(): Attempting to send Command: command - {} - data: {}", command, data);
CaddxMessage msg = null;
switch (command) {
case CaddxBindingConstants.ZONE_BYPASSED:
- msg = new CaddxMessage(CaddxMessageType.ZONE_BYPASS_TOGGLE, data);
+ msg = new CaddxMessage(context, CaddxMessageType.ZONE_BYPASS_TOGGLE, data);
break;
case CaddxBindingConstants.ZONE_STATUS_REQUEST:
- msg = new CaddxMessage(CaddxMessageType.ZONE_STATUS_REQUEST, data);
+ msg = new CaddxMessage(context, CaddxMessageType.ZONE_STATUS_REQUEST, data);
break;
case CaddxBindingConstants.ZONE_NAME_REQUEST:
- msg = new CaddxMessage(CaddxMessageType.ZONE_NAME_REQUEST, data);
+ msg = new CaddxMessage(context, CaddxMessageType.ZONE_NAME_REQUEST, data);
break;
case CaddxBindingConstants.PARTITION_STATUS_REQUEST:
- msg = new CaddxMessage(CaddxMessageType.PARTITION_STATUS_REQUEST, data);
+ msg = new CaddxMessage(context, CaddxMessageType.PARTITION_STATUS_REQUEST, data);
break;
case CaddxBindingConstants.PARTITION_PRIMARY_COMMAND_WITH_PIN:
- msg = new CaddxMessage(CaddxMessageType.PRIMARY_KEYPAD_FUNCTION_WITH_PIN, data);
+ msg = new CaddxMessage(context, CaddxMessageType.PRIMARY_KEYPAD_FUNCTION_WITH_PIN, data);
break;
case CaddxBindingConstants.PARTITION_SECONDARY_COMMAND:
- msg = new CaddxMessage(CaddxMessageType.SECONDARY_KEYPAD_FUNCTION, data);
+ msg = new CaddxMessage(context, CaddxMessageType.SECONDARY_KEYPAD_FUNCTION, data);
break;
case CaddxBindingConstants.PANEL_SYSTEM_STATUS_REQUEST:
- msg = new CaddxMessage(CaddxMessageType.SYSTEM_STATUS_REQUEST, data);
+ msg = new CaddxMessage(context, CaddxMessageType.SYSTEM_STATUS_REQUEST, data);
break;
case CaddxBindingConstants.PANEL_INTERFACE_CONFIGURATION_REQUEST:
- msg = new CaddxMessage(CaddxMessageType.INTERFACE_CONFIGURATION_REQUEST, data);
+ msg = new CaddxMessage(context, CaddxMessageType.INTERFACE_CONFIGURATION_REQUEST, data);
break;
case CaddxBindingConstants.PANEL_LOG_EVENT_REQUEST:
- msg = new CaddxMessage(CaddxMessageType.LOG_EVENT_REQUEST, data);
+ msg = new CaddxMessage(context, CaddxMessageType.LOG_EVENT_REQUEST, data);
break;
case CaddxBindingConstants.KEYPAD_TERMINAL_MODE_REQUEST:
- msg = new CaddxMessage(CaddxMessageType.KEYPAD_TERMINAL_MODE_REQUEST, data);
+ msg = new CaddxMessage(context, CaddxMessageType.KEYPAD_TERMINAL_MODE_REQUEST, data);
break;
case CaddxBindingConstants.KEYPAD_SEND_KEYPAD_TEXT_MESSAGE:
- msg = new CaddxMessage(CaddxMessageType.SEND_KEYPAD_TEXT_MESSAGE, data);
+ msg = new CaddxMessage(context, CaddxMessageType.SEND_KEYPAD_TEXT_MESSAGE, data);
break;
default:
logger.debug("Unknown command {}", command);
}
@Override
- public void caddxMessage(CaddxCommunicator communicator, CaddxMessage caddxMessage) {
+ public void caddxMessage(CaddxMessage caddxMessage) {
CaddxSource source = caddxMessage.getSource();
if (source != CaddxSource.NONE) {
CaddxThingType caddxThingType = null;
- @Nullable
Integer partition = null;
- @Nullable
Integer zone = null;
- @Nullable
Integer keypad = null;
switch (source) {
CaddxEvent event = new CaddxEvent(caddxMessage, partition, zone, keypad);
+ // Ignore Zone Status messages according to the configuration
+ if (isIgnoreZoneStatusTransitions
+ && caddxMessage.getCaddxMessageType() == CaddxMessageType.ZONE_STATUS_MESSAGE
+ && caddxMessage.getContext() == CaddxMessageContext.NONE) {
+ logger.debug("Zone {} Transition ignored.", zone);
+ return;
+ }
+
// Find the thing
Thing thing = findThing(caddxThingType, partition, zone, keypad);
CaddxDiscoveryService discoveryService = getDiscoveryService();
import org.openhab.binding.caddx.internal.CaddxBindingConstants;
import org.openhab.binding.caddx.internal.CaddxEvent;
import org.openhab.binding.caddx.internal.CaddxMessage;
+import org.openhab.binding.caddx.internal.CaddxMessageContext;
import org.openhab.binding.caddx.internal.CaddxMessageType;
import org.openhab.binding.caddx.internal.CaddxProperty;
import org.openhab.binding.caddx.internal.action.CaddxKeypadActions;
super(thing, CaddxThingType.KEYPAD);
}
+ @Override
+ public void initialize() {
+ super.initialize();
+
+ CaddxBridgeHandler bridgeHandler = getCaddxBridgeHandler();
+ if (bridgeHandler == null) {
+ return;
+ }
+
+ // Follow the bridge status
+ updateStatus(bridgeHandler.getThing().getStatus());
+ }
+
@Override
public void updateChannel(ChannelUID channelUID, String data) {
if (channelUID.getId().equals(CaddxBindingConstants.KEYPAD_KEY_PRESSED)) {
if (bridgeHandler == null) {
return;
}
- bridgeHandler.sendCommand(cmd, data);
+ bridgeHandler.sendCommand(CaddxMessageContext.COMMAND, cmd, data);
}
public void sendKeypadTextMessage(String displayLocation, String text) {
if (bridgeHandler == null) {
return;
}
- bridgeHandler.sendCommand(cmd, data);
+ bridgeHandler.sendCommand(CaddxMessageContext.COMMAND, cmd, data);
}
}
import org.openhab.binding.caddx.internal.CaddxBindingConstants;
import org.openhab.binding.caddx.internal.CaddxEvent;
import org.openhab.binding.caddx.internal.CaddxMessage;
+import org.openhab.binding.caddx.internal.CaddxMessageContext;
import org.openhab.binding.caddx.internal.CaddxMessageType;
import org.openhab.binding.caddx.internal.CaddxProperty;
import org.openhab.binding.caddx.internal.action.CaddxPanelActions;
super(thing, CaddxThingType.PANEL);
}
+ @Override
+ public void initialize() {
+ super.initialize();
+
+ CaddxBridgeHandler bridgeHandler = getCaddxBridgeHandler();
+ if (bridgeHandler == null) {
+ return;
+ }
+
+ String cmd = CaddxBindingConstants.PANEL_SYSTEM_STATUS_REQUEST;
+ String data = "";
+ bridgeHandler.sendCommand(CaddxMessageContext.COMMAND, cmd, data);
+ }
+
@Override
public void updateChannel(ChannelUID channelUID, String data) {
if (channelUID.getId().equals(CaddxBindingConstants.PANEL_FIRMWARE_VERSION)
data = "";
} else if (System.currentTimeMillis() - lastRefreshTime > 2000) {
// Refresh only if 2 seconds have passed from the last refresh
- cmd = CaddxBindingConstants.PANEL_INTERFACE_CONFIGURATION_REQUEST;
+ cmd = CaddxBindingConstants.PANEL_SYSTEM_STATUS_REQUEST;
data = "";
} else {
return;
}
- bridgeHandler.sendCommand(cmd, data);
+ bridgeHandler.sendCommand(CaddxMessageContext.COMMAND, cmd, data);
lastRefreshTime = System.currentTimeMillis();
} else {
logger.debug("Unknown command {}", command);
CaddxMessageType mt = message.getCaddxMessageType();
ChannelUID channelUID = null;
+ for (CaddxProperty p : mt.properties) {
+ if (!p.getId().isEmpty()) {
+ String value = message.getPropertyById(p.getId());
+ channelUID = new ChannelUID(getThing().getUID(), p.getId());
+ updateChannel(channelUID, value);
+ logger.trace("Updating panel channel: {}", channelUID.getAsString());
+ }
+ }
+
// Log event messages have special handling
if (CaddxMessageType.SYSTEM_STATUS_MESSAGE.equals(mt)) {
handleSystemStatusMessage(message);
} else if (CaddxMessageType.LOG_EVENT_MESSAGE.equals(mt)) {
handleLogEventMessage(message);
- } else {
- for (CaddxProperty p : mt.properties) {
- if (!p.getId().isEmpty()) {
- String value = message.getPropertyById(p.getId());
- channelUID = new ChannelUID(getThing().getUID(), p.getId());
- updateChannel(channelUID, value);
- }
- }
+ } else if (CaddxMessageType.ZONES_SNAPSHOT_MESSAGE.equals(mt)) {
+ handleZonesSnapshotMessage(message);
}
updateStatus(ThingStatus.ONLINE);
// build map of log message channels to event numbers
HashMap<String, String> map = new HashMap<String, String>();
map.put(pointer, CaddxBindingConstants.PANEL_LOG_MESSAGE_N_0);
- bridgeHandler.sendCommand(CaddxBindingConstants.PANEL_LOG_EVENT_REQUEST, pointer);
+ bridgeHandler.sendCommand(CaddxMessageContext.COMMAND, CaddxBindingConstants.PANEL_LOG_EVENT_REQUEST, pointer);
panelLogMessagesMap = map;
}
}
map.put(Integer.toString(eventNumber), "panel_log_message_n_" + i);
- bridgeHandler.sendCommand(CaddxBindingConstants.PANEL_LOG_EVENT_REQUEST, Integer.toString(eventNumber));
+ bridgeHandler.sendCommand(CaddxMessageContext.COMMAND, CaddxBindingConstants.PANEL_LOG_EVENT_REQUEST,
+ Integer.toString(eventNumber));
}
communicatorStackPointer = null;
}
}
+ private void handleZonesSnapshotMessage(CaddxMessage message) {
+ // Get the bridge handler
+ CaddxBridgeHandler bridgeHandler = getCaddxBridgeHandler();
+ if (bridgeHandler == null) {
+ return;
+ }
+
+ int zoneOffset = Integer.parseInt(message.getPropertyById("zone_offset"));
+
+ for (int i = 1; i <= 16; i++) {
+ int zoneNumber = zoneOffset * 16 + i;
+
+ String zoneFaulted = message.getPropertyById("zone_" + i + "_faulted");
+ String zoneBypassed = message.getPropertyById("zone_" + i + "_bypassed");
+ String zoneTrouble = message.getPropertyById("zone_" + i + "_trouble");
+ String zoneAlarmMemory = message.getPropertyById("zone_" + i + "_alarm_memory");
+
+ logger.debug("Flags for zone {}. faulted:{}, bypassed:{}, trouble:{}, alarm_memory:{}", zoneNumber,
+ zoneFaulted, zoneBypassed, zoneTrouble, zoneAlarmMemory);
+
+ // Get thing
+ Thing thing = bridgeHandler.findThing(CaddxThingType.ZONE, null, zoneNumber, null);
+ if (thing != null) {
+ ChannelUID channelUID;
+
+ logger.debug("Thing found for zone {}.", zoneNumber);
+
+ channelUID = new ChannelUID(thing.getUID(), "zone_faulted");
+ updateChannel(channelUID, zoneFaulted);
+ channelUID = new ChannelUID(thing.getUID(), "zone_bypassed");
+ updateChannel(channelUID, zoneBypassed);
+ channelUID = new ChannelUID(thing.getUID(), "zone_trouble");
+ updateChannel(channelUID, zoneTrouble);
+ channelUID = new ChannelUID(thing.getUID(), "zone_alarm_memory");
+ updateChannel(channelUID, zoneAlarmMemory);
+ }
+ }
+ }
+
@Override
public Collection<Class<? extends ThingHandlerService>> getServices() {
return Collections.singleton(CaddxPanelActions.class);
if (bridgeHandler == null) {
return;
}
- bridgeHandler.sendCommand(cmd, sb.toString());
+ bridgeHandler.sendCommand(CaddxMessageContext.COMMAND, cmd, sb.toString());
}
private void sendSecondaryCommand(String function) {
if (bridgeHandler == null) {
return;
}
- bridgeHandler.sendCommand(cmd, sb.toString());
+ bridgeHandler.sendCommand(CaddxMessageContext.COMMAND, cmd, sb.toString());
}
public void turnOffAnySounderOrAlarm(String pin) {
import org.openhab.binding.caddx.internal.CaddxBindingConstants;
import org.openhab.binding.caddx.internal.CaddxEvent;
import org.openhab.binding.caddx.internal.CaddxMessage;
+import org.openhab.binding.caddx.internal.CaddxMessageContext;
import org.openhab.binding.caddx.internal.CaddxMessageType;
import org.openhab.binding.caddx.internal.CaddxProperty;
import org.openhab.binding.caddx.internal.action.CaddxPartitionActions;
super(thing, CaddxThingType.PARTITION);
}
+ @Override
+ public void initialize() {
+ super.initialize();
+
+ CaddxBridgeHandler bridgeHandler = getCaddxBridgeHandler();
+ if (bridgeHandler == null) {
+ return;
+ }
+
+ String cmd = CaddxBindingConstants.PARTITION_STATUS_REQUEST;
+ String data = String.format("%d", getPartitionNumber() - 1);
+ bridgeHandler.sendCommand(CaddxMessageContext.COMMAND, cmd, data);
+ }
+
@Override
public void updateChannel(ChannelUID channelUID, String data) {
if (CaddxBindingConstants.PARTITION_SECONDARY_COMMAND.equals(channelUID.getId())) {
}
if (!data.startsWith("-")) {
- bridgeHandler.sendCommand(cmd, data);
+ bridgeHandler.sendCommand(CaddxMessageContext.COMMAND, cmd, data);
}
}
String value = message.getPropertyById(p.getId());
channelUID = new ChannelUID(getThing().getUID(), p.getId());
updateChannel(channelUID, value);
+ logger.trace("Updating partition channel: {}", channelUID.getAsString());
}
}
if (bridgeHandler == null) {
return;
}
- bridgeHandler.sendCommand(cmd, sb.toString());
+ bridgeHandler.sendCommand(CaddxMessageContext.COMMAND, cmd, sb.toString());
}
private void sendSecondaryCommand(String function) {
if (bridgeHandler == null) {
return;
}
- bridgeHandler.sendCommand(cmd, sb.toString());
+ bridgeHandler.sendCommand(CaddxMessageContext.COMMAND, cmd, sb.toString());
}
public void turnOffAnySounderOrAlarm(String pin) {
import org.openhab.binding.caddx.internal.CaddxBindingConstants;
import org.openhab.binding.caddx.internal.CaddxEvent;
import org.openhab.binding.caddx.internal.CaddxMessage;
+import org.openhab.binding.caddx.internal.CaddxMessageContext;
import org.openhab.binding.caddx.internal.CaddxMessageType;
import org.openhab.binding.caddx.internal.CaddxProperty;
import org.openhab.binding.caddx.internal.action.CaddxZoneActions;
super(thing, CaddxThingType.ZONE);
}
+ @Override
+ public void initialize() {
+ super.initialize();
+
+ CaddxBridgeHandler bridgeHandler = getCaddxBridgeHandler();
+ if (bridgeHandler == null) {
+ return;
+ }
+
+ String cmd1 = CaddxBindingConstants.ZONE_STATUS_REQUEST;
+ String cmd2 = CaddxBindingConstants.ZONE_NAME_REQUEST;
+ String data = String.format("%d", getZoneNumber() - 1);
+
+ bridgeHandler.sendCommand(CaddxMessageContext.COMMAND, cmd1, data);
+ bridgeHandler.sendCommand(CaddxMessageContext.COMMAND, cmd2, data);
+ }
+
@Override
public void updateChannel(ChannelUID channelUID, String data) {
if (channelUID.getId().equals(CaddxBindingConstants.ZONE_NAME)) {
if (bridgeHandler == null) {
return;
}
- bridgeHandler.sendCommand(cmd1, data);
- bridgeHandler.sendCommand(cmd2, data);
+ bridgeHandler.sendCommand(CaddxMessageContext.COMMAND, cmd1, data);
+ bridgeHandler.sendCommand(CaddxMessageContext.COMMAND, cmd2, data);
}
@Override
String value = message.getPropertyById(p.getId());
channelUID = new ChannelUID(getThing().getUID(), p.getId());
updateChannel(channelUID, value);
-
- logger.trace(" updateChannel: {} = {}", channelUID, value);
+ logger.trace("Updating zone channel: {}", channelUID.getAsString());
}
}
}
if (bridgeHandler == null) {
return;
}
- bridgeHandler.sendCommand(cmd, data);
+ bridgeHandler.sendCommand(CaddxMessageContext.COMMAND, cmd, data);
}
}
<default>16</default>
</parameter>
+ <parameter name="ignoreZoneStatusTransitions" type="boolean" required="true">
+ <label>Ignore Zone Status Transitions</label>
+ <description>Flag specifying if the Zone Status Transitions should be ignored</description>
+ <default>false</default>
+ </parameter>
</config-description>
</bridge-type>
<label>Zone Bypass Toggle</label>
<description>Zone Bypass Toggle</description>
</channel>
+
+ <channel id="panel_ac_fail" typeId="panel_flag">
+ <label>AC fail</label>
+ <description>AC fail</description>
+ </channel>
+ <channel id="panel_ac_power_on" typeId="panel_flag">
+ <label>AC Power On</label>
+ <description>AC Power On</description>
+ </channel>
+ <channel id="panel_low_battery_memory" typeId="panel_flag">
+ <label>Low Battery Memory</label>
+ <description>Low Battery Memory</description>
+ </channel>
+
</channels>
</thing-type>
*/
public static CaddxMessage readCaddxMessage(String messageName) {
byte[] bytes = readRawMessage(messageName);
- return new CaddxMessage(bytes, true);
+ return new CaddxMessage(CaddxMessageContext.NONE, bytes, true);
}
}
// @formatter:off
public static final List<Object[]> data() {
return Arrays.asList(new Object[][] {
- { "zone_status_message", "zone_number", "4", },
{ "interface_configuration_message", "panel_firmware_version", "5.37", },
{ "interface_configuration_message", "panel_interface_configuration_message", "true", },
+ { "zone_status_message", "zone_number", "4", },
+ { "zone_status_message", "zone_partition1", "true", },
+ { "zone_status_message", "zone_partition2", "false", },
+ { "zone_status_message", "zone_partition3", "false", },
+ { "zone_status_message", "zone_partition4", "false", },
+ { "zone_status_message", "zone_partition5", "false", },
+ { "zone_status_message", "zone_partition6", "false", },
+ { "zone_status_message", "zone_partition7", "false", },
+ { "zone_status_message", "zone_partition8", "false", },
+ { "zone_status_message", "zone_fire", "true", },
+ { "zone_status_message", "zone_24hour", "false", },
+ { "zone_status_message", "zone_key_switch", "false", },
+ { "zone_status_message", "zone_follower", "false", },
+ { "zone_status_message", "zone_entry_exit_delay_1", "false", },
+ { "zone_status_message", "zone_entry_exit_delay_2", "false", },
+ { "zone_status_message", "zone_interior", "false", },
+ { "zone_status_message", "zone_local_only", "false", },
+ { "zone_status_message", "zone_keypad_sounder", "true", },
+ { "zone_status_message", "zone_yelping_siren", "false", },
+ { "zone_status_message", "zone_steady_siren", "true", },
+ { "zone_status_message", "zone_chime", "false", },
+ { "zone_status_message", "zone_bypassable", "false", },
+ { "zone_status_message", "zone_group_bypassable", "false", },
+ { "zone_status_message", "zone_force_armable", "false", },
+ { "zone_status_message", "zone_entry_guard", "false", },
+ { "zone_status_message", "zone_fast_loop_response", "false", },
+ { "zone_status_message", "zone_double_eol_tamper", "false", },
+ { "zone_status_message", "zone_type_trouble", "true", },
+ { "zone_status_message", "zone_cross_zone", "false", },
+ { "zone_status_message", "zone_dialer_delay", "false", },
+ { "zone_status_message", "zone_swinger_shutdown", "false", },
+ { "zone_status_message", "zone_restorable", "true", },
+ { "zone_status_message", "zone_listen_in", "true", },
+ { "zone_status_message", "zone_faulted", "false", },
+ { "zone_status_message", "zone_tampered", "false", },
+ { "zone_status_message", "zone_trouble", "false", },
+ { "zone_status_message", "zone_bypassed", "false", },
+ { "zone_status_message", "zone_inhibited", "false", },
+ { "zone_status_message", "zone_low_battery", "false", },
+ { "zone_status_message", "zone_loss_of_supervision", "false", },
+ { "zone_status_message", "zone_alarm_memory", "false", },
+ { "zone_status_message", "zone_bypass_memory", "false", },
+
+ { "zones_snapshot_message", "zone_offset", "1", },
+ { "zones_snapshot_message", "zone_1_faulted", "false", },
+ { "zones_snapshot_message", "zone_1_bypassed", "false", },
+ { "zones_snapshot_message", "zone_1_trouble", "false", },
+ { "zones_snapshot_message", "zone_1_alarm_memory", "false", },
+ { "zones_snapshot_message", "zone_2_faulted", "false", },
+ { "zones_snapshot_message", "zone_2_bypassed", "false", },
+ { "zones_snapshot_message", "zone_2_trouble", "false", },
+ { "zones_snapshot_message", "zone_2_alarm_memory", "false", },
+ { "zones_snapshot_message", "zone_3_faulted", "false", },
+ { "zones_snapshot_message", "zone_3_bypassed", "false", },
+ { "zones_snapshot_message", "zone_3_trouble", "false", },
+ { "zones_snapshot_message", "zone_3_alarm_memory", "false", },
+ { "zones_snapshot_message", "zone_4_faulted", "true", },
+ { "zones_snapshot_message", "zone_4_bypassed", "false", },
+ { "zones_snapshot_message", "zone_4_trouble", "false", },
+ { "zones_snapshot_message", "zone_4_alarm_memory", "false", },
+ { "zones_snapshot_message", "zone_5_faulted", "false", },
+ { "zones_snapshot_message", "zone_6_faulted", "false", },
+ { "zones_snapshot_message", "zone_7_faulted", "false", },
+ { "zones_snapshot_message", "zone_8_faulted", "false", },
+ { "zones_snapshot_message", "zone_9_faulted", "false", },
+ { "zones_snapshot_message", "zone_10_faulted", "true", },
+ { "zones_snapshot_message", "zone_11_faulted", "false", },
+ { "zones_snapshot_message", "zone_12_faulted", "false", },
+ { "zones_snapshot_message", "zone_13_faulted", "false", },
+ { "zones_snapshot_message", "zone_14_faulted", "true", },
+
});
}
// @formatter:on
--- /dev/null
+85 01 00 10 00 00 10 00 10 00 C0 7F
\ No newline at end of file