2 * Also marked INFRA 217S34
3 * Ewig Industries Macao
5 * Copyright © 2016 Erik Johannessen
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
15 #include "pulse_demod.h"
19 static int rftech_callback(bitbuffer_t *bitbuffer) {
20 char time_str[LOCAL_TIME_BUFLEN];
21 bitrow_t *bb = bitbuffer->bb;
22 uint16_t sensor_id = 0;
29 local_time_str(0, time_str);
31 r = bitbuffer_find_repeated_row(bitbuffer, 3, 24);
33 if(r >= 0 && bitbuffer->bits_per_row[r] == 24) {
34 /* Example of message:
35 * 01001001 00011010 00000100
37 * First byte is unknown, but probably id.
38 * Second byte is the integer part of the temperature.
39 * Third byte bits 0-3 is the fraction/tenths of the temperature.
40 * Third byte bit 7 is 1 with fresh batteries.
41 * Third byte bit 6 is 1 on button press.
43 * More sample messages:
44 * {24} ad 18 09 : 10101101 00011000 00001001
45 * {24} 3e 17 09 : 00111110 00010111 00001001
46 * {24} 70 17 03 : 01110000 00010111 00000011
47 * {24} 09 17 01 : 00001001 00010111 00000001
49 * With fresh batteries and button pressed:
50 * {24} c5 16 c5 : 11000101 00010110 11000101
54 value = (bb[r][1] & 0x7f) + (bb[r][2] & 0x0f) / 10.0;
55 if(bb[r][1] & 0x80) value = -value;
57 battery = (bb[r][2] & 0x80) == 0x80;
58 button = (bb[r][2] & 0x60) != 0;
60 data = data_make("time", "", DATA_STRING, time_str,
61 "model", "", DATA_STRING, "RF-tech",
62 "id", "Id", DATA_INT, sensor_id,
63 "battery", "Battery", DATA_STRING, battery ? "OK" : "LOW",
64 "button", "Button", DATA_INT, button,
65 "temperature", "Temperature", DATA_FORMAT, "%.01f C", DATA_DOUBLE, value,
68 data_acquired_handler(data);
77 * List of fields to output when using CSV
79 * Used to determine what fields will be output in what
80 * order for this devince when using -F csv.
83 static char *csv_output_fields[] = {
94 * r_device - registers device/callback. see rtl_433_devices.h
100 .modulation = OOK_PULSE_PPM_RAW,
103 .reset_limit = 10000,
104 .json_callback = &rftech_callback,
107 .fields = csv_output_fields,