This commit is contained in:
Karl Lattimer
2017-01-07 20:24:59 +00:00
7 changed files with 118 additions and 6 deletions

View File

@@ -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 */

View File

@@ -73,7 +73,8 @@
DECL(kerui) \
DECL(fineoffset_wh1050) \
DECL(honeywell) \
DECL(maverick_et73x)
DECL(maverick_et73x) \
DECL(rftech)
typedef struct {

View File

@@ -87,6 +87,7 @@ add_executable(rtl_433
devices/fineoffset_wh1050.c
devices/honeywell.c
devices/maverick_et73x.c
devices/rftech.c
)

View File

@@ -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)

View File

@@ -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,

View File

@@ -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);
}

108
src/devices/rftech.c Normal file
View File

@@ -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,
};