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
last_called state attributes showing as null; api/activities returned 404:Not Found:text/html #2089
Comments
related to this thread: #2090 |
Cause is due to activities API being down. We'll need a new API endpoint as found by #2090 (comment) https://www.amazon.com/alexa-privacy/apd/rvh may be a workaround url but will require webscraping. Preference is still an actual API as webscraping is incredibly brittle. |
Are you sure it would work? But the URL depends on where the user is. For example, the .com shows me no activity at all. The .de does. |
The current code chooses the domain. Again, these are notes for whoever wants to fix it. They will need to figure out the proper way to handle. |
This won't work for me as the activity history for my account seems to shows nothing. |
If you check the network xhr requests made from that URL, there is a direct api request URL (different from the above) that returns JSON with most recent used alexa device as the first entry in an array of objects. It seems to be:
Of course, it will only work if passed the correct headers, cookies, tokens etc. so it might be hard to access it from outside of a logged in Amazon account. One other thing to note, I tested the latency between issuing a command to an alexa device and this api returning the latest data, there is currently about a 10 second delay/cache mechanism... so this probably makes it almost worthless/pointless to be used for automations that require an immediate response. |
You can try replacing the url in alexapy and perhaps the component will have the right auth. The delay was always there since it has to round trip up to Amazon and then back. It's possible this api is slower. I forgot if we rely on the http2 push stream for the data before the url returns but it seems like something I would've done before. |
Alan, |
I used to have openHAB. But I no longer have openHAB. So I can't test it. Pull request: smarthomej/addons#235 |
Seems to be an intentional change on Amazon's part. This went out to ifttt users today. We’re writing to let you know that on October 31st, 2023 the Amazon Alexa service will no longer be available on IFTTT. Amazon has made the decision to no longer support their integration on IFTTT. Like you, many of us here on the IFTTT team use the Alexa IFTTT integration daily for things ranging from controlling lights and music in our homes to integrating with task management apps to boost productivity. We were disappointed to hear about this change, we understand it is always difficult to see an existing service removed from IFTTT. We encourage you to update your Alexa Applets to use alternative triggers prior to October 31st. You can find more information on how to update your Applets, as well as suggested alternative triggers [here]. Starting November 1st, Applets that use the Say a specific phrase trigger will be migrated to instead use the IFTTT Button Widget. Applets that use any Amazon Alexa trigger other than Say a specific phrase or any Amazon Alexa query will be archived on October 31st if they are not updated to use a different trigger and/or query prior to that date. IFTTT Community team |
Thats great.... (sarcasm) It would be really great, if someone from HA would tell us something. I posted in the forum, but apparently I am the only one who uses it, since there is no response. LOL |
I use the "last alexa" for a lot of automations and it is very important in HA. All of this is useless now. Please someone help. |
me too |
You are not the only one using it as there are 1,200 "*" but it has nothing to do with anyone at Home Assistant per se since Alexa Media Player is a custom component by Alan Tse and contributed to by 35 other contributors over the years. Not to mention it's using an unofficial API to accomplish its miraculous feats! I applaude them for what they've been able to achieve and if it's to be be no more then so be it. You can blame Amazon but not HA. But, I've not given up hope yet! I've edited my scripts/automations and fortunately, only good_night/good_morning were my biggest calls, which 99.99% of the time I make from bedroom so I have hard coded them to bedroom_echo_right (on my night stand). Car arrival script asking to close garage door was already hard coded to garage echo. The only other script/scene was "light" which I developed to turn on the lights in the area I'm in but will have to use Alexa, turn on the light and ensure Alexa's areas are properly set up. I'm sure for other users/implementations, it won't be so easy! |
But maybe there is hope. So, maybe the Service is just temporarly unavailable and works again in a few days |
As I wrote in #2089 (comment) above, it should be possible with this solution. But I don't know how reactive the contributors are. |
O maybe not! There have been lots of layoffs recently in Amazon's Alexa dev workforce... |
I may have a quite good work around for the meantime. I had an automation whitch wrotes the location of the latest movement into a variable:
I created an additional sensor around the location attribute in order to display that in a button_card Now I already wrote a custom template which translates a given movement into an alexa media_player
with a little more time it can shurely be defined a little more sophisticated, Edit 28.10: improved the macro a little |
Which folder needs to be removed? |
The one which you manually created when you followed the procedure to implement @fredo's temporary solution! The folder you should have created is |
Yay! It's back! Thanks for resolving this. It was like being back in the dark ages (two years ago). |
although the scripts works now, I have problem because each time the wrong alexa is selected |
Are you calling the HA service to refresh the last used Alexa before using the value? |
How are you doing it? Do you have an example? |
Call service.update_last_called. |
thank you for your reply. Yes I am indeed. Here is the automation I'm using for years. Never had a problem before It doesn't work properly anymore. The sensor.last_alexa is not updated properly |
That looks correct to me! Had you installed @Fredo70's interim fix? My Here is my
I had also created a media_player.last_alexa via the Universal Media Player integration as something, somewhere, at one point required
This is the script I invoke to update
(when I look at my traces, the time remaining in the wait_for_trigger has been around 4.5 seconds meaning it took roughly 1/2 second to update) My other scripts always call the above script before doing anything else:
I also issue all TTS via a single script which queues all utternaces with a variable delay based on the word count in the current message so they don't interrupt one another. My
Any questions, fire away... |
My setup is working perfectly. I manually removed the interim solution config/alexapy folder, updated Alexa Media Player to 4.7.9 and restarted HA and for example in my script that responds with status of my garage doors initiated by alexa routine via voice I have the following two sequence steps - works 100 percent of the time from the right device : service: alexa_media.update_last_called service: notify.alexa_media_last_called
title: Home Assistant |
This used to be problematic in the past (up until about 4-5 months ago) when |
Is it possible to convert this timestamp in date time? |
Agh annoying! This is still not working 100%! Damn you Amazon! @Fredo70 I'm frequently seeing 429 responses to the history URL which is too many requests - but immediately recalling the URL more often than not just works! Seems to happen even with 10 second gap between calls. You can replicate by loading the history URL in a browser and hitting F5 (refresh). Maybe we need a few retries when we get an 4xx error message :( |
@gary-sargent |
@Fredo70 stand down as it looks like the integration does already handle this. I'm seeing this in the HA logs: [alexapy.alexaapi] Backing off _static_request(...) for 0.6s (alexapy.errors.AlexapyTooManyRequestsError: Too Many Requests) Looks like it tries 5 times then gives up, and I've just been unlucky and had five in a row. Maybe we should up the retries to 10, but apart from that not much we can do. |
Of course it is but why would you want to??? |
Google is your best friend! Alas, currently not so true with Amazon/Alexa... |
Yes, but the problem is the 13 digits from the Alexa timestamp. The Unix timestamp has 10 digits. How can I remove the last 3 digits? |
Divide by 1000. It's milliseconds instead of seconds. |
429 means Amazon is literally telling you to stop. In truth we should probably not even have the retry behavior on 429s so increasing the retry count is probably not a good idea. |
@alandtse I know what you mean, but the times they send that response make no sense at all. You don't need to hammer if to cause it. Even their own website suffers from it. Maybe the flood protection they have is for all users not just you. You can literally connect once an hour and still hit it. |
I'm not being difficult here but I have had no trouble whatsoever with my installation since the first very kind fix by @Fredo70 and then the official update. Is there something I should look out for or just leave well-enough alone? |
The error you'd see in HA logs is: Unexpected error for call_service at pos 1: Too Many Requests I've only seen it once since installing the fix - so it isn't happening frequently. However if you search your FULL logs for "AlexapyTooManyRequestsError" you'll probably see lots of them. I have nearly 300. Each time this happens four more attempts are tried, then you get the giving up error I posted at the top. You will also notice that sometimes when you call the service to refresh last alexa it is very sluggish. This is because it is retrying a few times (with delays inbetween) before you finally get a result. This doesn't happen every time, but sometimes can be 5 to 10 seconds. |
Here is a series of logs where I get four fails, then the fifth worked - but you can see the delays cause the service call to take a while. From hitting the endpoint manually, I don't think the exponential back-off makes any difference to the response from the API, so personally I'd be up for making the delay 0.3s consistently, and retry up to 10 times.
|
Hey guys. My last_alexa_called was working just fine until I updated to 4.7.9 and now they're all showing "null". I've tried a couple of service calls to update but still nothing. There is nothing in the logs. What's going on? |
Thanks @garysargentpersonal, I don't have any of the 'Too Many Requests' error and I haven't noticed any sluggishness but I do have a few "A connection error occurred: An exception of type ClientConnectorError occurred."-type error for AlexaPy helpers etc but aside from that (without hunting), I seem to be ok. I suppose I should just be content but still be aware of what to look for if something goes on. It's just odd for me not to be affected when loads of others are but perhaps I shouldn't poke the bear! :) |
@lloydbayley what Amazon region are you in? I'm UK so it could be specific to my region. |
Good point....I'm in AUstralia so I use the amazon.com.au endpoint (well, it SAYS I do but I'm wondering if some of it is redirected as an afterthought somewhere in the process). Hey ho! |
@garysargentpersonal Actually, I think @ahahamyan 's comment about it working perfectly may lend a bit more credence to our theory that it may be endpoint (location)-based. It's interesting to watch and diagnose. |
Hello, I just got it back working today. Maybe this helps. So I said no OTP for this app token. My HA is available through duckdns.org Then the integration wants to open the sign in page. Signed in with two-step only and said no otp for this browser. I just don't know if this information is really helpful. Since I cannot see devices I have set up in alexa. This horrible woox thing is not integrating in local tuya, so I thought I can go the other way round and tried the alexa media player add-on.... Please delete this comment if not helpful. |
IMPORTANT: Please search the issues, including closed issues, and the FAQ before opening a new issue. The template is mandatory; failure to use it will result in issue closure.
Describe the bug
As the subject says:
To Reproduce
Expected behavior
Screenshots
Happens on all devices:
System details
const.py
or HA startup): 4.7.7pip show alexapy
or HA startup):Logs
Please provide logs.
home-assistant_2023-10-25T09-39-31.640Z.log
Additional context
The text was updated successfully, but these errors were encountered: