Here's how I solved a number of issues #2004
danielbrunt57
started this conversation in
Show and tell
Replies: 2 comments
-
Thanks. Converted to a discussion. You are already able to edit the wiki so please feel free to just add this in there and you can then close this too. |
Beta Was this translation helpful? Give feedback.
0 replies
-
With the recent HTTP2 fix to Alexa media, I'm finding that the update last_alexa is no longer necessary as last_alexa seems to be updating almost instantly now, even quicker than before, and the timestamp I added may no longer have any useful benefit. The sequential script to execute notifications though is still useful to prevent them from interrupting each other. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is your feature request related to a problem? Please describe.
Sort of except it's not a feature request but a "Here's how I solved the delay issue in updating last_alexa!"
It's been very annoying to have to add hard-coded delays to scripts following the alexa_media.update_last_called service call to update the last called Alexa. The delays were required to permit the integration time to update the media_players
last_called
andlast_called_timestamps
which now do not seem to occur in a timely fashion thus making the service call essential, but there was no way to determine when that process finished, or if it even took place due to no change being necessary, but, I think I've finally solved it.Describe the solution you'd like
Provide additional info in the wiki to include a new attribute
last_updated_timestamp
which can then be used as a trigger to permit scripts/automations to wait for a change in that timestamp and then proceed when it occurs, with an appropriate default timeout as a failsafe.Since I've implemented my new logic for calling all these scripts, my notifications (actionable or otherwise) can now proceed much quicker and I've not had any failures in targeting the correct last called alexa device.
The other thing I overcame a while ago was multiple notifications occurring and interrupting the previous one still speaking.
Additional context
The first step I did was to create a single queued script that I invoke for all notifications (except actionable). It counts the number of words to be uttered and waits for that word count x 0.4 seconds (which seemed to be a good average for my utterances) before ending and executing the next one.
Actionable notifications are also queued but do not have to count words:
This is the script that gets called to update last_alexa at the beginning of all scripts & automations which invoke either alexa notifications or actionable notifications:
This is the key piece for the previous script - Add a last_called_timestamp attribute to the sensor.last_alexa template:
I can now execute my good_night/morning scripts with multiple actions running in parallel and they all execute much faster and do not interrupt previous utterances in progress or say the wrong phrase in an actionable one or wait excessively:
Beta Was this translation helpful? Give feedback.
All reactions