Hi, this is my script and i am getting this error “Message malformed: extra keys not allowed @ data[‘sensor’]” when trying to save it. Here is the script.
alias: Athan Automation
sensor:
-
platform: rest
name: “Prayer Times”
json_attributes:- data
resource: “latitude=-33.83853661687818&longitude=150.9857852420184&method=0”
value_template: ‘{{ value_json[“data”][“meta”][“method”][“name”].title() }}’
scan_interval: 86400
- data
-
platform: template
sensors:
fajr:
friendly_name: ‘Fajr Prayer Time’
value_template: ‘{{ states.sensor.prayer_times.attributes.data.timings[“Fajr”] | timestamp_custom("%H:%M") }}’
dhuhr:
friendly_name: ‘Dhuhr Prayer Time’
value_template: ‘{{ states.sensor.prayer_times.attributes.data.timings[“Dhuhr”] | timestamp_custom("%H:%M") }}’
asr:
friendly_name: ‘Asr Prayer Time’
value_template: ‘{{ states.sensor.prayer_times.attributes.data.timings[“Asr”] | timestamp_custom("%H:%M") }}’
magrib:
friendly_name: ‘Magrib Prayer Time’
value_template: ‘{{ states.sensor.prayer_times.attributes.data.timings[“Maghrib”] | timestamp_custom("%H:%M") }}’
isha:
friendly_name: ‘Isha Prayer Time’
value_template: ‘{{ states.sensor.prayer_times.attributes.data.timings[“Isha”] | timestamp_custom("%H:%M") }}’
automation:
-
alias: “Fajr Athan”
initial_state: true
hide_entity: true
trigger:- condition: template
value_template: ‘{{ states.sensor.time.state == states(“sensor.fajr”) }}’
action: - service: media_player.volume_set
data_template:
entity_id: media_player.living_room_speaker
volume_level: 0.75 - service: media_player.play_media
data:
entity_id: media_player.living_room_speaker
media_content_id:
media_content_type: audio/mp3
- condition: template
-
alias: “Athan”
initial_state: true
hide_entity: true
trigger:- platform: template
value_template: ‘{{ states.sensor.time.state == states(“sensor.dhuhr”) }}’ - platform: template
value_template: ‘{{ states.sensor.time.state == states(“sensor.asr”) }}’ - platform: template
value_template: ‘{{ states.sensor.time.state == states(“sensor.maghrib”) }}’ - platform: template
value_template: ‘{{ states.sensor.time.state == states(“sensor.isha”) }}’
action: - service: media_player.volume_set
data_template:
entity_id: media_player.living_room_speaker
volume_level: 0.75 - service: media_player.play_media
data:
entity_id: media_player.living_room_speaker
media_content_id:
media_content_type: audio/mp3
- platform: template
Please help. thanks