Automation.yaml error extra keys not allowed

Getting this error when triggering the automation.

[31m2018-01-25 00:28:59 ERROR (MainThread) [homeassistant.core] Invalid service data for media_player.media_play: extra keys not allowed @ data[‘media_content_id’]. Got ‘music.mp3’
extra keys not allowed @ data[‘media_content_type’]. Got 'music’e[0m
e[32m2018-01-25 00:28:59 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_executed[L]: service_call_id=103576496-18>e[0m

Here is the yaml.

alias: Front Door Motion Detection
id: '1516859458063'
trigger:
 platform: state
 entity_id: sensor.front_door_motion_detected
 from: 'false'
 to: 'true'
action:
 service: media_player.media_play
 data:
   entity_id: media_player.living_room_speaker
   media_content_id: 'http://192.168.1.26:8123/music/front_door.mp3'
   media_content_type: 'music'
1 Like

Format your code properly. Read the big blue box on the top of the page…

as per @j.assuncao’s comments, format your code please.
then have a look at https://home-assistant.io/components/media_player/#service-media_playerplay_media
It’ll tell you what you need to provide. Here you appear to be missing the URL of the mp3 file you want to play…

the format is wrong in this section according to your errror. As the other 2 guys said, you should paste your code with the correct format here by using the </> button in the text editor.

Thanks for the feedback. I formated the YAML in the original post above. Please refer and let me know if any issues. I am still getting the same error.

I used the automation editor and i am getting the same error. Here is the YAML that the automation editor generated.

- action:
  - data:
      entity_id: media_player.living_room_speaker
      media_content_id: http://192.168.1.26:8123/music/front_door.mp3
      media_content_type: music
    service: media_player.media_play
  alias: Front door motion detected
  condition: []
  id: '1516927161978'
  trigger:
  - entity_id: sensor.front_door_motion_detected
    from: 'false'
    platform: state
    to: 'true'

Nevermind…figured out the issue. I was using the service “media_play” instead of “play_media” :persevere::persevere::sob::sob::sob::rage::rage::triumph::triumph:

8 Likes

It’s always the typos that get ya.

1 Like

Grazie, stesso errore :slight_smile:

Hey. I did not understand. where am i making a mistake. This is written in my script. but the music does not play. What do I need to do for online broadcasting radio on google nest hub?

'1590793764379':
  alias: Радио
  sequence:
  - data:
      media entity_id: media_player.nest
      media_content_id: https://nashe1.hostingradio.ru/nashe-256
      media_content_type: audio/mp3
      service: media_player.play
    entity_id: media_player.nest
    service: media_player.media_play

That should not be here… You can’t have a service as part of the data of another service

help please.
What do I need for the playlist rabio onlan to work on google nest hub?

Try the below, info taken from this page:
https://www.home-assistant.io/integrations/media_player/

'1590793764379':
  alias: Радио
  sequence:
  - data:
      entity_id: media_player.nest
      media_content_id: https://nashe1.hostingradio.ru/nashe-256
      media_content_type: audio/mp4
    service: media_player.play_media

Hey. I made an online radio. but I also want to listen to my music.
made through a script

title: Home Assistant
views:
  - title: Главная
    id: main
    icon: mdi:home-assistant
    
  - title: Медиа
    icon: mdi:google-home
    cards: 
      - type: custom:mini-media-player
        entity: media_player.nest
        background: ""
        artwork: cover
        source: icon
        hide:
         volume: false
        shortcuts:
          columns: 4 #Max buttons per row
          buttons: 
        # Start predefined playlist
          - icon: #mdi:radio-am
            name: Наше Радио
            type: script
            id: script.1590868868709

@sramnarayan Well, on a positive note: you just provided the solution for me. After I was banging my head for an hour why my automation was not working. So: thanks for your post!

It just got me!. Thanks!

Such a joy when you google a stupid mistake and you find a person with the same issue and a solution, thanks.