mirror of
https://github.com/esphome/esphome.git
synced 2024-11-10 09:17:46 +01:00
fix negative temperature for pmsx003 (#6083)
* fix negative temperature for pmsx003 * Update esphome/components/pmsx003/pmsx003.cpp
This commit is contained in:
parent
2cda6462f3
commit
354314dbf3
1 changed files with 1 additions and 1 deletions
|
@ -195,7 +195,7 @@ void PMSX003Component::send_command_(uint8_t cmd, uint16_t data) {
|
||||||
void PMSX003Component::parse_data_() {
|
void PMSX003Component::parse_data_() {
|
||||||
switch (this->type_) {
|
switch (this->type_) {
|
||||||
case PMSX003_TYPE_5003ST: {
|
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;
|
float humidity = this->get_16_bit_uint_(32) / 10.0f;
|
||||||
|
|
||||||
ESP_LOGD(TAG, "Got Temperature: %.1f°C, Humidity: %.1f%%", temperature, humidity);
|
ESP_LOGD(TAG, "Got Temperature: %.1f°C, Humidity: %.1f%%", temperature, humidity);
|
||||||
|
|
Loading…
Reference in a new issue