crpgbogor
(Crpgbogor)
May 12, 2020, 12:00am
1
Hello friends,
System Environment: Hassio in docker
A noob here. My media_player.play.media works fine on my Google Home when using service call in developer tools, even when using local file (in config/www/local/audio). However, I can never get it to work with automation. I tried using the gui (from configuration/automation) and then click “execute”. It doesn’t work. I tried using the yaml file directly in config/automation.yaml also doesn’t work.
Other automation, such as alarm siren or notify HA in android work just fine. Only the Google Home play.media automation doesn’t work (google home play.media service call in developer tool works fine).
I hope someone here will be able to share some tips.
Many thanks
crpgbogor
(Crpgbogor)
May 12, 2020, 12:54am
3
- id: '1589083650156'
alias: Notify Back Door Still Open
description: ''
trigger:
- entity_id: binary_sensor.back_door
from: 'Off'
platform: state
to: 'On'
condition:
- before: sunset
before_offset: 06:30:00
condition: sun
action:
- data:
data:
push:
badge: 5
sticky: 'true'
message: Yow, Back Door is Opened!
title: 'Door/Windows Reminder '
service: notify.mobile_app_mmm
- id: '1589194067179'
alias: Sound Google Home Siren When Armed
description: ''
trigger:
- entity_id: binary_sensor.front_door
from: 'off'
platform: state
to: 'on'
condition:
- condition: state
entity_id: alarm_control_panel.home_alarm
state: armed_away
action:
- data:
entity_id: media_player.speaker
media_content_id: 'http://192.168.1.271:8123/local/audio/siren.mp3'
media_content_type: "audio/mp3"
entity_id: media_player.speaker
service: media_player.media_play
crpgbogor
(Crpgbogor)
May 12, 2020, 12:55am
4
I tried this last bit on dev tools and it worked fine:
- data:
entity_id: media_player.speaker
media_content_id: 'http://192.168.1.271:8123/local/audio/siren.mp3'
media_content_type: "audio/mp3"
entity_id: media_player.speaker
service: media_player.media_play
I’m having a similar problem with a Nest Mini speaker. I can play the sound fine in developer tools, but get an error when I use it in an automation:
alias: KGBI Sunday Morning
description: ''
trigger:
- platform: time
at: '7:30'
condition:
- condition: time
weekday:
- sun
action:
- service: media_player.media_play
data:
entity_id: media_player.basement_speaker
media_content_id: 'https://nwmedia-kgbi.streamguys1.com/kgbi-mp3'
media_content_type: music
entity_id: media_player.basement_speaker
mode: single
The error is:
2021-01-18 15:23:14 ERROR (MainThread) [homeassistant.components.automation.kgbi_sunday_morning] KGBI Sunday Morning: Error executing script. Invalid data for call_service at pos 1: extra keys not allowed @ data['media_content_id']
2021-01-18 15:23:14 ERROR (MainThread) [homeassistant.components.automation.kgbi_sunday_morning] While executing automation automation.kgbi_sunday_morning
I’m assuming it’s some sort of indent or other syntax error, but I can’t figure out how to change it. Any ideas?
My problem was using the wrong service. It should have been media_player.play_media
. Works great now!