-
Notifications
You must be signed in to change notification settings - Fork 638
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
alexa: fix device discovery / state callback #2388
Conversation
alexa device discovery/state calls use URL of type /api/hash_id_key_whatever/lights This is blocked when API is disabled and fails also when http API is enabled because no apikey is sent by amazon calls This commit grabs the "whatever Amazon Hash" during device recognition and save it. All requets to URLS starting with /api/hash_id_key_whatever are now passing the auth check
Check this out: So we have
|
Yes indeed, it would be better to move the check maybe to alexa.cpp and have only minimal changes in api.cpp ? About topic 2: EDIT: Do you have any idea about length of "amazon_hash" from "/api/amazon_hash/.." ? At my account it has a length of 40 bytes |
edit: ok, my bad twice, coffee time... it's meant to parse the stuff after the lights i.e. /api/+/lights/whatever, so it is doing the right thing No idea where we might find the 'official' hue api, but http://www.burgestrand.se/hue-api/api/auth/registration/ refers to this as username and sets this value between 10 and 40 bytes. It is a weird workaround either way, but I guess we will achieve the same thing by modifying |
And we can also assume the path starts with |
Hmm, |
Uuuh, I had also not enough coffee This little patch should fix alexa:
|
For now, yes. With a comment notice + |
EDIT: Ok, I will modify the pull request . index > 14 is ok, because the slash at "/lights" is included and the if condition of the patch uses ">" and not ">="
--> result = 15 |
This reverts commit 56a5dcc.
Don't try to use the http api for alexa calls. Responses for alexa are done by fauxmoesp lib, so there's no need for the http api call.
alexa device discovery/state calls use URL of type
/api/hash_id_key_whatever/lights
This is blocked when API is disabled and fails
also when http API is enabled because no apikey is
sent by amazon calls
This commit grabs the "whatever Amazon Hash" during
device recognition and save it. All requets to URLS
starting with /api/hash_id_key_whatever are now
passing the auth check