From 95f1b16ce2390e673c5ec7f585df72c516f0a2f6 Mon Sep 17 00:00:00 2001 From: Daniel <49846893+danielbrunt57@users.noreply.github.com> Date: Sat, 14 Sep 2024 01:46:31 -0700 Subject: [PATCH] feat: fire "alexa_media_last_called_event" after update (#2522) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- custom_components/alexa_media/media_player.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/custom_components/alexa_media/media_player.py b/custom_components/alexa_media/media_player.py index 416e70f1..e2ce6ab6 100644 --- a/custom_components/alexa_media/media_player.py +++ b/custom_components/alexa_media/media_player.py @@ -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(