Skip to content

Commit

Permalink
Update driver_fhkvdataiii.h - get_temp_room_c
Browse files Browse the repository at this point in the history
  • Loading branch information
SzczepanLeon authored Jan 6, 2024
1 parent 902154c commit 79dc510
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion driver_fhkvdataiii.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ struct FhkvdataIII: Driver

add_to_map(ret_val, "current_hca", this->get_current_hca(telegram));
add_to_map(ret_val, "previous_hca", this->get_previous_hca(telegram));
add_to_map(ret_val, "temp_room_c", this-get_temp_room_c(telegram));

if (ret_val.size() > 0) {
return ret_val;
Expand Down Expand Up @@ -45,4 +46,16 @@ struct FhkvdataIII: Driver

return ret_val;
};
};

esphome::optional<double> get_temp_room_c(std::vector<unsigned char> &telegram) {
esphome::optional<double> ret_val{};
size_t i = 20;
if((uint32_t)telegram[8] == 0x94) { // dll_version
i++;
}

ret_val = (((uint32_t)telegram[i+1] << 8) + (uint32_t)telegram[i])/100.0;

return ret_val;
};
};

0 comments on commit 79dc510

Please sign in to comment.