Merge branch 'toke:master' into refactor

Conflicts:
	src/rtl_433.c

replaces PR#50
This commit is contained in:
Helge Weissig 2015-01-16 15:06:33 -08:00
commit 9d98d97213
3 changed files with 95 additions and 0 deletions

1
.gitignore vendored
View file

@ -24,6 +24,7 @@ install-sh
stamp-h1 stamp-h1
libtool libtool
Doxyfile Doxyfile
build
.tarball-version .tarball-version
.version .version

5
README
View file

@ -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. ./rtl_433 will run the software in receive mode. Some sensor data can be receviced.
This software is mostly useable for developers right now. This software is mostly useable for developers right now.
## Supported Devices
* Added support for Mebus/433 Sensors (YD8210BH)

View file

@ -92,6 +92,71 @@ int debug_callback(uint8_t bb[BITBUF_ROWS][BITBUF_COLS], int16_t bits_per_row[BI
return 0; 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 = { r_device tech_line_fws_500 = {
/* .id = */ 4, /* .id = */ 4,
/* .name = */ "Tech Line FWS-500 Sensor", /* .name = */ "Tech Line FWS-500 Sensor",
@ -122,6 +187,28 @@ r_device technoline_ws9118 = {
// /* .json_callback = */ &debug_callback, // /* .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 { struct protocol_state {
int (*callback)(uint8_t bits_buffer[BITBUF_ROWS][BITBUF_COLS],int16_t bits_per_row[BITBUF_ROWS]); 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, &lacrossetx);
// register_protocol(demod, &acurite_rain_gauge); // register_protocol(demod, &acurite_rain_gauge);
register_protocol(demod, &oregon_scientific); register_protocol(demod, &oregon_scientific);
register_protocol(demod, &mebus433);
register_protocol(demod, &intertechno);
if (argc <= optind-1) { if (argc <= optind-1) {
usage(); usage();