Browse Source

alexa: fix device discovery / state callback (#2388)

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

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.
mcspr-patch-1
aL1aL7 4 years ago
committed by GitHub
parent
commit
f6582ecd18
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions
  1. +6
    -0
      code/espurna/api.cpp

+ 6
- 0
code/espurna/api.cpp View File

@ -224,6 +224,12 @@ bool _apiRequestCallback(AsyncWebServerRequest* request) {
} }
if (!url.startsWith("/api/")) return false; if (!url.startsWith("/api/")) return false;
// [alexa] don't call the http api -> response for alexa is done by fauxmoesp lib
#if ALEXA_SUPPORT
if (url.indexOf("/lights") > 14 ) return false;
#endif
if (!apiAuthenticate(request)) return false; if (!apiAuthenticate(request)) return false;
return _apiDispatchRequest(url, request); return _apiDispatchRequest(url, request);


Loading…
Cancel
Save