Ephemerides 13 readings
- Sun phase
- Sun altitude
- Sun azimuth
- Day length
- Next solar event
- Next solar event at
- Moon phase
- Moon illumination
- Moon above horizon
- Moon age
- Moon altitude
- Moon azimuth
- Moon distance
App for Homey Pro
Every twilight, golden hour and moon phase for your home, computed offline.
Available v1.5.1
Where Homey only knows sunrise and sunset, this app gives the fourteen instants of the day, the three twilights, the golden hour and the blue hour, plus the position of the sun and the moon at any moment, with phase, illumination and age. A second device adds the French public holidays, mainland or Alsace-Moselle. At high latitudes, and even in Paris in summer, some twilights do not exist: the app says so instead of inventing a time. It also dates, to the minute, the equinoxes and solstices and the new and full moons, supermoons and blue moons included, and announces the next clock change.
View on the Homey App StoreEverything is computed on the hub, offline, in the hub's time zone. The positions of the sun and the moon come from suncalc, a library that follows Jean Meeus's algorithms (Astronomical Algorithms); the equinoxes, the solstices, the new and full moons and the moon's distance, which suncalc does not provide, are computed by the app from the matching chapters of the same book, and checked against its worked examples. Since suncalc's documentation still describes an earlier version, its actual behaviour was checked step by step: three gaps between what it states and what it returns had to be corrected before the app said anything true, and they are described below.
01
λ = L₀ + C − 0,00569° − 0,00478° · sin Ω · sin δ = sin ε · sin λ
The computation starts from the number of days since noon on 1 January 2000, corrected by ΔT, the gap between clock time and the time that governs the motion of the sky. The sun's mean longitude L₀ receives the equation of the centre C, which accounts for the ellipse of the Earth's orbit, then two small corrections, aberration and nutation: this is the apparent ecliptic longitude λ. The tilt of the Earth's axis ε, a little over 23.4°, carries it onto the celestial equator and gives the declination δ and the right ascension. With the local sidereal time, these give the hour angle, then the azimuth and the height.
02
H = θ − α = 0
Solar noon is the moment the sun crosses the local meridian, when its hour angle H, the gap between the sidereal time θ and its right ascension α, falls to zero. suncalc starts from the mean noon of the longitude, recomputes the sun's position at the instant found and corrects it by the remaining angle, three times. The gap between this true noon and noon by mean time, what is called the equation of time, is thus built into the result without being computed separately. The nadir, or solar midnight, is twelve hours away from it.
03
cos H₀ = (sin h₀ − sin φ · sin δ) ⁄ (cos φ · cos δ) · h₀ = −0,833° − 2,076′ · √a
Official sunrise and sunset are the moments when the centre of the sun is at −0.833° of geometric height: 34 minutes of arc of refraction, which lift the sun's image, and 16 of semi-diameter, so that the upper limb touches the horizon. The formula gives the hour angle H₀ on either side of solar noon, for the latitude φ and the declination δ, then two successive corrections account for the sun's motion in the meantime. If the observer's height a, in metres, is set, the horizon dips by 2.076 minutes of arc times its square root: seen from a tower, the sun rises earlier. When the cosine falls outside the range from −1 to 1, there is no sunrise or sunset that day: polar night if the sun stays below −0.833° at noon, midnight sun otherwise.
04
hauteur géométrique = hauteur apparente − réfraction(max(hauteur géométrique, 0))
suncalc returns an apparent height, atmospheric refraction included, while sunrise, sunset and the twilights are defined on the geometric height, that of the disc's true centre. But its refraction formula first clamps the height to zero, which adds a constant 0.484° everywhere below the horizon, at −18° as much as at −1°. Exposing the apparent height would have made a “below −6°” threshold fire two minutes after civil dawn, for the same definition. Below the horizon, removing the refraction is thus a plain subtraction; above it, where it varies with height, it takes iteration, and a single pass crossing the kink oscillates without converging: six are needed.
05
montant = maintenant < midi solaire
A height of −3° is a dawn in the morning, a dusk in the evening: the sky's phase therefore depends on which way the sun is moving, not on its height alone. That direction cannot be read off sunrise, which does not exist in every season or at every latitude, but off solar noon, the only reference that stays defined even on a day of midnight sun or polar night.
06
événement absent = null, undefined, ou Invalid Date selon le champ
An event that does not happen that day, an astronomical dusk in the middle of a Nordic summer, say, does not always take the same absent shape: depending on the field, suncalc returns `null`, `undefined`, or an invalid date. A plain `instanceof Date` does not catch all three, and reading the time of an invalid date throws rather than signals it. All three shapes are therefore reduced to one single signal before reaching the rest of the code.
07
jour ≥ 6° > heure dorée ≥ −0,833° > crépuscule civil ≥ −6° > nautique ≥ −12° > astronomique ≥ −18° > nuit
Ten phases follow one another between full daylight and full night, each bounded by a geometric height of the sun: daylight above 6°, golden hour down to the official sunrise at −0.833°, then the three twilights, civil, nautical and astronomical, at −6°, −12° and −18°, before night. The same ladder, read the other way, gives the morning phases. This is the ladder the tile's own capability reads, its ten labels coming from the manifest rather than being duplicated in the translations.
08
−0,833° ≤ h < 6° · −6° ≤ h < −4°
The golden hour is when the sun, low on the horizon, lights things at a slant: the app bounds it between the official sunrise, −0.833°, and 6° of height, so that it contains sunrise and sunset themselves. The blue hour is the darkest part of civil twilight, between −6° and −4°, when the sky stays blue without the sun. Both are read on the same geometric height as the twilights; the daylight band, the capabilities and the Flow cards use the same bounds, and therefore say the same thing at the same moment.
09
D = t↓ − t↑ · ΔD = D(j) − D(j − 1)
Day length runs from official sunrise to sunset, computed for each civil day at local noon, in the hub's time zone. Its variation is the difference from the day before, to the second: that is what the tile reports as minutes and seconds gained or lost. Midnight sun counts as twenty-four hours and polar night as zero: these are real values, not gaps, and the yearly curve holds them flat without overshooting.
10
JDE = JDE₀ + 0,00001 · S ⁄ Δλ · Δλ = 1 + 0,0334 · cos W + 0,0007 · cos 2W · W = 35 999,373° · T − 2,47°
They follow chapter 27 of Meeus. A polynomial first gives a mean instant for each of the four, valid from the year 1000 to the year 3000; twenty-four periodic terms, whose sum is S, then correct it, weighted by Δλ. The result is in ephemeris time: ΔT is subtracted, taken as a fixed 69 seconds, whose real error stays below ten seconds until 2035. A test checks it against Meeus's worked example, the June solstice of 1962, then against the published instants for 2026: all four land within two minutes.
11
k = (1 + cos i) ⁄ 2 · phase ∈ [0, 1[, 0 = nouvelle lune, 0,5 = pleine lune · âge = phase × 29,530588853 j
The illumination is the fraction of the disc lit as seen from the Earth; it follows from the phase angle i, the angle between the sun and the Earth as seen from the moon, computed from the positions of both bodies. suncalc returns the lunar phase as a fraction of the cycle between 0 and 1, where 0 is new moon and 0.5 is full moon. That single fraction is turned into one of the eight usual names, new moon, waxing crescent, first quarter…, by a plain series of boundaries. Multiplied by the mean length of a lunation, 29.530588853 days, it also gives the moon's age, with no separate calculation: the same fraction carries both pieces of information.
12
JDE = 2 451 550,09766 + 29,530588861 · k + … · k entier : ● · k + ½ : ○
The phase says where the moon is in its cycle, not the exact moment it becomes full. That moment follows chapter 49 of Meeus: from a lunation number k, counted from the new moon of 6 January 2000, a formula gives the mean instant, which twenty-five terms tied to the orbits of the moon and the sun, then fourteen planetary terms, correct. It is then dated in the hub's time zone, which matters near midnight. A test checks it against Meeus's worked example, the new moon of February 1977, then against the published new and full moons of 2026, thirteen full moons among them: within two minutes.
13
r = 385 000,56 km + Σ rᵢ · cos(dᵢ·D + mᵢ·M + m′ᵢ·M′ + fᵢ·F) · ○ et r < 360 000 km → super-lune
The distance from the centre of the Earth to the centre of the moon follows chapter 47 of Meeus: a mean value of 385,000.56 km, corrected by forty-six terms that depend on the elongation D, the mean anomalies of the sun M and of the moon M′, and the argument of latitude F. A test checks it against Meeus's worked example, 368,409.7 km on 12 April 1992. A full moon is called a supermoon when the moon is closer than 360,000 km at the very instant of full moon, the most widely used threshold. The one on 24 December 2026, at 356,740 km, is one; the one on 24 November, at 360,768 km, is not, by 768 km.
14
2ᵉ ○ du mois civil, dans le fuseau de la box
A blue moon is the second full moon in the same calendar month. The month is counted in the hub's time zone, so the same full moon can be blue in one place and not in another: the one on 31 December 2028 at 16:48 UTC is December's second in Paris, but falls on 1 January in Kiritimati, at UTC+14, where it is January's first. In 2026, the full moon of 31 May, which follows the one of 1 May, is blue; it is also one of the most distant, at more than 406,000 km.
15
h = h_géo − arcsin(R ⁄ r · cos h_géo)
The moon is close enough for the observer's position to matter: seen from the surface rather than from the centre of the Earth, it appears lower, by nearly a degree at the horizon. This parallax is subtracted using its current distance, R being the Earth's radius and r the distance. Moonrise and moonset are the moments the upper limb of the disc touches the horizon, refraction included: suncalc looks for them hour by hour by parabolic interpolation, then refines them twice. Since it always scans one UTC day, the app queries every UTC day that the civil day overlaps, so as not to lose a moonrise that falls on the other side of UTC midnight.
16
A = atan2(sin H, cos H · sin φ − tan δ · cos φ) + 180°
Azimuth is counted in degrees from north towards east, and height is geometric, as everywhere in the app. The compass rounds the azimuth to the nearest eighth of the compass rose, from north to north-west, and the page writes it with the letters of the hub's language, O for west in French, W in English. A body counts as up above −0.833°.
17
décalage(t) ≠ décalage(t + 1 j) → dichotomie, arrondi à la minute
An astronomical season runs from one equinox or solstice to the next; its name depends on the hemisphere, and the March equinox opens spring in the north, autumn in the south. The next clock change is not hard-coded: the app reads the hub's time zone database day by day, over a little more than a year, narrows down the instant by bisection and rounds it to the minute. A country that gives up daylight saving stops showing one as soon as that database knows.
18
h☉ < −18° · gêne : h☾ > −0,833° et k ≥ 15 %
The night chosen is the current astronomical night, sun below −18°, or the next one starting within twenty-four hours. The moon is followed through it every five minutes; it gets in the way if it is up during the night and lit at 15 % or more, its illumination k being taken at the middle of the night. Below that, a thin crescent lights little more than the sky itself, and counting it would deprive the observer of the best nights of the month. Above roughly 48.5° of latitude, summer has no astronomical night: the tile says so. Clouds are not taken into account, since nothing leaves the hub.
19
algorithme grégorien anonyme (Meeus, Jones, Butcher), confronté à l'algorithme de Gauss de 1900 à 2200
The eleven public holidays of the general regime all follow from a fixed date or from Easter Sunday, computed offline by the anonymous Gregorian algorithm, valid for any year of the Gregorian calendar. Rather than taking it on trust, a test checks it against Gauss's algorithm, formulated independently, across the three hundred and one years from 1900 to 2200: the two agree every single year. Alsace-Moselle adds two days to the general regime, Good Friday and 26 December, under local law.
20
instant local = mur UTC − décalage(fuseau), décalage recalculé deux fois après un premier essai
Scheduling an announcement for six in the evening local time requires knowing that zone's offset at that very instant, yet the offset itself depends on the instant still being sought, because of daylight saving. The first guess starts from a wall-clock hour treated as UTC, then the real offset is recomputed at that corrected instant, twice in a row: the process converges even on a clock-change day, and a test checks it over three hundred and sixty-five days and three time zones.
Homey writes an automation in three parts: when something happens, and if a condition holds, then do this. Anything on a lighter background, such as radius, is a parameter you set in the Flow. Every condition also exists in its negative form, which Homey flips with one click.
When 8
And 12
Then 1
Ephemerides 1.5.0 brings seven new dashboard widgets for the sun, the moon and the seasons.
All astronomical dates and times are calculated on your Homey itself, with no internet connection.
Add a widget from your dashboard, pick one of your Ephemerides places in the list (leave it empty to show the first one), and choose a background.