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
parent b4ec84030e
commit 25d04c759c
No known key found for this signature in database
GPG Key ID: DB66C0BE6013F97E
4 changed files with 5 additions and 5 deletions

View File

@ -25,4 +25,4 @@ def to_code(config):
wwhite = yield cg.get_variable(config[CONF_WARM_WHITE]) wwhite = yield cg.get_variable(config[CONF_WARM_WHITE])
cg.add(var.set_warm_white(wwhite)) cg.add(var.set_warm_white(wwhite))
cg.add(var.set_warm_white_temperature(config[CONF_COLD_WHITE_COLOR_TEMPERATURE])) cg.add(var.set_warm_white_temperature(config[CONF_WARM_WHITE_COLOR_TEMPERATURE]))

View File

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

View File

@ -469,7 +469,7 @@
</div> </div>
<div class="footer-copyright"> <div class="footer-copyright">
<div class="container"> <div class="container">
© 2019 Copyright Otto Winter, Made with <a class="grey-text text-lighten-4" href="https://materializecss.com/" target="_blank">Materialize</a> © 2019 Copyright ESPHome, Made with <a class="grey-text text-lighten-4" href="https://materializecss.com/" target="_blank">Materialize</a>
<a class="grey-text text-lighten-4 right" href="{{ docs_link }}" target="_blank" rel="noreferrer">ESPHome {{ version }} Documentation</a> <a class="grey-text text-lighten-4 right" href="{{ docs_link }}" target="_blank" rel="noreferrer">ESPHome {{ version }} Documentation</a>
</div> </div>
</div> </div>

View File

@ -65,7 +65,7 @@
</div> </div>
<div class="footer-copyright"> <div class="footer-copyright">
<div class="container"> <div class="container">
© 2019 Copyright Otto Winter, Made with <a class="grey-text text-lighten-4" href="https://materializecss.com/" target="_blank">Materialize</a> © 2019 Copyright ESPHome, Made with <a class="grey-text text-lighten-4" href="https://materializecss.com/" target="_blank">Materialize</a>
<a class="grey-text text-lighten-4 right" href="{{ docs_link }}" <a class="grey-text text-lighten-4 right" href="{{ docs_link }}"
target="_blank">ESPHome {{ version }} Documentation</a> target="_blank">ESPHome {{ version }} Documentation</a>
</div> </div>