Last active
April 18, 2024 18:56
-
-
Save OJ7/9606acb8db80b200219dff728edab081 to your computer and use it in GitHub Desktop.
Home Assistant config for automatically playing Adhan on Google Home/Nest (updated 2022)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- id: '1660878281315' | |
alias: Play Adhan on Google Home | |
description: '' | |
trigger: | |
- platform: template | |
value_template: '{{ states.sensor.dhuhr.state == states.sensor.time.state }}' | |
- platform: template | |
value_template: '{{ states.sensor.asr.state == states.sensor.time.state }}' | |
- platform: template | |
value_template: '{{ states.sensor.maghrib.state == states.sensor.time.state }}' | |
enabled: true | |
- platform: template | |
value_template: '{{ states.sensor.isha.state == states.sensor.time.state }}' | |
enabled: true | |
condition: [] | |
action: | |
- service: media_player.volume_set | |
data: | |
volume_level: '0.6' | |
entity_id: media_player.family_room_speaker | |
- service: media_player.play_media | |
data: | |
media_content_id: http://path/to/adhan.mp3 | |
media_content_type: audio/mp3 | |
target: | |
entity_id: media_player.family_room_speaker | |
mode: single | |
- id: '1660880125236' | |
alias: Play Fajr Adhan on Google Home | |
description: '' | |
trigger: | |
- platform: template | |
value_template: '{{ states.sensor.fajr.state == states.sensor.time.state }}' | |
condition: [] | |
action: | |
- service: media_player.volume_set | |
data: | |
volume_level: '0.6' | |
entity_id: media_player.family_room_speaker | |
- service: media_player.play_media | |
data: | |
media_content_id: http://path/to/fajr.mp3 | |
media_content_type: audio/mp3 | |
target: | |
entity_id: media_player.family_room_speaker | |
mode: single | |
- id: '1660880858187' | |
alias: Lower Volume at Sunrise | |
description: '' | |
trigger: | |
- platform: template | |
value_template: '{{ states.sensor.sunrise.state == states.sensor.time.state }}' | |
condition: [] | |
action: | |
- service: media_player.volume_set | |
data: | |
volume_level: 0.3 | |
target: | |
entity_id: media_player.family_room_speaker | |
mode: single |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Loads default set of integrations. Do not remove. | |
default_config: | |
# Text to speech | |
tts: | |
- platform: google_translate | |
automation: !include automations.yaml | |
script: !include scripts.yaml | |
scene: !include scenes.yaml | |
panel_iframe: | |
configurator: | |
title: Configurator | |
icon: mdi:wrench | |
url: http://10.0.0.146:3218 | |
sensor: | |
- platform: time_date | |
display_options: | |
- 'time' | |
- 'date' | |
# Salat Times | |
- platform: rest | |
name: "Prayer Times" | |
json_attributes_path: "$.data.timings" | |
json_attributes: | |
- Fajr | |
- Sunrise | |
- Dhuhr | |
- Asr | |
- Maghrib | |
- Isha | |
resource: "http://api.aladhan.com/v1/timingsByCity?city=baltimore,md&country=United%20states&method=2&school=1" | |
value_template: '{{ value_json["data"]["meta"]["method"]["name"].title() }}' | |
scan_interval: 10800 # 3 hrs | |
- platform: template | |
sensors: | |
fajr: | |
friendly_name: 'Fajr Prayer Time' | |
value_template: "{{ state_attr('sensor.prayer_times', 'Fajr') }}" | |
sunrise: | |
friendly_name: 'Sunrise Prayer Time' | |
value_template: "{{ state_attr('sensor.prayer_times', 'Sunrise') }}" | |
dhuhr: | |
friendly_name: 'Dhuhr Prayer Time' | |
value_template: "{{ state_attr('sensor.prayer_times', 'Dhuhr') }}" | |
asr: | |
friendly_name: 'Asr Prayer Time' | |
value_template: "{{ state_attr('sensor.prayer_times', 'Asr') }}" | |
maghrib: | |
friendly_name: 'Maghrib Prayer Time' | |
value_template: "{{ state_attr('sensor.prayer_times', 'Maghrib') }}" | |
isha: | |
friendly_name: 'Isha Prayer Time' | |
value_template: "{{ state_attr('sensor.prayer_times', 'Isha') }}" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment