stub for Tasmota http commands interface

This commit is contained in:
openshwprojects
2022-04-13 18:08:28 +02:00
parent 26ae84cd83
commit 58e36cd335
3 changed files with 28 additions and 0 deletions

View File

@ -892,6 +892,32 @@ int http_fn_cfg_ha(http_request_t *request) {
poststr(request, NULL);
return 0;
}
// https://tasmota.github.io/docs/Commands/#with-mqtt
/*
http://<ip>/cm?cmnd=Power%20TOGGLE
http://<ip>/cm?cmnd=Power%20On
http://<ip>/cm?cmnd=Power%20off
http://<ip>/cm?user=admin&password=joker&cmnd=Power%20Toggle
*/
// https://www.elektroda.com/rtvforum/viewtopic.php?p=19330027#19330027
// Web browser sends: GET /cm?cmnd=POWER1
// System responds with state
int http_fn_cm(http_request_t *request) {
char tmpA[128];
http_setup(request, httpMimeTypeJson);
if( http_getArg(request->url,"cmd",tmpA,sizeof(tmpA))) {
//CMD_ExecuteCommand(
}
poststr(request,"{\"POWER1\":\"OFF\"}");
poststr(request, NULL);
return 0;
}
int http_fn_cfg(http_request_t *request) {
int i,j,k;

View File

@ -25,3 +25,4 @@ int http_fn_ota_exec(http_request_t *request);
int http_fn_ota(http_request_t *request);
int http_fn_empty_url(http_request_t *request);
int http_fn_other(http_request_t *request);
int http_fn_cm(http_request_t *request);

View File

@ -527,6 +527,7 @@ int HTTP_ProcessPacket(http_request_t *request) {
if(http_checkUrlBase(urlStr,"ota")) return http_fn_ota(request);
if(http_checkUrlBase(urlStr,"ota_exec")) return http_fn_ota_exec(request);
if(http_checkUrlBase(urlStr,"cm")) return http_fn_cm(request);
return http_fn_other(request);
}