Fix use of optional<T> (#5091)

This commit is contained in:
Sergey Dudanov 2023-07-13 00:44:30 +04:00 committed by GitHub
parent e4a640844c
commit eb859e83f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -11,7 +11,7 @@ void TemplateBinarySensor::setup() {
return;
if (this->f_ != nullptr) {
this->publish_initial_state(*this->f_());
this->publish_initial_state(this->f_().value_or(false));
} else {
this->publish_initial_state(false);
}