Salaam all,
After a lot of time spent trying to get any one of the integrations to work for Salah times and Adhan playing through my speakers, I finally managed to get this one working by doing the following. Instructions below which I’m hoping helps any other brothers/sisters that are also struggling.
Caveat; I’m further North than London, however I noticed that my local mosque is almost exactly 10 minutes later than the times pulled by this integration (+/- 2 minutes).
- Download zip file with the custom_components folder and extract to your custom_components folder within HASS.
- Configure as required, although I didn’t change anything for my setup, the defaults were perfect.
- Convert the attributes provided by LUPT into sensors by adding the below code into your configuration.yaml. The +600 in the below adds 10 minutes to the time from LUPT as mentioned above. Make sure to change this to match your requirements.
# Salah Times
- platform: template
sensors:
fajr_prayer:
friendly_name: Fajr Prayer
value_template: "{{ (as_timestamp(state_attr('lupt.lupt', 'next_fajr')) + 600 ) | timestamp_custom('%H:%M') }}"
dhuhr_prayer:
friendly_name: Dhuhr Prayer
value_template: "{{ (as_timestamp(state_attr('lupt.lupt', 'next_zuhr')) + 480 ) | timestamp_custom('%H:%M') }}"
asr_prayer:
friendly_name: Asr Prayer
value_template: "{{ (as_timestamp(state_attr('lupt.lupt', 'next_asr')) + 540 ) | timestamp_custom('%H:%M') }}"
maghrib_prayer:
friendly_name: Maghrib Prayer
value_template: "{{ (as_timestamp(state_attr('lupt.lupt', 'next_maghrib')) + 600 ) | timestamp_custom('%H:%M') }}"
isha_prayer:
friendly_name: Isha Prayer
value_template: "{{ (as_timestamp(state_attr('lupt.lupt', 'next_ishā')) + 1140 ) | timestamp_custom('%H:%M') }}"
- To add a card to your Dashboard with the times, use the below to create a Glance Card
show_name: true
show_icon: true
show_state: true
type: glance
entities:
- entity: sensor.fajr_prayer
format: time
name: Fajr
icon: mdi:weather-sunset-up
- entity: sensor.dhuhr_prayer
format: time
name: Dhuhr
icon: mdi:white-balance-sunny
- entity: sensor.asr_prayer
format: time
name: Asr
icon: mdi:weather-sunset
- entity: sensor.maghrib_prayer
format: time
name: Maghrib
icon: mdi:weather-sunset-down
- entity: sensor.isha_prayer
format: time
name: Isha
icon: mdi:moon-waning-crescent
state_color: true
- Download an Azan MP3/MP4 of your preference, and upload it to your /www folder
- To create an Automation which plays the Adhan at the specified times you can use the below. Make sure to change the entity for the media player to one of your choosing along with the time delay on the salah times and volume settings if required. This is just one example. You can duplicate and amend for the other prayers.
alias: "Kitchen: Adhan Isha"
description: ""
trigger:
- platform: state
entity_id:
- lupt.lupt
attribute: next_ishā
condition: []
action:
- delay:
hours: 0
minutes: 19
seconds: 0
milliseconds: 0
- service: media_player.volume_set
data:
volume_level: 0.4
target:
entity_id:
- media_player.kitchen_display
- service: media_player.play_media
data:
media_content_id: http://192.168.1.251:8123/local/azan.mp3
media_content_type: audio
enqueue: play
target:
entity_id:
- media_player.kitchen_display
- delay:
hours: 0
minutes: 5
seconds: 0
milliseconds: 0
- service: media_player.volume_set
data:
volume_level: 0.1
target:
entity_id: media_player.kitchen_display
mode: single
There are probably better/cleaner ways to set this up, but after days of trying with very little experience with YAML/Code this is where I ended up.
Hope it helps any of you struggling with getting the times right and Adhan playing in the UK.