diff --git a/.gitignore b/.gitignore index 641e7d84..56a9b2c9 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ install-sh stamp-h1 libtool Doxyfile +build .tarball-version .version diff --git a/README b/README index acc298bc..ad139816 100644 --- a/README +++ b/README @@ -29,3 +29,8 @@ Usage: [-d device_index (default: 0)] ./rtl_433 will run the software in receive mode. Some sensor data can be receviced. This software is mostly useable for developers right now. + +## Supported Devices + +* Added support for Mebus/433 Sensors (YD8210BH) + diff --git a/src/rtl_433.c b/src/rtl_433.c index edef1a54..7ea45cf9 100644 --- a/src/rtl_433.c +++ b/src/rtl_433.c @@ -92,6 +92,71 @@ int debug_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS], int16_t bits_per_row[BI return 0; } +static int mebus433_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS], int16_t bits_per_row[BITBUF_ROWS]) { + int temperature_before_dec; + int temperature_after_dec; + int16_t temp; + int8_t hum; + + if (bb[0][0] == 0 && bb[1][4] !=0 && (bb[1][0] & 0b01100000) && bb[1][3]==bb[5][3] && bb[1][4] == bb[12][4]){ + // Upper 4 bits are stored in nibble 1, lower 8 bits are stored in nibble 2 + // upper 4 bits of nibble 1 are reserved for other usages. + temp = (int16_t)((uint16_t)(bb[1][1] << 12 ) | bb[1][2]<< 4); + temp = temp >> 4; + // lower 4 bits of nibble 3 and upper 4 bits of nibble 4 contains + // humidity as decimal value + hum = (bb[1][3] << 4 | bb[1][4] >> 4); + + temperature_before_dec = abs(temp / 10); + temperature_after_dec = abs(temp % 10); + + fprintf(stderr, "Sensor event:\n"); + fprintf(stderr, "protocol = Mebus/433\n"); + fprintf(stderr, "address = %i\n", bb[1][0] & 0b00011111); + fprintf(stderr, "channel = %i\n",((bb[1][1] & 0b00110000) >> 4)+1); + fprintf(stderr, "battery = %s\n", bb[1][1] & 0b10000000?"Ok":"Low"); + fprintf(stderr, "unkown1 = %i\n",(bb[1][1] & 0b01000000) >> 6); // always 0? + fprintf(stderr, "unkown2 = %i\n",(bb[1][3] & 0b11110000) >> 4); // always 1111? + fprintf(stderr, "temperature = %s%d.%d°C\n",temp<0?"-":"",temperature_before_dec, temperature_after_dec); + fprintf(stderr, "humidity = %i%%\n", hum); + fprintf(stderr, "%02x %02x %02x %02x %02x\n",bb[1][0],bb[1][1],bb[1][2],bb[1][3],bb[1][4]); + + if (debug_output) + debug_callback(bb, bits_per_row); + + return 1; + } + return 0; +} + + +static int intertechno_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS], int16_t bits_per_row[BITBUF_ROWS]) { + + //if (bb[1][1] == 0 && bb[1][0] != 0 && bb[1][3]==bb[2][3]){ + if(bb[0][0]==0 && bb[0][0] == 0 && bb[1][0] == 0x56){ + fprintf(stderr, "Switch event:\n"); + fprintf(stderr, "protocol = Intertechno\n"); + fprintf(stderr, "rid = %x\n",bb[1][0]); + fprintf(stderr, "rid = %x\n",bb[1][1]); + fprintf(stderr, "rid = %x\n",bb[1][2]); + fprintf(stderr, "rid = %x\n",bb[1][3]); + fprintf(stderr, "rid = %x\n",bb[1][4]); + fprintf(stderr, "rid = %x\n",bb[1][5]); + fprintf(stderr, "rid = %x\n",bb[1][6]); + fprintf(stderr, "rid = %x\n",bb[1][7]); + fprintf(stderr, "ADDR Slave = %i\n",bb[1][7] & 0b00001111); + fprintf(stderr, "ADDR Master = %i\n",(bb[1][7] & 0b11110000) >> 4); + fprintf(stderr, "command = %i\n",(bb[1][6] & 0b00000111)); + fprintf(stderr, "%02x %02x %02x %02x %02x\n",bb[1][0],bb[1][1],bb[1][2],bb[1][3],bb[1][4]); + + if (debug_output) + debug_callback(bb, bits_per_row); + + return 1; + } + return 0; +} + r_device tech_line_fws_500 = { /* .id = */ 4, /* .name = */ "Tech Line FWS-500 Sensor", @@ -122,6 +187,28 @@ r_device technoline_ws9118 = { // /* .json_callback = */ &debug_callback, }; +r_device mebus433 = { + /* .id = */ 10, + /* .name = */ "Mebus 433", + /* .modulation = */ OOK_PWM_D, + /* .short_limit = */ 300, + /* .long_limit = */ 600, + /* .reset_limit = */ 1500, + /* .json_callback = */ &mebus433_callback, + /* .json_callback = */ //&debug_callback, +}; + +r_device intertechno = { + /* .id = */ 11, + /* .name = */ "Intertechno 433", + /* .modulation = */ OOK_PWM_D, + /* .short_limit = */ 100, + /* .long_limit = */ 350, + /* .reset_limit = */ 3000, + /* .json_callback = */ &intertechno_callback, + /* .json_callback = */ //&debug_callback, +}; + struct protocol_state { int (*callback)(uint8_t bits_buffer[BITBUF_ROWS][BITBUF_COLS],int16_t bits_per_row[BITBUF_ROWS]); @@ -1048,6 +1135,8 @@ int main(int argc, char **argv) register_protocol(demod, &lacrossetx); // register_protocol(demod, &acurite_rain_gauge); register_protocol(demod, &oregon_scientific); + register_protocol(demod, &mebus433); + register_protocol(demod, &intertechno); if (argc <= optind-1) { usage();