[RELEASE] Adhan Player app

Update:

Changed the “custom time of day to refresh adhan times” to 12:35am, originally had it at 10:00pm. So the bug may have been user(me) generated :slight_smile:
Increased the rules delay to 2 seconds.
Will report back in couple days, hopefully everything works good.

Any updates?

It’s working great, only few times it didn’t . I’m trying to figure out what happened


This error is not related to the adhan app, right?

I don't think so, if it were from the app, it would probably say app:<some number>. If you deselect the rules to run during the adhan and the issue persists, it might be related to the app.

Are you using Google speakers or Alexa speakers or something else?

I’m using google, it only missed 4 times in the past week.The adhan app logs doesn’t show any errors, what I posted above was the speaker logs.

Hm. I am not sure. What are the rules you're running? In the errors, I see a Waiting for response timed out (setVolume) which is not functionality that is built into the app. I wonder if something is going wrong with the RM rule(s).

For Google speakers, you have to remember that you can only setVolume after something is playing. So perhaps putting in a delay might help? Not sure...

Edit: I've published v3.2 with these changes and HPM support, so you shouldn't have to manually update the app anymore.

try Smartazan .com

Hello:
I would like to use this app on My hub, I was trying for two days , but it still not working,
I don't know why, installation was ok, speakers are GH mini, my location is Dubai, UAE,
attached the Logs showing error:
app:1142021-05-30 01:10:37.572 am errorError in Adhan response: Bad Request

app:1142021-05-30 01:10:37.091 am debugScheduling refreshTimings for 2021-05-30T06:00:00.000+0400

app:1142021-05-30 01:10:37.087 am debugRefreshing timings with parameters: [uri:https://api.aladhan.com/v1/timingsByAddress, query:[address:, tune:0,0,0,0,0,0,0,0,0, method:8], contentType:application/json, headers:[User-Agent:Hubitat/2.2.7.126 (Adhan Player app)]]

The parameters mention address:, meaning that there is no zip code set. It should be something like this (for a made-up ZIP code of 99999): address:99999,.

What location do you have set in http://<your hub IP>/location/edit?

The location is needed by the backend to properly calculate the Adhan timings for your location.

Thanks for fast reply:
The Zip code is not accepted, because its outside US/Canada,

the Location : http://192.168.0.120/location/edit

Do you mean the Location name : ( ) in the settings?

Do i need to change somthing in the App code in the line 124 address: location.zipCode,
sorry for that, but just trying to understand how its working....

Ah I see. I hadn't considered a case where this would be used outside of North America.

Do you feel comfortable changing the "Apps Code"? If so, please try to do the OPPOSITE of this change: Use ZIP Code instead of latitude and longitude to calculate timings; … · akhandok/adhanPlayer@b564d96 · GitHub

The app used to use latitude and longitude, but that was removed for privacy concerns.

If you do not feel comfortable changing the code, please send me a private message, and I'll work with you to get this resolved.

Would it be possible to:1

  1. Select different speakers per adhan?
  2. Select rules to run before and after each adhan? That way if the volume is increased/decreased for a particular adhan it can be reverted back to the original level after it is done playing.

Yes. Please see "Adhan settings" and specify the URL of the mp3 file of your choosing for any Adhan. I only provide one mp3 for Fajr and another mp3 for all other times.

Yes and no. You can specify a Rule Machine rule to run at the time of any Adhan, see "Adhan settings". There is no support for "after the Adhan" because it is not reliable to know when the Adhan ends. The only recommended workaround is to use a delay in the rule run at the time of the Adhan so that you can have actions execute after the delay, and this after the Adhan.

Sorry, I meant the ability to override the global speaker selection per adhan, not the actual adhan audio.

Got it thanks, that should work.

Oh I see, like only play Fajr on speaker A, but the other ones on speaker B? If so, that's not supported at this time. Is that what you are referring to?

Correct. How hard do you think it would be to implement? If it's not that difficult maybe I can try and submit a pull request.

It should not be too hard to implement. Right now, there is only one speakers variable which is global for the whole app that records the speakers to use for every adhan: https://github.com/akhandok/adhanPlayer/blob/d624c8ae1c7f3728a0085cc2cb3f6b944d5f1bbe/app.groovy#L32

It should not be too hard to keep that as well as have Adhan-specific overrides similar to what is done for the rule machine support: https://github.com/akhandok/adhanPlayer/blob/d624c8ae1c7f3728a0085cc2cb3f6b944d5f1bbe/app.groovy#L292-L298

I request you please open a Github issue, and then if you can submit a PR, I would be grateful. Otherwise, I can get to this in due time when I get a chance (probably around this upcoming weekend, but no guarantees).

I already made the update. It is available in version 4.2 of the app. If you installed the app using Hubitat Package Manager (HPM), your Hubitat will automatically get the update next time HPM updates.