Skip to content

Commit

Permalink
Fix Inkbird-ITH20R battery_ok key and range (#2596)
Browse files Browse the repository at this point in the history
  • Loading branch information
triplepoint committed Aug 13, 2023
1 parent 9e0fb41 commit e7682f8
Showing 1 changed file with 5 additions and 5 deletions.
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

0 comments on commit e7682f8

Please sign in to comment.