Fixed type mismatch between result_ field and preference of integration sensor (#1178)

This commit is contained in:
Frank Bakker 2020-07-23 23:40:40 +02:00 committed by GitHub
parent 1b2de953d0
commit a5e1f8fe19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -10,7 +10,9 @@ static const char *TAG = "integration";
void IntegrationSensor::setup() {
if (this->restore_) {
this->rtc_ = global_preferences.make_preference<float>(this->get_object_id_hash());
this->rtc_.load(&this->result_);
float preference_value = 0;
this->rtc_.load(&preference_value);
this->result_ = preference_value;
}
this->last_update_ = millis();