Skip to content

Commit

Permalink
move the ith20r inkbird sensor to use battery_ok and the correct floa…
Browse files Browse the repository at this point in the history
…t range for the battery value
  • Loading branch information
triplepoint committed Aug 12, 2023
1 parent 9e0fb41 commit ddc0524
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 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 = 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,7 +115,7 @@ 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_FORMAT, "%.1f %%", DATA_DOUBLE, battery,
"sensor_num", "", DATA_INT, sensor_num,
"mic", "Integrity", DATA_STRING, "CRC",
"temperature_C", "Temperature", DATA_FORMAT, "%.1f C", DATA_DOUBLE, temperature,
Expand Down

0 comments on commit ddc0524

Please sign in to comment.