Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Aldi Sempre 4-AH0423-4 temperature/rain sensor #2716

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions src/devices/auriol_4ld5661.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** @file
Auriol 4-LD5661/4-LD5972/4-LD6313 sensors.
Auriol 4-LD5661/4-LD5972/4-LD6313, Sempre 4-AH0423-4 sensors.

Copyright (C) 2021 Balazs H.
Copyright (C) 2023 Peter Soos
Expand All @@ -19,12 +19,14 @@ See also issues #1857, #2631 and PR #2633

Data layout:

II B F CC TTT F RRRRRR
1a 80 88 f0 00 14 5
00011010 10000000 10001000 11110000 00000000 00010100 0101
IIIIIIII B?CCTTTT TTTTTTTT FFFFRRRR RRRRRRRR RRRRRRRR RRRR

- I: id, 8 bit: factory (hard)coded random ID
- B: battery, 1 bit: 1=OK, 0=LOW
- F: flag, 1 bit: unknown yet
- C: channel, 2 bit: 0=CH1, 1=CH2, 2=CH3
- ?: flag, 1 bit: seems to always 0
- C: channel, 2 bit: seems to be a hardcoded channel, 0 on auriol, 3 on sempre
- T: temperature, 12 bit: 2's complement, scaled by 10
- F: 4 bit: seems to be 0xf constantly, a separator between temp and rain
- R: rain sensor, probably the remaining 24 bit: a counter for every 0.3 mm (4-LD5661) or 0.242 mm (4-LD6313)
Expand All @@ -45,10 +47,9 @@ static int auriol_4ld5661_decode(r_device *decoder, bitbuffer_t *bitbuffer)

uint8_t *b = bitbuffer->bb[i];
int id = b[0];
int battery = b[1] & 0x80;
int channel = ((b[1] & 0x30) >> 4) + 1;
int batt_ok = b[1] >> 7;

if (b[3] != 0xf0) {
if (b[3] != 0xf0 || (b[1] & 0x40) != 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will ignore the two bits. But don't we want to check that it's 0 or 3? I.e. 1 or 2 are invalid.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depends, no idea if there are other brands of this rain meter out there that would use either ch1 or ch2 :/

ret = DECODE_FAIL_MIC;
continue;
}
Expand Down Expand Up @@ -76,8 +77,7 @@ static int auriol_4ld5661_decode(r_device *decoder, bitbuffer_t *bitbuffer)
data_t *data = data_make(
"model", "Model", DATA_STRING, "Auriol-4LD5661",
"id", "ID", DATA_FORMAT, "%02x", DATA_INT, id,
"channel", "Channel", DATA_INT, channel,
"battery_ok", "Battery", DATA_INT, !!battery,
"battery_ok", "Battery OK", DATA_INT, batt_ok,
"temperature_C", "Temperature", DATA_FORMAT, "%.01f C", DATA_DOUBLE, temp_c,
"rain_mm", "Rain", DATA_FORMAT, "%.01f mm", DATA_DOUBLE, rain,
"rain", "Rain tips", DATA_INT, rain_raw,
Expand All @@ -94,7 +94,6 @@ static int auriol_4ld5661_decode(r_device *decoder, bitbuffer_t *bitbuffer)
static char const *const output_fields[] = {
"model",
"id",
"channel",
"battery_ok",
"temperature_C",
"rain_mm",
Expand Down
Loading