External integration - Astronomy (eclipses, planets, shooting stars, auroras)

Hello everyone,

Following the widgets and scenes introduced with Gladys 5.1, and after seeing @cicoub13’s ISS integration, I propose an Astronomy integration: everything happening in the sky above your home, calculated for your coordinates.

What it brings

Four dashboard widgets, displayed in each user’s language:

  • Tonight: the curve of sky quality throughout the night, the time and duration of the moonless dark sky, moon illumination, and visible planets with their times.
  • Sky Agenda: upcoming events with a countdown. You’ll find eclipses, meteor shower peaks, conjunctions, oppositions, seasons, and transits, and you can filter by type and period.
  • Auroras: the observed and forecast Kp index by NOAA, with the alert level.
  • Next Eclipse: countdown, obscuration, height of the celestial body, and time of each phase.

Six scene triggers, all emitted at the right time:

  • start or maximum of an eclipse;
  • start of the moonless dark sky;
  • meteor shower peak tonight, filterable by shower;
  • visible conjunction tonight;
  • aurora alert rising;
  • start of a season.

Each one transmits its details to the following actions: time of maximum, ZHR, separation, description ready to send…

Two scene actions: “Next sky event” and “Summary of tonight’s sky”. For example, a message every evening at 8 p.m. with the night’s program.

Six devices with historized sensors: eclipses, planets, meteor showers, observation night, seasons and orbit, auroras. They are used for graphs and threshold scenes, such as “Kp max over 24 hours greater than 6”, which event triggers cannot do.

How it works

Everything is calculated locally with the astronomy-engine library, without any key or account. The calculations use the coordinates of your Gladys home: the integration requires this access to the installation. The only outgoing connection is the NOAA space weather service for the Kp index, and it can be disabled in the configuration.

A few details:

  • eclipses are only kept if they are visible from your home;
  • meteor shower peaks are recalculated each year from the calendar of the International Meteor Organization;
  • conjunctions are searched for over 90 days, with an adjustable gap.

Installation

  • Gladys 5.1 minimum.
  • Integrations → search for “Astronomy” → Install.
  • Check that your home is located: Settings → Homes.
  • Check that the time zone is set: Settings → System.
  • In the Discovery tab, add the devices. The widgets are then found in the dashboard editor, and the triggers in the scene editor, category “Integrations”.

Repository: GitHub - guim31/gladys-astronomy · GitHub

What I haven’t done

  • The Moon has neither a dedicated device nor widget: @William-De71 has an open PR for a moon phase widget in the core, and I didn’t want to duplicate.
  • The ISS is covered by @cicoub13’s integration.
  • Sunrise and sunset are already native in Gladys.

Feedback is welcome, especially from those living at high latitudes, in the southern hemisphere, or in a time zone other than Paris: I have tested these cases, but only in simulation.

2 Likes