Alexa Media Player to control Amazon Astro robot from Home Assistant

There is little documentation of Amazon Astro robot since it is in currently “Day 1 edition” sold by invitation only from amazon. I would like to provide documentation of my findings for Astro functions that are controllable from Home assistant (HA) alexa media player. In general most of the functions that are elicited by a voice command to Astro will also work with HA alexa media player (examples below). The major exception is when a function results in Astro showing what amazon calls “expressions” which are changes in robot’s eyes, screen position or associated limited range wheel movements. There are workarounds to control some expression functions which are available in “routines” in the alexa app (example shown below). I used the “Current state Amazon Echo/Alexa in 12/2022” as a guide.

examples:

astro say something
script:
wife_i_love_you:
  sequence:
  - service: notify.alexa_media
    data_template:
      target:
      - media_player.astro
      message: wife, I love you
      data:
        type: tts
        method: speak

ask Astro to dance (doesn't work, unable to evoke expressions, Astro responds "I don't know")
script:
dance:
  sequence:
 - service: media_player.play_media
    target:
      entity_id: media_player.astro
    data:
      media_content_type: custom
      media_content_id:  'dance'
 mode: single


workaround to get HA to control Astro dance
script: 
astro_dance:
  alias: astro dance
  sequence:
  - service: input_button.press  # in alexa app, create routine that is triggered by input_button.ha_dance and "add action" set to "astro dance" in the alexa app
    data: {}
    target:
      entity_id: input_button.ha_dance
  mode: single

HA to trigger Astro to take picture or movie
script:
astro_picture:
  alias: Astro picture
  icon: mdi:play
  sequence:
  - service: media_player.play_media
    target:
      entity_id: media_player.astro
    data:
      media_content_type: custom
      media_content_id: 'take a picture'  #take a movie works too, interestingly Astro spins in a circle to find someone to take a picture of before extending the periscope camera, does not the spin with a verbal command
  mode: single

Start amazon services on the Astro screen
script:
astro_amazon_prime:
  alias: Astro amazon prime
  icon: mdi:play
  sequence:
  - service: media_player.play_media
    target:
      entity_id: media_player.astro
    data:
      media_content_type: custom
      media_content_id: 'open amazon prime video' #works with other features of Astro like netflix, and buy something (latter I would be very surprised if that didn't work)
  mode: single

I have been unable to show a picture on Astro's screen like can be done with echo show devices

Astro go to a place in the house
script:
go_to_front_door:
  alias: Astro go to the front door
  icon: mdi:play
  sequence:
  - service: media_player.play_media
    target:
      entity_id: media_player.astro
    data:
      media_content_type: custom
      media_content_id: go to the front door   # 'front door' is defined in the Astro app with initial house map setup
  mode: single

Astro go to front door when the ring camera detects a person, this is wonderful feature to scare off solicitors
automation:
 alias: astro answers door cam
  description: ''
  trigger:
  - platform: state
    entity_id: binary_sensor.door_cam_motion
    to: 'on'
    from: 'off'
  condition:
  - condition: template
    value_template: '{{ as_timestamp(states.binary_sensor.front_door.last_changed)
      + 300 < as_timestamp(now()) }}' #Astro ignores if door has been opened recently so leaving house doesnt trigger astro going to the door
  - condition: template
    value_template: '{{ (now()|as_timestamp - state_attr('automation.astro_answers_door_cam',''last_triggered'')|as_timestamp)
      > 3600 }}'  #Astro ignores repeated recent door motion triggers
  action:
  - service: script.go_to_front_door
    data: {}
  - delay: 00:00:20  # gives some time for Astro to get to the front door before the announcement
  - service: notify.alexa_media_astro
    data:
      message: Welcome to our house!
  mode: single

Astro encourages wife if she is having a bad day (requires installation of the "Alexa actionable notification" skill).  When Astro "sees" wife with face recognition, Astro is triggered to ask if she is having good day.  Wife's answer will triggers a second automation which she responds yes or no to, each answer having a corresponding Astro response. 

automation:
alias: actionable notification Astro sees wife  
  description: ''
  trigger:
  - platform: state
    entity_id:
    - input_button.astro_sees_wife  #create input_button.astro_sees_wife in HA and in alexa app create routine which actives button when Astro sees wife
  condition:
  - condition: template
    value_template: '{{ (now()|as_timestamp - state_attr(''automation.actionable_notification_astro_sees_wife'',''last_triggered'')|as_timestamp)
      > 21000 }}'  #prevents Astro annoying wife all day
  action:
  - service: script.activate_alexa_actionable_notification
    data:
      text: Are you having a good day?
      event_id: astro_wife
      alexa_device: media_player.astro

automation:
  alias: Astro wife Response
  trigger:
  - platform: event
    event_type: alexa_actionable_notification
    event_data:
      event_id: astro_wife
      event_response_type: ResponseYes
  - platform: event
    event_type: alexa_actionable_notification
    event_data:
      event_id: astro_wife
      event_response_type: ResponseNo
  action:
  - service: input_text.set_value
    data:
      value: '{{ response_type }}'
    target:
      entity_id: input_text.astro_sees_wife_response_type
  - service: input_text.set_value
    data:
      value: '{{ response }}'
    target:
      entity_id: input_text.astro_sees_wife_response
  - choose:
    - conditions: '{{ response_type == "ResponseNo" }}'  #if wife says no, Astro responses "let me make your day better", then does a dance
      sequence:
      - service: notify.alexa_media
        data:
          message: let me make your day better
          target: '{{ device }}'
      - delay: 00:00:05
      - service: script.astro_dance
    - conditions: '{{ response_type == "ResponseYes" }}'  #if wife says yes, Astro responses "thats great, have a great day"
      sequence:
      - service: notify.alexa_media
        data:
          message: thats great, have a great day
          target: '{{ device }}'
    default:
    - service: notify.alexa_media
      data:
        message: Oops, this should never happen. Check your scripts!
        target: '{{ device }}'
  mode: single
  variables:
    response_type: '{{ trigger.event.data.event_response_type }}'
    response: '{{ trigger.event.data.event_response }}'
    device: media_player.astro



In general the commands you send to Astro and what Astro says back both show on Astro’s screen.
I would appreciate input from other people’s experience and ideas.