Skip to main content

Prayer Times smart home integration, free and open source

Prayer Times integration for Gladys Assistant

The five daily prayer times for your home, computed locally, with adhan triggers.

The times of the five daily prayers (Fajr, Dhuhr, Asr, Maghrib, Isha), plus Imsak, sunrise and midnight, computed for your home — like the Home Assistant islamic_prayer_times integration. Gladys can show them on the dashboard and start a scene at the time of a prayer, or a few minutes before.

The times are computed locally, from the position of the sun: no account, no Internet connection, nothing sent anywhere. The calculation is the one of the public Aladhan API (the service Home Assistant calls), and gives the same minute.

Developed without a real Gladys instance: feedback welcome. The integration was built against Gladys' test double and checked against real Aladhan answers and official timetables, not on a running Gladys. If something does not behave as described, please say so on the Gladys forum or in the issues.

What you need​

  • Gladys Assistant 5.2.0 or later.
  • The coordinates of your house in Gladys (Settings → Houses), or coordinates typed in the configuration of the integration.
  • The right time zone in Gladys: the times are shown in it.

At install, Gladys asks to let the integration read the location of your houses: accept, it is how it knows where the sun is for you. The coordinates never leave your Gladys and are never written in the logs.

Configuration​

Location​

  • House: the house to compute for. Empty: the first house that has coordinates.
  • Latitude / Longitude (optional): decimal degrees, a comma or a dot (for example 48,8566 and 2,3522). When both are filled, they replace the house.

Calculation method​

Pick the method of your mosque or of your country. The angles are how far the sun is below the horizon at Fajr and at Isha: the larger the angle, the earlier Fajr and the later Isha.

MethodFajrIshaNotes
Muslim World League (default)18°17°Europe, Far East, much of the US
ISNA, North America15°15°
Egyptian Survey Authority19.5°17.5°Africa, Syria, Lebanon
Umm al-Qura, Makkah18.5°90 min120 min during Ramadan
University of Karachi18°18°Pakistan, India, Bangladesh
France, UOIF12°12°Union des organisations islamiques de France
France, 15°15°15°
France, 18°18°18°as used by many mosques in France
Turkey, Diyanet18°17°with the Diyanet offsets
Dubai, Awqaf18.2°18.2°with the Awqaf offsets
Gulf region19.5°90 min
Kuwait18°17.5°
Qatar18°90 min
Singapore, MUIS20°18°
Malaysia, JAKIM20°18°
Indonesia, Kemenag20°18°
Tunisia18°18°
Russia16°15°
University of Tehran17.7°14°Maghrib 4.5°, Jafari midnight
Shia Ithna Ashari, Qum16°14°Maghrib 4°, Jafari midnight
Custom anglesyoursyours or minutes
  • Asr (school): Standard (Shafi'i, Maliki, Hanbali: shadow equal to the object) or Hanafi (shadow twice the object, about an hour later).
  • High latitudes: in summer, north of about 48° (Paris, Lille, Brussels, London…), the sky never gets dark enough for an 18° Fajr: the time is then bound to a portion of the night. Angle based (the default, as on Aladhan), Middle of the night or One seventh of the night.
  • Midnight: halfway from sunset to sunrise, or to Fajr (Jafari). By default, the convention of the method.
  • Custom method: the Fajr and Isha angles (decimals accepted), or Isha a number of minutes after Maghrib (0 keeps the angle).

Adjustments​

Minutes added to each computed time, to match the timetable of your mosque exactly (negative: earlier), from -60 to +60. Imsak is a number of minutes before Fajr (10 by default), counted from the adjusted Fajr.

Language of the names sets the names of the device features (they are frozen when the device is added) and the prayer names sent to the scenes.

The device​

Add it from the Discovery tab. One device, Prayer times, with:

FeatureValue
Imsak, Fajr, Sunrise, Dhuhr, Asr, Maghrib, Isha, Midnighttoday's time, HH:MM
Next prayerthe name of the next of the five prayers
Next prayer timeits time, HH:MM
Time to next prayerin minutes, updated every minute (no history)

After Isha, the next prayer is tomorrow's Fajr. Sunrise, Imsak and midnight are shown but are not prayers. The integration refreshes the device every minute by itself.

Dashboard widget​

Prayer times (in Dashboard → Edit → Add a widget): the next prayer and its time, the time left, the eight times of the day (past ones greyed out, the next one with a bell), the Hijri date (Umm al-Qura calendar) and the method in use. It follows the language of the dashboard.

Scene triggers​

  • Prayer time: fires at the minute of a prayer. Filter: the times to react to (empty: all eight, including Imsak, sunrise and midnight).
  • Prayer coming up: fires a chosen number of minutes before (5, 10, 15, 20, 30, 45 or 60). Filters: the times, and the number of minutes (required).

Both give the scene: the time key (fajr…), the prayer name in the configured language, the time (HH:MM), and for the second one the minutes before.

A restart of Gladys or of the integration never replays a past prayer; a time moved by a new configuration is not announced twice the same day.

Scene action​

Get the prayer times: today's or tomorrow's eight times, the next prayer, its time and the minutes left, readable by the following actions of the scene.

Configuration action​

Show today's times, in the configuration screen: the method in use and the eight times of today, to compare with your mosque's timetable before adding scenes.

Scene examples​

  • Adhan reminder: trigger Prayer time (Fajr, Dhuhr, Asr, Maghrib, Isha), action Talk on a speaker with the text “It is time for {{prayer name}}”.
  • Get ready: trigger Prayer coming up, 15 minutes, Maghrib: light the living room, send a message “Maghrib at {{time}}”.
  • Ramadan: trigger Prayer coming up, 30 minutes, Imsak: a message to every phone for the last meal before dawn.
  • Morning summary: at 7:00, action Get the prayer times, then Send a message with the times of the day.

How the times are computed​

The sun's declination and the equation of time give the solar noon (Dhuhr); the hour angle at which the sun reaches a given depression below the horizon gives Fajr and Isha, -0.833° (refraction and the solar disk) gives sunrise and sunset, and the length of a shadow gives Asr. The results are rounded to the nearest minute. The tests of the integration check them against real Aladhan answers (same minute), the official timetables of Turkey, Qatar, Dubai, Kuwait, Makkah, Singapore and Tehran, and the adhan-js library.

Nothing is fetched: the integration makes no network request at all.

Troubleshooting​

  • The status says “No location”: give your house coordinates in Settings → Houses, or type them in the configuration, then save.
  • Every time is one or two hours off: the time zone of Gladys is wrong (Settings → System).
  • A few minutes off from your mosque: check the method and the Asr school with Show today's times, then use the adjustments.
  • The scene did not start: check the filters of the trigger (for Prayer coming up, the number of minutes is required) and that the integration is running. Set LOG_LEVEL=debug to see every event fired in the logs.
  • The feature names are in the wrong language: they are frozen when the device is added: change the language, delete the device and add it again.

Limits​

  • No “Moonsighting Committee” method (seasonal angles) yet.
  • Within the polar circles, on days without sunrise or sunset, these times stay empty.
  • Talk on a speaker reads a text: playing a recorded adhan needs a speaker integration that plays an audio file.
  • The Hijri date is the Umm al-Qura calendar, which may differ by a day from the local moon sighting; it also decides when Umm al-Qura's Ramadan Isha (120 min) applies.
  • The times stay those of the configured house: there is no per-user location.

Configuration settings​

These are the settings Prayer Times asks for in its configuration screen in Gladys.

SettingTypeRequiredDescription
LocationsectionNoThe times are computed for the house of Gladys (Settings → Houses), in the time zone of Gladys. Typed coordinates win over the house.
HouseselectNoEmpty: the first house with coordinates.
Latitude (optional)stringNoDecimal degrees, north positive. With the longitude, replaces the house.
Longitude (optional)stringNoDecimal degrees, east positive.
CalculationsectionNoPick the method of your mosque or of your country. The angles are the sun depression below the horizon at Fajr and Isha.
Calculation methodselectNo
Asr (school)selectNo
High latitudesselectNoWhen the twilight lasts all night (in summer, north of about 48°), Fajr and Isha are bound to a portion of the night.
MidnightselectNo
Custom method: Fajr angle (°)stringNo
Custom method: Isha angle (°)stringNo
Custom method: Isha, minutes after MaghribnumberNo0: use the Isha angle.
AdjustmentssectionNoMinutes added to a computed time, to match the timetable of your mosque (negative: earlier).
Imsak: minutes before FajrnumberNo
Fajr (min)numberNo
Sunrise (min)numberNo
Dhuhr (min)numberNo
Asr (min)numberNo
Maghrib (min)numberNo
Isha (min)numberNo
Language of the namesselectNoNames of the device features (set when the device is added) and of the scene variables.

How to install Prayer Times in Gladys​

  1. In Gladys, open Integrations: Prayer Times appears in the catalog, next to the native integrations, with a community badge.
  2. Click Install. Gladys pulls the Docker image (ghcr.io/guim31/gladys-prayer-times:1.0.1), starts it in a sandbox isolated from the core, and generates the integration's interface (devices, discovery and configuration).
  3. Open the Configuration screen of the integration, fill in the settings, and save.
  4. You can also install it directly from its repository URL: https://github.com/guim31/gladys-prayer-times.

Prayer Times requires Gladys >=5.2.0. The catalog inside Gladys refreshes every hour, so a new version becomes available at most one hour after its release.

Not running Gladys yet? It is free and open source: follow the installation guide to get started.

About external integrations​

Prayer Times is an external integration: a community integration packaged as a Docker container and published on GitHub, that Gladys installs in one click and runs in a sandbox isolated from its core. It is published and maintained by guim31, not by the Gladys core team.

Subscribe to the Gladys Assistant newsletter

A few emails per month about new releases and project news. Sent by Pierre-Gilles Leymarie, founder of the project. Unsubscribe anytime 🙂