-
Notifications
You must be signed in to change notification settings - Fork 303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to utilize the new alexa_media_last_called_event
in AMP 4.13.x
#2535
Comments
alexa_media_last_called_event
in AMP 4.13.1alexa_media_last_called_event
in AMP 4.13.x
I have tried the code but the event never fires. Home assistant info: Core 2024.9.2 AMP info: Thanks! |
@Marcelo-Y The code is in
Check your logs for:
|
@Marcelo-Y The event should fire after you've manually called |
Hello, @danielbrunt57 ! Last week I've seen the event firing during some tests. Shows that the event is OK. Don't know what to do, thinking about give up of my room aware automations. Thank you! |
The Alexa last called status used to be pushed to AMP via the
Therefore, In my local modified version of AMP, I've disabled the |
Hi @danielbrunt57, Can you share which lines you edited to disable I'm trying to test if disabling this part of the polling sequence can solve some of the issues for European AMP users. It seems that when the polling call for "history records" fails the integration on HA Core newer than 2024_7_4. On version 2024_7_4 I can have polling enabled, but if I upgrade to 2024_8, 2024_9 or 2024_10... once the polling kicks in... the integration fails and there are no more notification services available. The only way to keep the integration working properly is to disable polling. At least for me. But as polling it is important for some of the automations ... is the reason why some of us we still are on 2024_7_4. |
Sure, it's in
then about line 529 right after
|
@danielbrunt57 I have set up most of these items per your instructions. However I have a couple not working and can't determine what I am doing wrong:
Scripts/automations do not proceed until the timeout period expires (30 seconds in the example though I have tried shorter and longer periods) which negates any advantage over using hard delays. Any suggestions? |
It may help if you open Dev Tools > Events and subscribe to the event alexa_media_last_called_event to see when it fires and what the data is. |
I've created this automation that creates persistent notifications for tracking various events I'm playing with...
|
RE: AMP 4.13.x will now fire an event when last_called is updated. This is great, awesome work actually. Trigger on event works beautifully. Thanks for all you do with this. |
The issue has received no activity for 60 days and will be closed in a week. |
Describe the implementation
AMP 4.13.x will now fire an event when last_called is updated.
This can be used in automations/scripts to wait for that event before continuing. I've implemented a timeout in the wait_for_trigger of 30 seconds but that might be excessive. You just want to avoid too short of a timeout in which the update last_called can succeed. This wait_for_trigger avoids the necessity of delaying a fixed period of time before proceeding after manually calling alexa_media.update_last_called. This method can then ensure that last_called was truly updated. It can also be utilized to avoid the case where the integration is not working and your scripts/automations fail to execute as the Alexa service/entity does not exist by checking if the wait_for_trigger timed out and then skipping the relevant alexa service calls.
The
event_data: summary: good night
is the last thing in the history records that was said to Alexa and is included in the event so you can include that to ensure the last_called is truly correct for this script, or you can elect to not include that check and just proceed.Following that, I have:
which is then used in if-then's to conditionally call actionable notifications or
notify.alexa_media_last_called
or whatever.or
Another nifty thing I figured out was to create a new Home Assistant user that is only used by the Alexa Skill to integrate HA with Alexa. The Alexa skill then authenticates with HA using that username and you can use that to watch for state_changed events that were triggered by that user to automatically update last_called when Alexa has been asked to do something in HA like turn this or that on|off or when you say something that turns on an Alexa scene (which is an HA script which then waits for the new AMP event to fire).
System details
const.py
or HA startup log): 4.13.1pip show alexapy
in homeasssistant container or HA startup log): 1.29.2Debug Logs (alexa_media & alexapy)
The text was updated successfully, but these errors were encountered: