Skip to content

Commit

Permalink
Reduce false skylink messages and default to not publishing unparsed …
Browse files Browse the repository at this point in the history
…messages
  • Loading branch information
Northern Man authored and Northern Man committed May 27, 2021
1 parent b4a1cc0 commit e03f689
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 44 deletions.
91 changes: 51 additions & 40 deletions src/rtl_433/devices/skylink_ha-434tl.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,46 +74,57 @@

static int skylink_motion_callback(r_device *decoder, bitbuffer_t *bitbuffer)
{
data_t *data;
uint8_t *b;
int code;
int motion;
int raw;
char code_str[6];
char raw_str[6];

for (int i = 0; i < bitbuffer->num_rows; ++i)
{
b = bitbuffer->bb[i];
if (bitbuffer->bits_per_row[i] != 17)
continue;

{

// [01] {17} 5e 3e 80 : 01011110 00111110 1 -- No motion
// [01] {17} be 3e 80 : 10111110 00111110 1 -- Motion

motion = (b[0] >> 5);
raw = code = ((b[0]) << 12) | (b[1] << 4) | (b[2] >> 4);
code = ((b[0] & 0x1F) << 12) | (b[1] << 4) | (b[2] >> 4);

sprintf(code_str, "%05x", code);
sprintf(raw_str, "%05x", raw);
motion = (motion == 5);

/* Get time now */
data = data_make(
"model", "", DATA_STRING, "Skylink HA-434TL motion sensor",
"motion", "", DATA_STRING, motion ? "true" : "false",
"id", "", DATA_STRING, code_str,
"raw", "", DATA_STRING, raw_str,
NULL);

decoder_output_data(decoder, data);
return 1;
}
}
return 0;
data_t *data;
uint8_t *b;
int code;
int motion;
int raw;
char code_str[6];
char raw_str[6];

for (int i = 0; i < bitbuffer->num_rows; ++i)
{
b = bitbuffer->bb[i];
if (bitbuffer->bits_per_row[i] != 17)
continue;

{

if (decoder->verbose > 1)
fprintf(stderr, "%s: rows %d bits %d\n", __func__, bitbuffer->num_rows, bitbuffer->bits_per_row[i]);
// [01] {17} 5e 3e 80 : 01011110 00111110 1 -- No motion
// [01] {17} be 3e 80 : 10111110 00111110 1 -- Motion

motion = (b[0] >> 5);
raw = code = ((b[0]) << 12) | (b[1] << 4) | (b[2] >> 4);
code = ((b[0] & 0x1F) << 12) | (b[1] << 4) | (b[2] >> 4);

if (code == 0)
return 0; // Abort early for bad signal

sprintf(code_str, "%05x", code);
sprintf(raw_str, "%05x", raw);

if ((motion != 5) && (motion != 2))
{
return 0; // Abort early for bad signal
}

motion = (motion == 5);

/* Get time now */
data = data_make(
"model", "", DATA_STRING, "Skylink HA-434TL motion sensor",
"motion", "", DATA_STRING, motion ? "true" : "false",
"id", "", DATA_STRING, code_str,
"raw", "", DATA_STRING, raw_str,
NULL);

decoder_output_data(decoder, data);
return 1;
}
}
return 0;
}

static char *output_fields[] = {
Expand Down
4 changes: 0 additions & 4 deletions src/rtl_433_ESP.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@
#define MINRSSI -82 // DB above noise level
#endif

#ifndef SUPPRESS_UNPARSED
#define PUBLISH_UNPARSED
#endif

#define RECEIVER_BUFFER_SIZE 2 // Pulse train buffer count
// #define MAXPULSESTREAMLENGTH 750 // Pulse train buffer size
#define MINIMUM_PULSE_LENGTH 50 // signals shorter than this are ignored in interupt handler
Expand Down

0 comments on commit e03f689

Please sign in to comment.