Skip to content

Commit

Permalink
feat: fire "alexa_media_last_called_event" after update (#2522)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
danielbrunt57 and pre-commit-ci[bot] committed Sep 14, 2024
1 parent e55b198 commit 95f1b16
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions custom_components/alexa_media/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,15 @@ async def _refresh_if_no_audiopush(already_refreshed=False):
self.hass.data[DATA_ALEXAMEDIA]["accounts"][email]["http2"]
)
self.async_schedule_update_ha_state(force_refresh=force_refresh)
if self._last_called:
self.hass.bus.async_fire(
"alexa_media_last_called_event",
{
"last_called": self.device_serial_number,
"timestamp": self._last_called_timestamp,
"summary": self._last_called_summary,
},
)
elif "bluetooth_change" in event:
if event_serial == self.device_serial_number:
_LOGGER.debug(
Expand Down

1 comment on commit 95f1b16

@NordFreak
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your research and your work!

Please sign in to comment.