3 static int mebus433_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS], int16_t bits_per_row[BITBUF_ROWS]) {
4 int temperature_before_dec;
5 int temperature_after_dec;
9 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]){
10 // Upper 4 bits are stored in nibble 1, lower 8 bits are stored in nibble 2
11 // upper 4 bits of nibble 1 are reserved for other usages.
12 temp = (int16_t)((uint16_t)(bb[1][1] << 12 ) | bb[1][2]<< 4);
14 // lower 4 bits of nibble 3 and upper 4 bits of nibble 4 contains
15 // humidity as decimal value
16 hum = (bb[1][3] << 4 | bb[1][4] >> 4);
18 temperature_before_dec = abs(temp / 10);
19 temperature_after_dec = abs(temp % 10);
21 fprintf(stdout, "SENSOR:TYPE=MEBUS,");
22 fprintf(stdout, "ID=%i,", bb[1][0] & 0b00011111);
23 fprintf(stdout, "CHANNEL=%i,",((bb[1][1] & 0b00110000) >> 4)+1);
24 fprintf(stdout, "BATTERY=%s,", bb[1][1] & 0b10000000?"OK":"LOW");
25 fprintf(stdout, "TEMPERATURE=%s%d.%d,",temp<0?"-":"",temperature_before_dec, temperature_after_dec);
26 fprintf(stdout, "HUMIDITY=%i\n", hum);
27 fprintf(stderr, "%02x %02x %02x %02x %02x\n",bb[1][0],bb[1][1],bb[1][2],bb[1][3],bb[1][4]);
30 debug_callback(bb, bits_per_row);
39 /* .name = */ "Mebus 433",
40 /* .modulation = */ OOK_PWM_D,
41 /* .short_limit = */ 300,
42 /* .long_limit = */ 600,
43 /* .reset_limit = */ 1500,
44 /* .json_callback = */ &mebus433_callback,
45 /* .json_callback = */ //&debug_callback,