diff --git a/include/rtl_433.h b/include/rtl_433.h index 8d2ce81b..596255d6 100644 --- a/include/rtl_433.h +++ b/include/rtl_433.h @@ -42,7 +42,7 @@ #define MINIMAL_BUF_LENGTH 512 #define MAXIMAL_BUF_LENGTH (256 * 16384) -#define MAX_PROTOCOLS 70 +#define MAX_PROTOCOLS 71 #define SIGNAL_GRABBER_BUFFER (12 * DEFAULT_BUF_LENGTH) /* Supported modulation types */ diff --git a/include/rtl_433_devices.h b/include/rtl_433_devices.h index a3b9ae41..8b87d689 100755 --- a/include/rtl_433_devices.h +++ b/include/rtl_433_devices.h @@ -73,7 +73,8 @@ DECL(kerui) \ DECL(fineoffset_wh1050) \ DECL(honeywell) \ - DECL(maverick_et73x) + DECL(maverick_et73x) \ + DECL(rftech) typedef struct { diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b83080c7..7de88753 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -87,6 +87,7 @@ add_executable(rtl_433 devices/fineoffset_wh1050.c devices/honeywell.c devices/maverick_et73x.c + devices/rftech.c ) diff --git a/src/Makefile.am b/src/Makefile.am index 2c8f0042..3700e79a 100755 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -72,6 +72,7 @@ rtl_433_SOURCES = baseband.c \ devices/kerui.c \ devices/fineoffset_wh1050.c \ devices/honeywell.c \ - devices/maverick_et73x.c + devices/maverick_et73x.c \ + devices/rftech.c rtl_433_LDADD = $(LIBRTLSDR) $(LIBM) diff --git a/src/devices/akhan_100F14.c b/src/devices/akhan_100F14.c index 3360dba2..5b9f06f9 100644 --- a/src/devices/akhan_100F14.c +++ b/src/devices/akhan_100F14.c @@ -13,7 +13,7 @@ static int akhan_rke_callback(bitbuffer_t *bitbuffer) { bitrow_t *bb = bitbuffer->bb; uint8_t *b = bb[0]; - + //invert bits, short pulse is 0, long pulse is 1 b[0] = ~b[0]; b[1] = ~b[1]; @@ -72,7 +72,7 @@ PWM_Precise_Parameters pwm_precise_parameters_akhan = { r_device akhan_100F14 = { .name = "Akhan 100F14 remote keyless entry", - .modulation = OOK_PULSE_PWM_PRECISE, + .modulation = OOK_PULSE_PWM_PRECISE, .short_limit = 316, .long_limit = 1020, .reset_limit = 1800, diff --git a/src/devices/oregon_scientific.c b/src/devices/oregon_scientific.c index 8b5f3731..5f5c3eae 100755 --- a/src/devices/oregon_scientific.c +++ b/src/devices/oregon_scientific.c @@ -538,12 +538,13 @@ return 1; float rawAmp = (msg[4] >> 4 << 8 | (msg[3] & 0x0f )<< 4 | msg[3] >> 4); //fprintf(stdout, "current measurement reading value = %.0f\n", rawAmp); //fprintf(stdout, "current watts (230v) = %.0f\n", rawAmp /(0.27*230)*1000); + unsigned short int ipower = (rawAmp /(0.27*230)*1000); data = data_make( "time", "", DATA_STRING, time_str, "brand", "", DATA_STRING, "OS", "model", "", DATA_STRING, "CM160", "id", "House Code", DATA_INT, msg[1]&0x0F, - "power", "Power", DATA_FORMAT, "%.0f W", DATA_INT, (rawAmp /(0.27*230)*1000), + "power", "Power", DATA_FORMAT, "%.0f W", DATA_INT, ipower, NULL); data_acquired_handler(data); } diff --git a/src/devices/rftech.c b/src/devices/rftech.c new file mode 100644 index 00000000..5ad611e8 --- /dev/null +++ b/src/devices/rftech.c @@ -0,0 +1,108 @@ +/* RF-tech decoder + * Also marked INFRA 217S34 + * Ewig Industries Macao + * + * Copyright © 2016 Erik Johannessen + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + + +#include "rtl_433.h" +#include "pulse_demod.h" +#include "util.h" + + +static int rftech_callback(bitbuffer_t *bitbuffer) { + char time_str[LOCAL_TIME_BUFLEN]; + bitrow_t *bb = bitbuffer->bb; + uint16_t sensor_id = 0; + uint8_t button; + uint8_t battery; + double value; + data_t *data; + int r; + + local_time_str(0, time_str); + + r = bitbuffer_find_repeated_row(bitbuffer, 3, 24); + + if(r >= 0 && bitbuffer->bits_per_row[r] == 24) { + /* Example of message: + * 01001001 00011010 00000100 + * + * First byte is unknown, but probably id. + * Second byte is the integer part of the temperature. + * Third byte bits 0-3 is the fraction/tenths of the temperature. + * Third byte bit 7 is 1 with fresh batteries. + * Third byte bit 6 is 1 on button press. + * + * More sample messages: + * {24} ad 18 09 : 10101101 00011000 00001001 + * {24} 3e 17 09 : 00111110 00010111 00001001 + * {24} 70 17 03 : 01110000 00010111 00000011 + * {24} 09 17 01 : 00001001 00010111 00000001 + * + * With fresh batteries and button pressed: + * {24} c5 16 c5 : 11000101 00010110 11000101 + * + */ + sensor_id = bb[r][0]; + value = (bb[r][1] & 0x7f) + (bb[r][2] & 0x0f) / 10.0; + if(bb[r][1] & 0x80) value = -value; + + battery = (bb[r][2] & 0x80) == 0x80; + button = (bb[r][2] & 0x60) != 0; + + data = data_make("time", "", DATA_STRING, time_str, + "model", "", DATA_STRING, "RF-tech", + "id", "Id", DATA_INT, sensor_id, + "battery", "Battery", DATA_STRING, battery ? "OK" : "LOW", + "button", "Button", DATA_INT, button, + "temperature", "Temperature", DATA_FORMAT, "%.01f C", DATA_DOUBLE, value, + NULL); + + data_acquired_handler(data); + + return 1; + } + + return 0; +} + +/* + * List of fields to output when using CSV + * + * Used to determine what fields will be output in what + * order for this devince when using -F csv. + * + */ +static char *csv_output_fields[] = { + "time", + "model", + "id", + "battery", + "button", + "temperature", + NULL +}; + +/* + * r_device - registers device/callback. see rtl_433_devices.h + * + */ + +r_device rftech = { + .name = "RF-tech", + .modulation = OOK_PULSE_PPM_RAW, + .short_limit = 3500, + .long_limit = 5000, + .reset_limit = 10000, + .json_callback = &rftech_callback, + .disabled = 1, + .demod_arg = 0, + .fields = csv_output_fields, +};