1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-30 14:43:51 +00:00

Fix Sun Trigger (#572)

* Fix Sun Trigger

* Fix cwww lights
This commit is contained in:
Otto Winter
2019-05-30 20:01:58 +02:00
committed by GitHub
parent 27abb38ecb
commit 3e6ae4afda
4 changed files with 5 additions and 5 deletions

View File

@@ -103,7 +103,7 @@ class SunTrigger : public Trigger<>, public PollingComponent, public Parented<Su
crossed = this->last_elevation_ >= this->elevation_ && this->elevation_ > current;
}
if (crossed) {
if (crossed && !isnan(this->last_elevation_)) {
this->trigger();
}
this->last_elevation_ = current;
@@ -111,7 +111,7 @@ class SunTrigger : public Trigger<>, public PollingComponent, public Parented<Su
protected:
bool sunrise_;
double last_elevation_;
double last_elevation_{NAN};
double elevation_;
};