mirror of
https://github.com/esphome/esphome.git
synced 2024-11-14 02:58:11 +01:00
Implements is_above_horizon()
Returns `true` when Sun is above the horizon (using an optional elevation parameter for horizon).
This commit is contained in:
parent
58d028ac13
commit
7fe88f9968
1 changed files with 3 additions and 0 deletions
|
@ -59,6 +59,9 @@ class Sun {
|
|||
void set_latitude(double latitude) { location_.latitude = latitude; }
|
||||
void set_longitude(double longitude) { location_.longitude = longitude; }
|
||||
|
||||
// Check if the sun is above the horizon, with a default elevation angle of -0.83333 (standard for sunrise/set).
|
||||
bool is_above_horizon(double elevation = -0.83333) { return this->elevation() > elevation; }
|
||||
|
||||
optional<ESPTime> sunrise(double elevation);
|
||||
optional<ESPTime> sunset(double elevation);
|
||||
optional<ESPTime> sunrise(ESPTime date, double elevation);
|
||||
|
|
Loading…
Reference in a new issue