diff --git a/src/devices/honeywell_wdb.c b/src/devices/honeywell_wdb.c index bb765b7f7..216e28f40 100644 --- a/src/devices/honeywell_wdb.c +++ b/src/devices/honeywell_wdb.c @@ -13,6 +13,7 @@ Honeywell ActivLink, wireless door bell, PIR Motion sensor. Frame documentation courtesy of https://github.com/klohner/honeywell-wireless-doorbell +Updated to include Door/Window Contact sensor Frame bits used in Honeywell RCWL300A, RCWL330A, Series 3, 5, 9 and all Decor Series: @@ -23,12 +24,14 @@ Wireless Chimes XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XX.. XXX. .... KEY DATA (any change and receiver doesn't seem to recognize signal) XXXX XXXX XXXX XXXX XXXX .... .... .... .... .... .... .... KEY ID (different for each transmitter) - .... .... .... .... .... 0000 00.. 0000 0000 00.. 000. .... KEY UNKNOWN 0 (always 0 in devices I've tested) - .... .... .... .... .... .... ..XX .... .... .... .... .... DEVICE TYPE (10 = doorbell, 01 = PIR Motion sensor) - .... .... .... .... .... .... .... .... .... ..XX ...X XXX. FLAG DATA (may be modified for possible effects on + .... .... .... .... .... 0000 0... 0000 0000 00.. 0... .... KEY UNKNOWN 0 (always 0 in devices I've tested) + .... .... .... .... .... .... .XXX .... .... .... .... .... DEVICE TYPE (10 = doorbell, 01 = PIR Motion sensor, + 101 = door/window)) + .... .... .... .... .... .... .... .... .... ..XX .XXX XXX. FLAG DATA (may be modified for possible effects on receiver) .... .... .... .... .... .... .... .... .... ..XX .... .... ALERT (00 = normal, 01 or 10 = right-left halo light pattern, 11 = full volume alarm) + .... .... .... .... .... .... .... .... .... .... .XX. .... DOOR/WINDOW (10 = Closed, 01 = Opened) .... .... .... .... .... .... .... .... .... .... ...X .... SECRET KNOCK (0 = default, 1 if doorbell is pressed 3x rapidly) .... .... .... .... .... .... .... .... .... .... .... X... RELAY (1 if signal is a retransmission of a received @@ -44,10 +47,10 @@ Wireless Chimes static int honeywell_wdb_callback(r_device *decoder, bitbuffer_t *bitbuffer) { - int row, secret_knock, relay, battery, parity; + int row, secret_knock, relay, battery, parity, open, opened, closed, tampered; uint8_t *bytes; data_t *data; - unsigned int device, tmp; + unsigned int device, tmp, type; char const *class, *alert; // The device transmits many rows, check for 4 matching rows. @@ -78,10 +81,11 @@ static int honeywell_wdb_callback(r_device *decoder, bitbuffer_t *bitbuffer) } device = bytes[0] << 12 | bytes[1] << 4 | (bytes[2] >> 4); - tmp = (bytes[3] & 0x30) >> 4; - switch (tmp) { + type = (bytes[3] & 0x70) >> 4; + switch (type) { case 0x1: class = "PIR-Motion"; break; case 0x2: class = "Doorbell"; break; + case 0x5: class = "Contact"; break; default: class = "Unknown"; break; } tmp = bytes[4] & 0x3; @@ -92,9 +96,29 @@ static int honeywell_wdb_callback(r_device *decoder, bitbuffer_t *bitbuffer) case 0x3: alert = "Full"; break; default: alert = "Unknown"; break; } + /* this bit appears to have two uses depending on whether the sensor is a bell push or contact sensor */ secret_knock = (bytes[5] & 0x10) >> 4; + tampered=secret_knock; + if (type == 0x5) { + secret_knock=0; + } + else { + tampered=0; + } relay = (bytes[5] & 0x8) >> 3; battery = (bytes[5] & 0x2) >> 1; + opened = (bytes[5] & 0x20) >> 5; + closed = (bytes[5] & 0x40) >> 6; + /* this catches the tamper signal when the open/close is not valid */ + if (opened && !closed) { + open = 1; + } + else if (!opened && closed) { + open = 0; + } + else { + open = -1; + } /* clang-format off */ data = data_make( @@ -104,6 +128,8 @@ static int honeywell_wdb_callback(r_device *decoder, bitbuffer_t *bitbuffer) "battery_ok", "Battery", DATA_INT, !battery, "alert", "Alert", DATA_STRING, alert, "secret_knock", "Secret Knock",DATA_FORMAT, "%d", DATA_INT, secret_knock, + "open", "Open", DATA_FORMAT, "%d", DATA_INT, open, + "tampered", "Tampered", DATA_FORMAT, "%d", DATA_INT, tampered, "relay", "Relay", DATA_FORMAT, "%d", DATA_INT, relay, "mic", "Integrity", DATA_STRING, "PARITY", NULL); @@ -120,6 +146,8 @@ static char const *const output_fields[] = { "battery_ok", "alert", "secret_knock", + "open", + "tampered", "relay", "mic", NULL,