Error: extra keys not allowed @ data

I have an automation which has started throwing an error when I run it:

Error: extra keys not allowed @ data['media_content_id']

Any idea what I’ve done wrong?

This is the automation:

alias: Doorbell Pressed
description: ""
triggers:
  - entity_id:
      - binary_sensor.reolink_video_doorbell_wifi_visitor
    to: "on"
    trigger: state
conditions: []
actions:
  - variables:
      current_state: "{{ states('media_player.living_room') }}"
  - sequence:
      - action: script.send_camera_snapshot_doorbell_pressed
        continue_on_error: true
        data:
          camera_id: reolink_video_doorbell_wifi_fluent
      - data:
          media_content_id: /local/front-door.mp3
          media_content_type: music
          announce: true
        action: media_player.media_play
        continue_on_error: true
        target:
          entity_id:
            - media_player.kitchen_display_google_cast
            - media_player.lounge_display_google_cast
            - media_player.study_speaker_lms_castbridge
      - data:
          media_content_id: /local/front-door.mp3
          media_content_type: music
          announce: true
        action: media_player.media_play
        continue_on_error: true
        target:
          entity_id:
            - media_player.bedroom
      - action: script.send_camera_snapshot_doorbell_pressed
        continue_on_error: true
        data:
          camera_id: reolink_video_doorbell_wifi_fluent
      - parallel:
          - action: camera.play_stream
            metadata: {}
            data:
              format: hls
              media_player: media_player.lounge_display_google_cast
            target:
              entity_id: camera.unnamed_doorbell
          - action: camera.play_stream
            metadata: {}
            data:
              format: hls
              media_player: media_player.kitchen_display_google_cast
            target:
              entity_id: camera.unnamed_doorbell
          - metadata: {}
            data: {}
            target:
              entity_id: button.asus_asus_webview
            action: button.press
          - data:
              topic: iotlink/workgroup/asus/commands/run
              payload: >-
                { "command": "C:\\Program Files
                (x86)\\Google\\Chrome\\Application\\chrome.exe", "args":
                "http://192.168.1.4:81/mjpg/doorbell/video.mjpg", "path":
                "C:\\Program Files (x86)\\Google\\Chrome\\Application", "user":
                "", "visible": true, "fallback": true }
              qos: 0
              retain: false
            action: mqtt.publish
          - action: script.send_camera_snapshot_doorbell_pressed
            data:
              camera_id: reolink_video_doorbell_wifi_fluent
      - delay:
          hours: 0
          minutes: 0
          seconds: 5
          milliseconds: 0
      - action: media_player.turn_off
        metadata: {}
        data: {}
        target:
          entity_id: media_player.bedroom
      - action: media_player.turn_off
        metadata: {}
        data: {}
        target:
          entity_id: media_player.lounge_display_google_cast
  - action: media_player.turn_off
    metadata: {}
    data: {}
    target:
      entity_id: media_player.bedroom
mode: parallel
``

The docs use media_player.media_play and media_player.play_media in different places, maybe it should be play_media?


Only play_media is documented below.

I just tried the automation editor. That accepts both, but only play_media has data parameters. The other one is maybe just play (as opposed to pause)

Yes I think that’s it - thanks. TBH I don’t understand the difference between media_play and play_media. I find it quite confusing!

Hi, please take the time to mark the post with the solution as the answer, you do that by selecting the three dots under the post:

image

Then select the check box:

image
By doing so:

  • this thread can be useful to other users as well (this thread comes up as solution when starting a thread which is similar to yours).
  • this prevents that someone else steps in trying to help

Thanks for giving back to the community! :+1:

The play_media action plays some sort of media like a song or video that you specify.

The media_play action is the same as pressing the play button on your media player. If there isn’t something there ready to play then nothing happens. Other actions similar to this are media_stop and media_pause.

If you feel they could be renamed to avoid confusion or an explanation added to the documentation then use the feedback button (located at the bottom of every documentation page):

https://www.home-assistant.io/integrations/media_player/

1 Like

In hindsight the latter would probably be better understood if they were called playback_play, playback_stop and playback_pause or just plain play pause and stop. But it is not something I would want to introduce a breaking change for.

1 Like

Thanks for clarifying - that makes sense.

1 Like