Skip to content

Commit

Permalink
fix negative temperature for pmsx003 (esphome#6083)
Browse files Browse the repository at this point in the history
* fix negative temperature for pmsx003

* Update esphome/components/pmsx003/pmsx003.cpp
  • Loading branch information
ssieb authored Jan 12, 2024
1 parent aa04a3c commit ed2ab9e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion esphome/components/pmsx003/pmsx003.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ void PMSX003Component::send_command_(uint8_t cmd, uint16_t data) {
void PMSX003Component::parse_data_() {
switch (this->type_) {
case PMSX003_TYPE_5003ST: {
float temperature = this->get_16_bit_uint_(30) / 10.0f;
float temperature = (int16_t) this->get_16_bit_uint_(30) / 10.0f;
float humidity = this->get_16_bit_uint_(32) / 10.0f;

ESP_LOGD(TAG, "Got Temperature: %.1f°C, Humidity: %.1f%%", temperature, humidity);
Expand Down

0 comments on commit ed2ab9e

Please sign in to comment.