diff --git a/esphome/components/sgp30/sgp30.cpp b/esphome/components/sgp30/sgp30.cpp index d70c47a938b..1d23e3eab0f 100644 --- a/esphome/components/sgp30/sgp30.cpp +++ b/esphome/components/sgp30/sgp30.cpp @@ -75,7 +75,8 @@ void SGP30Component::setup() { // Hash with build time and serial number // This ensures the baseline storage is cleared after OTA // Serial numbers are unique to each sensor, so multiple sensors can be used without conflict - uint32_t hash = static_cast(App.get_build_time()) ^ static_cast(this->serial_number_); + uint32_t hash = static_cast(App.get_build_time()) ^ static_cast(this->serial_number_) ^ + static_cast(this->serial_number_ >> 32); this->pref_ = global_preferences->make_preference(hash, true); if (this->store_baseline_ && this->pref_.load(&this->baselines_storage_)) { diff --git a/esphome/components/sgp4x/sgp4x.cpp b/esphome/components/sgp4x/sgp4x.cpp index 4854b9ec43b..6f21a108776 100644 --- a/esphome/components/sgp4x/sgp4x.cpp +++ b/esphome/components/sgp4x/sgp4x.cpp @@ -60,7 +60,8 @@ void SGP4xComponent::setup() { // Hash with build time and serial number // This ensures the baseline storage is cleared after OTA // Serial numbers are unique to each sensor, so multiple sensors can be used without conflict - uint32_t hash = static_cast(App.get_build_time()) ^ static_cast(this->serial_number_); + uint32_t hash = static_cast(App.get_build_time()) ^ static_cast(this->serial_number_) ^ + static_cast(this->serial_number_ >> 32); this->pref_ = global_preferences->make_preference(hash, true); if (this->pref_.load(&this->voc_baselines_storage_)) {