Tuyamcu raw access (#1048)

* working/?

* winnermicro fix

* ENABLE_DRIVER_TUYAMCU fx

* some fixes, some unfiished

* extra check
This commit is contained in:
openshwprojects
2024-01-24 11:18:29 +01:00
committed by GitHub
parent 717c9081d7
commit 55e2a66f7d
10 changed files with 218 additions and 2 deletions

View File

@ -2573,8 +2573,11 @@ const char* g_obk_flagNames[] = {
"[TuyaMCU] Use queue",
"[HTTP] Disable authentication in safe mode (not recommended)",
"[MQTT Discovery] Don't merge toggles and dimmers into lights",
"[TuyaMCU] Store raw data",
"error",
};
"error",
};
int http_fn_cfg_generic(http_request_t* request) {
int i;
char tmpA[64];
@ -2611,7 +2614,10 @@ int http_fn_cfg_generic(http_request_t* request) {
CFG_Save_IfThereArePendingChanges();
// 32 bit type
hprintf255(request, "<h4>Flags (Current value=%i)</h4>", CFG_GetFlags());
// 64 bit - TODO fixme
//hprintf255(request, "<h4>Flags (Current value=%lu)</h4>", CFG_GetFlags64());
poststr(request, "<form action=\"/cfg_generic\">");
for (i = 0; i < OBK_TOTAL_FLAGS; i++) {

View File

@ -744,6 +744,9 @@ static int http_tasmota_json_status_generic(void* request, jsonCb_t printer) {
return 0;
}
// drv_tuyaMCU.c
int http_obk_json_dps(int id, void* request, jsonCb_t printer);
int JSON_ProcessCommandReply(const char* cmd, const char* arg, void* request, jsonCb_t printer, int flags) {
int i;
@ -1027,6 +1030,20 @@ int JSON_ProcessCommandReply(const char* cmd, const char* arg, void* request, js
else if (!wal_strnicmp(cmd, "Ch", 2)) {
http_obk_json_channels(request, printer);
}
#ifndef OBK_DISABLE_ALL_DRIVERS
#if ENABLE_DRIVER_TUYAMCU
else if (!wal_strnicmp(cmd, "Dp", 2)) {
int id = -1;
if (isdigit(cmd[2])) {
sscanf(cmd + 2, "%i", &id);
}
http_obk_json_dps(id,request, printer);
if (flags == COMMAND_FLAG_SOURCE_MQTT) {
MQTT_PublishPrinterContentsToStat((struct obk_mqtt_publishReplyPrinter_s*)request, "DP");
}
}
#endif
#endif
else {
printer(request, "{");
printer(request, "}");