mirror of
https://github.com/esphome/esphome.git
synced 2025-03-15 07:08:20 +00:00
Temp&humidity have accuracy of 1 decimal places
Co-Authored-By: Otto Winter <otto@otto-winter.com>
This commit is contained in:
parent
3bff3378dd
commit
d882a631fa
@ -41,7 +41,7 @@ void AM2320Component::update() {
|
|||||||
temperature = (data[4] & 0x80) ? -temperature : temperature;
|
temperature = (data[4] & 0x80) ? -temperature : temperature;
|
||||||
float humidity = ((data[2] << 8) + data[3]) / 10.0;
|
float humidity = ((data[2] << 8) + data[3]) / 10.0;
|
||||||
|
|
||||||
ESP_LOGD(TAG, "Got temperature=%.2f°C humidity=%.2f%%", temperature, humidity);
|
ESP_LOGD(TAG, "Got temperature=%.1f°C humidity=%.1f%%", temperature, humidity);
|
||||||
if (this->temperature_sensor_ != nullptr)
|
if (this->temperature_sensor_ != nullptr)
|
||||||
this->temperature_sensor_->publish_state(temperature);
|
this->temperature_sensor_->publish_state(temperature);
|
||||||
if (this->humidity_sensor_ != nullptr)
|
if (this->humidity_sensor_ != nullptr)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user