Alexa: reset last command (last_called_summary)

Hi everyone,

I am using Alexa to control some stuff and therefore use the attribute last_called_summary of my echos.
However, if I said a command to Alexa like alexa switch my ablet to energy view and it did not work, I will say it again.
However, if the last_called_summary does not change (of course - it’s the same command once more), the automation will not be triggered (again).
So, I would like to reset the attribute last_called_summary to empty or whatever, to avoid this.

I was not able to find an automation action to manipulate the entities attribute (it dows work with the developer tools).
What’s the easiest way to do this?
Thanks.

You could simply say „Alexa stop“ to alter last_called_summary.
`

There isn’t a built-in service, but you can use the Hass-Entities python script to create a service that will allow you to change the value of an entity’s state and/or attributes.

service: python_script.hass_entities
data:
  action: set_attributes
  entity_id: media_player.living_room_dot
  attributes:
    - last_called_summary: "alexa this is a test"

Thre is: service: media_player.play_media

That won’t work because I am interested in a better WAF.
So asking my wife not to repeat the last command if it didn’t work is no option :wink:

Thank you, that works well. :smile:
If I choose this without a media the last summary will be reset to ''

I will keep this in mind and have already another idea to make use of it.

Thank you guys!

EDIT: :sleepy:
Too early happy play_media has reset it once, but it’s not working anymore.
I don’t have a clue why.

without a media I get:

required key not provided @ data[‘media_content_id’]. Got None required key not provided @ data[‘media_content_type’]. Got None

When I put “none” in each of them I can execute it, but it does not change the last_summary

What if you’re using


    media_content_type: custom
    media_content_id: stop

Thanks, I will give it a try as well.

However, I currently have the issue that the triggerID condition does not work on the attributes:

Executing the python script from the automation resets the attribute.
Executing the entire automation sends the message via telegram.
But the trigger condition is never met.
Obviously the change of the attribute in the trigger section is not recognized as trigger even though I have declared these properly. :frowning_face:

alias: "DEBUG: Alexa Reset"
description: ""
trigger:
  - platform: state
    entity_id:
      - media_player.enzio_s_fire_tv_cube
    attribute: last_called_summary
    id: firetv
  - platform: state
    entity_id:
      - media_player.echo_show
    attribute: last_called_summary
    id: buro
  - platform: state
    entity_id:
      - media_player.echo_kuche
    attribute: last_called_summary
    id: kuche
condition:
  - condition: state
    entity_id: group.persons
    state: home
action:
  - if:
      - condition: trigger
        id: buro
    then:
      - if:
          - condition: not
            conditions:
              - condition: state
                entity_id: media_player.echo_show
                attribute: last_called_summary
                state: nix
        then:
          - service: python_script.hass_entities
            data:
              action: set_attributes
              entity_id: media_player.echo_show
              attributes:
                - last_called_summary: nix
    enabled: true
  - service: telegram_bot.send_message
    data:
      message: Works
mode: single

I’ve tested it with last_called_summary: "" and that worked:


action:
  - if:
      - condition: trigger
        id: test
    then:
      - if:
          - condition: not
            conditions:
              - condition: state
                entity_id: media_player.echo_dotchen
                attribute: last_called_summary
                state: ""
        then:
          - service: light.toggle
            …

Thank you for looking into this.
I have it working now! :slight_smile:

EDIT:

alias: "Alexa: Kommando zurücksetzen (Büro, Küche, FireTV)"
description: ""
trigger:
  - platform: state
    entity_id:
      - media_player.echo_show
    attribute: last_called_summary
    id: buro
  - platform: state
    entity_id:
      - media_player.echo_kuche
    attribute: last_called_summary
    id: kuche
  - platform: state
    entity_id:
      - media_player.enzio_s_fire_tv_cube
    attribute: last_called_summary
    id: firetv
condition:
  - condition: state
    entity_id: group.persons
    state: home
action:
  - delay:
      hours: 0
      minutes: 0
      seconds: 2
      milliseconds: 0
  - if:
      - condition: not
        conditions:
          - condition: state
            entity_id: media_player.echo_show
            attribute: last_called_summary
            state: nix
    then:
      - service: python_script.hass_entities
        data:
          action: set_attributes
          entity_id: media_player.echo_show
          attributes:
            - last_called_summary: nix
    enabled: false
  - if:
      - condition: trigger
        id: buro
    then:
      - service: python_script.hass_entities
        data:
          action: set_attributes
          entity_id: media_player.echo_show
          attributes:
            - last_called_summary: nix
  - if:
      - condition: trigger
        id: kuche
    then:
      - service: python_script.hass_entities
        data:
          action: set_attributes
          entity_id: media_player.echo_kuche
          attributes:
            - last_called_summary: nix
  - if:
      - condition: trigger
        id: firetv
    then:
      - service: python_script.hass_entities
        data:
          action: set_attributes
          entity_id: media_player.enzio_s_fire_tv_cube
          attributes:
            - last_called_summary: nix
mode: single