Astro binding for Islamic Azan Time

This tutorial might be useful. Islamic Prayers - Time calculations and rules with audio and video

It uses a third party Python library instead of Astro though. I know of no attempt to use Astro for this.

If the Atro binding provides the information you need though I see no reason why it can’t be used instead.

An overall approach would be as follows:

  • trigger the rule every minute or every few seconds (you need this so that the rule continues to run over night where both the sun and moon are down (elevation/angle is 0). How often you trigger depends on how precise you want the rule to run. Every second might be too much though.
  • in the rule gather the information you need from the Astro binding (Items of through the Astro Actions) and add the logic necessary to determine which Azan time you are in
  • update an Item when the Azan time changes with the new period name
  • anything that needs to react to the start of an Azan time should trigger on changes the the Azan time

Another approach could be:

  • a little after midnight (Astro calculates the new days solar and lunar events ten seconds after midnight) and on OH startup trigger a rule that calcualtes the Azan times for the new day
  • use Time Based State Machine [4.0.0.0;4.9.9.9] with those Items to command the Azan Item when a new one starts

Another approach could be the same as the previous one only instead of the rule template, create one rule per Azan that uses the DateTime Items with the Azan times to trigger rules using a Time is <Item>.

1 Like