Message malformed in Script: multiple conditions checking media_player attributes

I’m trying to write a script which should only perform the final action if two conditions are met. Both conditions check the status of attributes of a media player entity. I’m getting this syntax error:

Message malformed: extra keys not allowed @ data['sequence'][2]['-conditions']

Could anyone put me straight on how the syntax needs to look? The script is:

alias: Cast EZViz Doorbell Camera to Chromecast
sequence:
  - service: media_player.play_media
    data:
      media_content_id: http://192.168.1.4:81/mjpg/doorbell/video.mjpg
      media_content_type: image/jpg
    target:
      entity_id: media_player.chromecast6791
  - service: media_player.play_media
    data:
      media_content_id: http://192.168.1.4:81/mjpg/doorbell/video.mjpg
      media_content_type: image/jpg
    target:
      entity_id: media_player.kitchen_display
  - condition: and
    - conditions: 
      - condition: "{{ is_state('media_player.lg_webos_smart_tv', 'on') }}"
      - condition: "{{ is_state_attr('media_player.lg_webos_smart_tv', 'source', 'HDMI 1') }}"
  - service: shell_command.pause_humax
    data: {}
mode: single

Wrong formatting, try:

- condition: and
  conditions:
    - condition: template
      value_template: >-
        {{ is_state('media_player.lg_webos_smart_tv', 'on') }}
    - condition: template
      value_template: >-
        {{ is_state_attr('media_player.lg_webos_smart_tv', 'source', 'HDMI 1') }}

That gives the same error:

alias: Cast EZViz Doorbell Camera to Chromecast
sequence:
  - service: media_player.play_media
    data:
      media_content_id: http://192.168.1.4:81/mjpg/doorbell/video.mjpg
      media_content_type: image/jpg
    target:
      entity_id: media_player.chromecast6791
  - service: media_player.play_media
    data:
      media_content_id: http://192.168.1.4:81/mjpg/doorbell/video.mjpg
      media_content_type: image/jpg
    target:
      entity_id: media_player.kitchen_display
- condition: and
  conditions:
    - condition: template
      value_template: >-
        {{ is_state('media_player.lg_webos_smart_tv', 'on') }}
    - condition: template
      value_template: >-
        {{ is_state_attr('media_player.lg_webos_smart_tv', 'source', 'HDMI 1') }}
    - service: shell_command.pause_humax
      data: {}
mode: single
Message malformed: extra keys not allowed @ data['sequence'][2]['-conditions']

Aah…it was a problem with the indentation of the “service” element - this seems to be accepted:

alias: Cast EZViz Doorbell Camera to Chromecast
sequence:
  - service: media_player.play_media
    data:
      media_content_id: http://192.168.1.4:81/mjpg/doorbell/video.mjpg
      media_content_type: image/jpg
    target:
      entity_id: media_player.chromecast6791
  - service: media_player.play_media
    data:
      media_content_id: http://192.168.1.4:81/mjpg/doorbell/video.mjpg
      media_content_type: image/jpg
    target:
      entity_id: media_player.kitchen_display
  - condition: and
    conditions:
      - condition: template
        value_template: >-
          {{ is_state('media_player.lg_webos_smart_tv', 'on') }}
      - condition: template
        value_template: >-
          {{ is_state_attr('media_player.lg_webos_smart_tv', 'source', 'HDMI 1') }}
  - service: shell_command.pause_humax
    data: {}
mode: single

Hmmm…looks like I didn’t resolve it after all…
The final service is never being executed - even when both of the preceding conditions are true.
Any idea why this might be?

  - condition: and
    conditions:
      - condition: template
        value_template: "{{ is_state('media_player.lg_webos_smart_tv', 'on') }}"
      - condition: template
        value_template: >-
          {{ is_state_attr('media_player.lg_webos_smart_tv', 'source', 'HDMI 1') }}
  - service: shell_command.pause_humax
    data: {}