Automation Chromecast from one room to another based on presence

Hi All,

First post on here so hopefully not covering something that has already been discussed or resolved but I couldn’t find anything related.

Fairly new to HA so sorry if this is an easy one.

I’m looking to use two Google Chromcast’s and two PIR sensors to duplicate the content\media from one room to the other based on presence.

I have the below so far all works minus the actual casting of the media, the other chromecast just displays the standard image that loads when something is getting ready to cas but nothing is displayed.

alias: Move Media CC Kitch - FR TEST
description: ""
trigger:
  - type: occupied
    platform: device
    device_id: b6bd9dbb7832a6830826b6c56876a5d0
    entity_id: binary_sensor.occupancy
    domain: binary_sensor
condition:
  - condition: state
    entity_id: media_player.kitchen_tv
    state: playing
action:
  - service: media_player.turn_on
    entity_id: media_player.front_room_tv
  - delay: "00:00:05"
  - service: media_player.media_pause
    entity_id: media_player.kitchen_tv
  - service: media_player.play_media
    data_template:
      entity_id: media_player.front_room_tv
      media_content_type: "{{ states.media_player.kitchen_tv.attributes.media_content_type }}"
      media_content_id: "{{ states.media_player.kitchen_tv.attributes.media_content_id }}"
  - service: media_player.media_play
    entity_id: media_player.front_room_tv
  - delay: "00:00:05"
  - service: media_player.media_play
    data: {}
    target:
      entity_id:
        - media_player.kitchen_tv
mode: single

I think its an issue with the lack of detail on media type and ID as below;

   data_template:
      entity_id: media_player.front_room_tv
      media_content_type: "{{ states.media_player.kitchen_tv.attributes.media_content_type }}"
      media_content_id: "{{ states.media_player.kitchen_tv.attributes.media_content_id }}"

I have tried adding other state attributes but when using the above it fails as below when adding this;

  media_position: "{{ states.media_player.kitchen_tv.attributes.media_position }}"

error

I have also tested using the below but get the same error

  media_position: "{{ state_attr('media_player.kitchen_tv', 'media_position') }}"

Thanks to all any help would be great.

Cheers