🔊 Ready to go blueprint for playing adhan / azan on media players with many optional features

Ok so I added the Islamic month sensor. I wasn’t sure what to put for the value so I just added “none” and the automation saved successfully. Will see now if it plays at Isha time.

I tried to run actions and nothing played but I noticed that it changed volume of my echo to zero. Is that expected?

Thanks

@Aaliankhan. Could please explain what to put in the Islamic month sensor value like in the pictures:

You put the value the sensor will output when it’s Ramadan. For me that’s “Ramaḍān”

1 Like

Jazaka Allah Khayran brother!

I can’t play anything (even with a single action automation for test ) on any media player even the TVs…what am I missing

how did you add the volume?

There is a change volume in one of the options.

I used to have the volume option since I imported the latest version, I don’t see it anymore
I’m on 2024.3.1

me too also I can not play any media at all (not related to the blueprint )

Interesting, it seems like an issue with media playback itself. @thedamn316 @aelsharawi Can you guys share some logs?

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
cont-init: info: running /etc/cont-init.d/filesystem.sh
cont-init: info: /etc/cont-init.d/filesystem.sh exited 0
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service alsa: starting
s6-rc: info: service alsa successfully started
s6-rc: info: service alsa-init: starting
[01:12:14] INFO: Adjust ALSA mixer settings for /dev/snd/controlC0
s6-rc: info: service alsa-init successfully started
s6-rc: info: service pulseaudio: starting
W: [pulseaudio] main.c: Running in system mode, but --disallow-module-loading not set.
W: [pulseaudio] main.c: Home directory of user 'root' is not '/var/run/pulse', ignoring.
W: [pulseaudio] caps.c: Normally all extra capabilities would be dropped now, but that's impossible because PulseAudio was built without capabilities support.
W: [pulseaudio] main.c: OK, so you are running PA in system mode. Please make sure that you actually do want to do that.
W: [pulseaudio] main.c: Please read http://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/WhatIsWrongWithSystemWide/ for an explanation why system mode is usually a bad idea.
W: [pulseaudio] module-udev-detect.c: Failed to open /proc/asound/card0: No such file or directory
s6-rc: info: service pulseaudio successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
ogger: homeassistant.components.automation.adhan_announcement
Source: helpers/script.py:1805
integration: Automation (documentation, issues)
First occurred: 12:04:00 PM (3 occurrences)
Last logged: 12:04:00 PM

🔊 Adhan Announcement: Choose at step 1: choice 1: Choose at step 1: choice 3: Error executing script. Invalid data for call_service at pos 1: must contain at least one of entity_id, device_id, area_id.
🔊 Adhan Announcement: Choose at step 1: choice 1: Error executing script. Invalid data for choose at pos 1: must contain at least one of entity_id, device_id, area_id.
🔊 Adhan Announcement: Error executing script. Invalid data for choose at pos 1: must contain at least one of entity_id, device_id, area_id.
1 Like

It seems like the blueprint is missing the entity IDs to play. Or the entity IDs to pause.

Can you share the trace of the automation?

FYI, I am running same version with it working.

choose:
  - conditions:
      - condition: state
        entity_id: sensor.islamic_month
        state: Ramaḍān
    sequence:
      - choose:
          - conditions:
              - condition: and
                conditions:
                  - condition: trigger
                    id: fajr_trigger
                  - condition: template
                    value_template: '{{ play_fajr == true }}'
            sequence:
              - service: media_player.media_pause
                target: {}
                data: {}
              - service: media_player.play_media
                target:
                  entity_id: media_player.clock_alexa
                  area_id: reception
                  device_id: removed here
                data:
                  media_content_id: >-
                    https://github.com/AalianKhan/adhans/blob/5787805ae3bc1c57ac88b37163ab673be429eb02/suhoor_dua.mp3?raw=true
                  media_content_type: mp3
              - delay:
                  hours: 0
                  minutes: 0
                  seconds: 2
                  milliseconds: 0
              - wait_template: '{{ is_state(wait_media_player, ''idle'') }}'
                timeout: '00:05:00'
              - service: media_player.play_media
                target:
                  entity_id: media_player.clock_alexa
                  area_id: reception
                  device_id: removed here
                data:
                  media_content_id: >-
                    https://github.com/AalianKhan/adhans/blob/5787805ae3bc1c57ac88b37163ab673be429eb02/adhan_fajr.mp3?raw=true
                  media_content_type: mp3
              - condition: template
                value_template: '{{ media_resume }}'
              - delay:
                  hours: 0
                  minutes: 0
                  seconds: 2
                  milliseconds: 0
              - wait_template: '{{ is_state(wait_media_player, ''idle'') }}'
                timeout: '00:05:00'
              - service: media_player.media_play
                target: {}
                data: {}
          - conditions:
              - condition: trigger
                id: maghrib_trigger
            sequence:
              - service: media_player.media_pause
                target: {}
                data: {}
              - service: media_player.play_media
                target:
                  entity_id: media_player.clock_alexa
                  area_id: reception
                  device_id: removed here
                data:
                  media_content_id: >-
                    https://github.com/AalianKhan/adhans/blob/5787805ae3bc1c57ac88b37163ab673be429eb02/iftar_dua.mp3?raw=true
                  media_content_type: mp3
              - delay:
                  hours: 0
                  minutes: 0
                  seconds: 2
                  milliseconds: 0
              - wait_template: '{{ is_state(wait_media_player, ''idle'') }}'
                timeout: '00:05:00'
              - service: media_player.play_media
                target:
                  entity_id: media_player.clock_alexa
                  area_id: reception
                  device_id: removed here
                data:
                  media_content_id: >-
                    https://github.com/AalianKhan/adhans/blob/5787805ae3bc1c57ac88b37163ab673be429eb02/adhan.mp3?raw=true
                  media_content_type: mp3
              - condition: template
                value_template: '{{ media_resume }}'
              - delay:
                  hours: 0
                  minutes: 0
                  seconds: 2
                  milliseconds: 0
              - wait_template: '{{ is_state(wait_media_player, ''idle'') }}'
                timeout: '00:05:00'
              - service: media_player.media_play
                target: {}
                data: {}
          - conditions:
              - condition: or
                conditions:
                  - condition: trigger
                    id: dhuhr_trigger
                  - condition: trigger
                    id: asr_trigger
                  - condition: trigger
                    id: isha_trigger
            sequence:
              - service: media_player.media_pause
                target: {}
                data: {}
              - service: media_player.play_media
                target:
                  entity_id: media_player.clock_alexa
                  area_id: reception
                  device_id: removed here
                data:
                  media_content_id: >-
                    https://github.com/AalianKhan/adhans/blob/5787805ae3bc1c57ac88b37163ab673be429eb02/adhan.mp3?raw=true
                  media_content_type: mp3
              - condition: template
                value_template: '{{ media_resume }}'
              - delay:
                  hours: 0
                  minutes: 0
                  seconds: 2
                  milliseconds: 0
              - wait_template: '{{ is_state(wait_media_player, ''idle'') }}'
                timeout: '00:05:00'
              - service: media_player.media_play
                target: {}
                data: {}
default:
  - choose:
      - conditions:
          - condition: and
            conditions:
              - condition: trigger
                id: fajr_trigger
              - condition: template
                value_template: '{{ play_fajr == true }}'
        sequence:
          - service: media_player.media_pause
            target: {}
            data: {}
          - service: media_player.play_media
            target:
              entity_id: media_player.clock_alexa
              area_id: reception
              device_id: removed here
            data:
              media_content_id: >-
                https://github.com/AalianKhan/adhans/blob/5787805ae3bc1c57ac88b37163ab673be429eb02/adhan_fajr.mp3?raw=true
              media_content_type: mp3
          - condition: template
            value_template: '{{ media_resume }}'
          - delay:
              hours: 0
              minutes: 0
              seconds: 2
              milliseconds: 0
          - wait_template: '{{ is_state(wait_media_player, ''idle'') }}'
            timeout: '00:05:00'
          - service: media_player.media_play
            target: {}
            data: {}
      - conditions:
          - condition: or
            conditions:
              - condition: trigger
                id: dhuhr_trigger
              - condition: trigger
                id: asr_trigger
              - condition: trigger
                id: maghrib_trigger
              - condition: trigger
                id: isha_trigger
        sequence:
          - service: media_player.media_pause
            target: {}
            data: {}
          - service: media_player.play_media
            target:
              entity_id: media_player.clock_alexa
              area_id: reception
              device_id: removed here
            data:
              media_content_id: >-
                https://github.com/AalianKhan/adhans/blob/5787805ae3bc1c57ac88b37163ab673be429eb02/adhan.mp3?raw=true
              media_content_type: mp3
          - condition: template
            value_template: '{{ media_resume }}'
          - delay:
              hours: 0
              minutes: 0
              seconds: 2
              milliseconds: 0
          - wait_template: '{{ is_state(wait_media_player, ''idle'') }}'
            timeout: '00:05:00'
          - service: media_player.media_play
            target: {}
            data: {}

Thanks
It seems that it is getting stuck when trying to pause the media player because there is no device selected. Before it used to just log a warning when no device was selected but now it seems to completly error out.

Can you try to select one of your media players in the pause option to confirm thats the issue. I will try my best to fix it IA

2 Likes
choose:
  - conditions:
      - condition: state
        entity_id: sensor.islamic_month
        state: Ramaḍān
    sequence:
      - choose:
          - conditions:
              - condition: and
                conditions:
                  - condition: trigger
                    id: fajr_trigger
                  - condition: template
                    value_template: '{{ play_fajr == true }}'
            sequence:
              - service: media_player.media_pause
                target:
                  area_id: reception
                  device_id: delted
                  entity_id: media_player.clock_alexa
                data: {}
              - service: media_player.play_media
                target:
                  entity_id: media_player.clock_alexa
                  area_id: reception
                  device_id: delted
                data:
                  media_content_id: >-
                    https://github.com/AalianKhan/adhans/blob/5787805ae3bc1c57ac88b37163ab673be429eb02/suhoor_dua.mp3?raw=true
                  media_content_type: mp3
              - delay:
                  hours: 0
                  minutes: 0
                  seconds: 2
                  milliseconds: 0
              - wait_template: '{{ is_state(wait_media_player, ''idle'') }}'
                timeout: '00:05:00'
              - service: media_player.play_media
                target:
                  entity_id: media_player.clock_alexa
                  area_id: reception
                  device_id: delted
                data:
                  media_content_id: >-
                    https://github.com/AalianKhan/adhans/blob/5787805ae3bc1c57ac88b37163ab673be429eb02/adhan_fajr.mp3?raw=true
                  media_content_type: mp3
              - condition: template
                value_template: '{{ media_resume }}'
              - delay:
                  hours: 0
                  minutes: 0
                  seconds: 2
                  milliseconds: 0
              - wait_template: '{{ is_state(wait_media_player, ''idle'') }}'
                timeout: '00:05:00'
              - service: media_player.media_play
                target:
                  area_id: reception
                  device_id: delted
                  entity_id: media_player.clock_alexa
                data: {}
          - conditions:
              - condition: trigger
                id: maghrib_trigger
            sequence:
              - service: media_player.media_pause
                target:
                  area_id: reception
                  device_id: delted
                  entity_id: media_player.clock_alexa
                data: {}
              - service: media_player.play_media
                target:
                  entity_id: media_player.clock_alexa
                  area_id: reception
                  device_id: delted
                data:
                  media_content_id: >-
                    https://github.com/AalianKhan/adhans/blob/5787805ae3bc1c57ac88b37163ab673be429eb02/iftar_dua.mp3?raw=true
                  media_content_type: mp3
              - delay:
                  hours: 0
                  minutes: 0
                  seconds: 2
                  milliseconds: 0
              - wait_template: '{{ is_state(wait_media_player, ''idle'') }}'
                timeout: '00:05:00'
              - service: media_player.play_media
                target:
                  entity_id: media_player.clock_alexa
                  area_id: reception
                  device_id: delted
                data:
                  media_content_id: >-
                    https://github.com/AalianKhan/adhans/blob/5787805ae3bc1c57ac88b37163ab673be429eb02/adhan.mp3?raw=true
                  media_content_type: mp3
              - condition: template
                value_template: '{{ media_resume }}'
              - delay:
                  hours: 0
                  minutes: 0
                  seconds: 2
                  milliseconds: 0
              - wait_template: '{{ is_state(wait_media_player, ''idle'') }}'
                timeout: '00:05:00'
              - service: media_player.media_play
                target:
                  area_id: reception
                  device_id: delted
                  entity_id: media_player.clock_alexa
                data: {}
          - conditions:
              - condition: or
                conditions:
                  - condition: trigger
                    id: dhuhr_trigger
                  - condition: trigger
                    id: asr_trigger
                  - condition: trigger
                    id: isha_trigger
            sequence:
              - service: media_player.media_pause
                target:
                  area_id: reception
                  device_id: delted
                  entity_id: media_player.clock_alexa
                data: {}
              - service: media_player.play_media
                target:
                  entity_id: media_player.clock_alexa
                  area_id: reception
                  device_id: delted
                data:
                  media_content_id: >-
                    https://github.com/AalianKhan/adhans/blob/5787805ae3bc1c57ac88b37163ab673be429eb02/adhan.mp3?raw=true
                  media_content_type: mp3
              - condition: template
                value_template: '{{ media_resume }}'
              - delay:
                  hours: 0
                  minutes: 0
                  seconds: 2
                  milliseconds: 0
              - wait_template: '{{ is_state(wait_media_player, ''idle'') }}'
                timeout: '00:05:00'
              - service: media_player.media_play
                target:
                  area_id: reception
                  device_id: delted
                  entity_id: media_player.clock_alexa
                data: {}
default:
  - choose:
      - conditions:
          - condition: and
            conditions:
              - condition: trigger
                id: fajr_trigger
              - condition: template
                value_template: '{{ play_fajr == true }}'
        sequence:
          - service: media_player.media_pause
            target:
              area_id: reception
              device_id: delted
              entity_id: media_player.clock_alexa
            data: {}
          - service: media_player.play_media
            target:
              entity_id: media_player.clock_alexa
              area_id: reception
              device_id: delted
            data:
              media_content_id: >-
                https://github.com/AalianKhan/adhans/blob/5787805ae3bc1c57ac88b37163ab673be429eb02/adhan_fajr.mp3?raw=true
              media_content_type: mp3
          - condition: template
            value_template: '{{ media_resume }}'
          - delay:
              hours: 0
              minutes: 0
              seconds: 2
              milliseconds: 0
          - wait_template: '{{ is_state(wait_media_player, ''idle'') }}'
            timeout: '00:05:00'
          - service: media_player.media_play
            target:
              area_id: reception
              device_id: delted
              entity_id: media_player.clock_alexa
            data: {}
      - conditions:
          - condition: or
            conditions:
              - condition: trigger
                id: dhuhr_trigger
              - condition: trigger
                id: asr_trigger
              - condition: trigger
                id: maghrib_trigger
              - condition: trigger
                id: isha_trigger
        sequence:
          - service: media_player.media_pause
            target:
              area_id: reception
              device_id: delted
              entity_id: media_player.clock_alexa
            data: {}
          - service: media_player.play_media
            target:
              entity_id: media_player.clock_alexa
              area_id: reception
              device_id: delted
            data:
              media_content_id: >-
                https://github.com/AalianKhan/adhans/blob/5787805ae3bc1c57ac88b37163ab673be429eb02/adhan.mp3?raw=true
              media_content_type: mp3
          - condition: template
            value_template: '{{ media_resume }}'
          - delay:
              hours: 0
              minutes: 0
              seconds: 2
              milliseconds: 0
          - wait_template: '{{ is_state(wait_media_player, ''idle'') }}'
            timeout: '00:05:00'
          - service: media_player.media_play
            target:
              area_id: reception
              device_id: delted
              entity_id: media_player.clock_alexa
            data: {}

and what about media players not playing on my HA, is this a problem too? if it is where I start to debug it?

Fajr adhan wont play at all. I guess it is triggering at the wrong time and it’s skipping it due to that.

Any fix?

Do you have the play fajr toggle set to on?

Yes I do.