UI Automation Steps Fail to Run

I’ve slowly been switching from using solely YAML files for automation and scripts to the UI. This has mostly worked without issue but I can across a slightly odd one yesterday. My wakeup script fires off a light on, an alexa media notify with a custom message payload, an alexa media play sequence and then an alexa media play apple music. The alexa media notify is not working, and the error message I get is;

Wakeup Luke: Error executing script. Invalid data for call_service at pos 4: extra keys not allowed @ data['media_content_id']

In the wakeup script the Alexa calendar play sequence looks like this;

  - data:
      media_content_id: Alexa.Calendar.PlayToday
      media_content_type: sequence
    entity_id: media_player.bedroom_dingus
    service: media_player.media_play

However I have created a standalone test for this which works fine and it shows the exact same yaml;

  - data:
      media_content_id: Alexa.Calendar.PlayToday
      media_content_type: sequence
    entity_id: media_player.study_dingus
    service: media_player.play_media

Both automation modes are single. I thought that maybe the notify one was causing an issue as there are lots of sensor values in there, but even when I moved the Calendar one before the Notify one the Calendar one failed and the Notify worked. For refence, here is the full YAML;

wakeup_luke:
  alias: Wakeup Luke
  icon: mdi:alarm-check
  mode: single
  sequence:
  - data:
      brightness_pct: 1
    entity_id: light.bedroom_light
    service: light.turn_on
  - data:
      data:
        type: tts
      message: 'Good {{ states(''sensor.time_of_day'')}} Luke, it is {% set timestamp
        =

        now().strftime(''%I %M %p'') %}{{ timestamp.lstrip("0") }} on {{

        as_timestamp(now()) | timestamp_custom(''%A'') }} the {{

        states(''sensor.date_human'') }} of {{ as_timestamp(now()) |

        timestamp_custom(''%B'') }}. You {% if states(''calendar.work'') == ''on''
        or

        states(''binary_sensor.workday_sensor'') == ''off'' or

        states(''binary_sensor.working_from_home_luke'') == ''off'' -%} are not working

        {%- else -%} are working from home {%- endif %} today. The temperature outside

        feels like {{ states(''sensor.dark_sky_apparent_temperature'')}} degrees.
        Your

        indoor temperature is {{ state_attr(''climate.heating'', ''current_temperature'')

        }} degrees. The forecast for today is {{

        states(''sensor.dark_sky_hourly_summary'') }} with a {{

        states(''sensor.dark_sky_precip_probability'') }} percent chance of rain for
        the

        hour. You have {{ states(''sensor.annual_leave'')}} days of Annual Leave

        remaining.'
      target: media_player.bedroom_dingus
    service: notify.alexa_media
  - delay: 00:00:45
  - data:
      media_content_id: Alexa.Calendar.PlayToday
      media_content_type: sequence
    entity_id: media_player.bedroom_dingus
    service: media_player.media_play
  - delay: 00:00:45
  - data:
      media_content_id: Outside In
      media_content_type: APPLE_MUSIC
    entity_id: media_player.bedroom_dingus
    service: media_player.play_media

Change media_player.media_play to media_player.play_media in the 4th service call

play_media = start a song/file/etc

media_play = resume from pause

They are not interchangeable.

1 Like

#facepalm

Well, clearly not exactly identical! Thanks for that, I had totally missed it.

1 Like