2 * *** Honeywell (Ademco) Door/Window Sensors (345.0Mhz) ***
4 * Tested with the Honeywell 5811 Wireless Door/Window transmitters
6 * 64 bit packets, repeated multiple times per open/close event
8 * Protocol whitepaper: "DEFCON 22: Home Insecurity" by Logan Lamb
10 * 0xfffe Preamble and sync bit
12 * 0xYYYYY Device serial number
13 * 0xYY Event Information (Open/Close, Heartbeat, etc)
19 #include "pulse_demod.h"
22 static int honeywell_callback(bitbuffer_t *bitbuffer) {
23 char time_str[LOCAL_TIME_BUFLEN];
29 uint16_t crc_calculated = 0;
32 local_time_str(0, time_str);
34 if(bitbuffer->num_rows != 1 || bitbuffer->bits_per_row[0] != 64)
35 return 0; // Unrecognized data
37 for(uint16_t i=0; i < 8; i++)
38 bitbuffer->bb[0][i] = ~bitbuffer->bb[0][i];
40 bb = bitbuffer->bb[0];
42 crc_calculated = crc16_ccitt(bb, 6, 0x8005, 0xfffe);
43 crc = (((uint16_t) bb[6]) << 8) + ((uint16_t) bb[7]);
44 if(crc != crc_calculated)
45 return 0; // Not a valid packet
47 sprintf(hex, "%02x", bb[2]);
48 device_id[0] = hex[1];
49 sprintf(hex, "%02x", bb[3]);
50 device_id[1] = hex[0];
51 device_id[2] = hex[1];
52 sprintf(hex, "%02x", bb[4]);
53 device_id[3] = hex[0];
54 device_id[4] = hex[1];
58 for (uint16_t bit = 0; bit < 64; ++bit) {
59 if (bb[bit/8] & (0x80 >> (bit % 8))) {
67 data_t *data = data_make(
68 "time", "", DATA_STRING, time_str,
69 "id", "", DATA_STRING, device_id,
70 "state", "", DATA_STRING, ( (bb[5] & 0x80) == 0x00)? "closed":"open",
71 "heartbeat" , "", DATA_STRING, ( (bb[5] & 0x04) == 0x04)? "yes" : "no",
72 "crc", "", DATA_STRING, "ok",
73 "time_unix","", DATA_INT, time(NULL),
74 "binary", "", DATA_STRING, binary,
77 data_acquired_handler(data);
81 static char *output_fields[] = {
92 r_device honeywell = {
93 .name = "Honeywell Door/Window Sensor",
94 .modulation = OOK_PULSE_MANCHESTER_ZEROBIT,
95 .short_limit = 39 * 4,
97 .reset_limit = 73 * 4,
98 .json_callback = &honeywell_callback,
101 .fields = output_fields,