In this post we will Homebridge along with IFTTT to announce the Prayer calls to my Homepods. To achieve this I am using Homebrige "Programmable HTTP Switch" plugin. In IFTTT, I setup an applet that has MuslimPro service in the "IF" to notify on the Prayer times. In the "Then" section, I used the webhook service to tigger the HTTP Switch in my homebridge which then triggers my automation in Homekit to announce the athan on my homepods.
For the webhook to work, you either can use your IP which might involve port forwarding in your router (not covered in this post), or in my case I have DDNS setup that would direct the traffic to my domain name using reverse proxy.
Download and install for your platform here: https://homebridge.io
I have it installed on my Synology NAS
Once installed, you should be able to access your homebridge via http://localhost:8581/
In the plugins page search for "Programmable HTTP Switch"
Configure plugin
Accessory: fajr
identifier: fajr
Button name: fajr
identifier: fajr
supported actions: leave only singlePress checked.
change port to 3001 (you can use the default, i needed to change it as i have another service using the default port).
click save
I have added 5 buttons for the 5 prayer times.
Restart to homebridge to apply changes.
Add to your apple home by scanning the qr code on the status page.
Setting up Apple home
In Apple Home App, create a custom scene. I have created a scene per prayer call.
Add your speaker and configure it to play. Search for an Athan on apple music.
Find http switch in your apple home (fajr switch in this example); Under single click, configure it to run the scene you just created.
On my Mac I was able to test If the athan would be triggered by running below command from my terminal:
curl -i -X PUT -H 'Content-Type: application/json' -d '{"action": "singlePress"}' https://MY_URL/accessories/fajr/buttons/fajr
On IFTTT create an applet and search for muslim prayer time. Set that up to your liking.
Then on the Then That look for WebHooks.
Under URL type; https://MY_URL/accessories/fajr/buttons/fajr
Under Method select PUT
Content Type : application/json
Additional Headers : leave blank
Body:
{ "action": "singlePress" }
I have created 5 applets for each prayer time, each one is pointing to their respective prayer call button in my homebridge http switch plugin. This way I can choose different Athan for every Prayer call (just being fancy)