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

move the ith20r inkbird sensor to use battery_ok and the correct float range for the battery value #2596

Merged
Merged
Changes from all commits
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
10 changes: 5 additions & 5 deletions src/devices/inkbird_ith20r.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ static int inkbird_ith20r_callback(r_device *decoder, bitbuffer_t *bitbuffer)
uint32_t subtype = (msg[3] << 24 | msg[2] << 16 | msg[1] << 8 | msg[0]);
int sensor_num = msg[4];
uint16_t word56 = (msg[6] << 8 | msg[5]);
int battery = msg[7];
float battery_ok = msg[7] * 0.01f;
uint16_t sensor_id = (msg[9] << 8 | msg[8]);
float temperature = ((int16_t)(msg[11] << 8 | msg[10])) * 0.1f;
float temperature_ext = ((int16_t)(msg[13] << 8 | msg[12])) * 0.1f;
Expand All @@ -115,12 +115,12 @@ static int inkbird_ith20r_callback(r_device *decoder, bitbuffer_t *bitbuffer)
data = data_make(
"model", "", DATA_STRING, "Inkbird-ITH20R",
"id", "", DATA_INT, sensor_id,
"battery", "Battery", DATA_INT, battery,
"battery_ok", "Battery", DATA_DOUBLE, battery_ok,
"sensor_num", "", DATA_INT, sensor_num,
"mic", "Integrity", DATA_STRING, "CRC",
"temperature_C", "Temperature", DATA_FORMAT, "%.1f C", DATA_DOUBLE, temperature,
"temperature_2_C", "Temperature2", DATA_FORMAT, "%.1f C", DATA_DOUBLE, temperature_ext,
"humidity", "Humidity", DATA_FORMAT, "%.1f %%", DATA_DOUBLE, humidity,
"mic", "Integrity", DATA_STRING, "CRC",
NULL);
/* clang-format on */

Expand All @@ -131,12 +131,12 @@ static int inkbird_ith20r_callback(r_device *decoder, bitbuffer_t *bitbuffer)
static char const *const output_fields[] = {
"model",
"id",
"battery",
"battery_ok",
"sensor_num",
"mic",
"temperature_C",
"temperature_2_C",
"humidity",
"mic",
NULL,
};

Expand Down
Loading