Configuration: Events - alandtse/alexa_media_player GitHub Wiki

Minimum Version: 2.9.0

Events

The component will provide the following events:

  • alexa_media_relogin_required - (>= 3.0.0) The component has detected a need to relogin. This may be useful to detect when services will stop working because the cookies have expired. It will return two values:

    1. email - The account
    2. url - The Amazon url

    DEPRECATION WARNING: This was previously alexa_media_player/relogin_required but was deprecated in the 3.0.0 since the HA UI does not allow testing of events with /. alexa_media_player_relogin_required was also deprecated in 3.0.0. Please switch your automations over.

  • alexa_media_relogin_success - (>= 3.0.0) The component has successfully relogged in. It will return two values:

    1. email - The account
    2. url - The Amazon url

    DEPRECATION WARNING: alexa_media_player_relogin_success was deprecated in 3.0.0. Please switch your automations over.

  • alexa_media_notification_event - (>= 3.2) An Amazon notification (Timer/Alarm/Reminder) has triggered. It will return two values:

    1. email - The account
    2. event - The notification json that triggered the event. The event should be queried to determine the type.
  • alexa_media_alarm_dismissal_event - (>= 3.10) An Amazon alarm has been dismissed. It will return two values:

    1. device - The serial number of the Echo device.
    2. event - The notification json that triggered the event. The event can be queried to determine more details.
  • alexa_media_last_called_event - An Echo device became the "last called" device, i.e. the one that most recently received a voice command. It will return five values:

    1. last_called - The serial number of the Echo device.
    2. name - The name of the Echo device.
    3. timestamp - The time of the command in milliseconds.
    4. summary - What Alexa understood, e.g. add bread to the shopping list.
    5. response - Alexa's spoken response, or None if there is none.

    If several commands are spoken within a few seconds, only the newest one is reported. Use alexa_media_voice_command below if you need every command.

  • alexa_media_voice_command - (>= 5.18.0) A voice command was spoken to an Echo. One event is fired for every new voice command in the Alexa history, oldest first, and each command is reported only once. Use it instead of last_called when several commands can be spoken within a few seconds (e.g. adding multiple items to a shopping list), because last_called only reports the newest command of such a burst. It will return five values:

    1. serial - The serial number of the Echo device.
    2. timestamp - The time of the command in milliseconds (creationTimestamp of the Alexa history record).
    3. summary - What Alexa understood, e.g. add bread to the shopping list.
    4. response - Alexa's spoken response, or null if there is none.
    5. entity_id - The media_player entity of the Echo, or null if it is unknown.

    Notes:

    • The serial is called serial here, unlike last_called in alexa_media_last_called_event.
    • The event relies on the push connection (HTTP2). When the state is only refreshed by polling, commands are not reported by this event.
    • A command can arrive late if Amazon's history does not contain it yet when the push is processed. It is then fired with a later probe, without duplicates. Use timestamp if the order matters.
    • Commands from before Home Assistant started are not replayed.

    Example automation:

    automation:
      - alias: "Log voice commands"
        trigger:
          - platform: event
            event_type: alexa_media_voice_command
        action:
          - service: persistent_notification.create
            data:
              title: "{{ trigger.event.data.entity_id }}"
              message: "{{ trigger.event.data.summary }}"
    

Automations

Please see Automations Page