diff --git a/tasmota/xdrv_01_webserver.ino b/tasmota/xdrv_01_webserver.ino index 833ed38b1..1e8647ccf 100644 --- a/tasmota/xdrv_01_webserver.ino +++ b/tasmota/xdrv_01_webserver.ino @@ -1240,18 +1240,7 @@ void HandleRoot(void) #endif // USE_SONOFF_IFAN WSContentSend_P(PSTR("")); } -#ifdef USE_TUYA_MCU - if (IsModuleTuya()) { - if (AsModuleTuyaMS()) { - WSContentSend_P(HTTP_TABLE100); - WSContentSend_P(PSTR("
")); - snprintf_P(stemp, sizeof(stemp), PSTR("" D_JSON_IRHVAC_MODE "")); - WSContentSend_P(HTTP_DEVICE_CONTROL, 26, TasmotaGlobal.devices_present + 1, - (strlen(SettingsText(SET_BUTTON1 + TasmotaGlobal.devices_present))) ? SettingsText(SET_BUTTON1 + TasmotaGlobal.devices_present) : stemp, ""); - WSContentSend_P(PSTR("")); - } - } -#endif // USE_TUYA_MCU + #ifndef FIRMWARE_MINIMAL XdrvCall(FUNC_WEB_ADD_MAIN_BUTTON); XsnsCall(FUNC_WEB_ADD_MAIN_BUTTON); diff --git a/tasmota/xdrv_06_snfbridge.ino b/tasmota/xdrv_06_snfbridge.ino index 62a7db8c1..c3aa42bd8 100644 --- a/tasmota/xdrv_06_snfbridge.ino +++ b/tasmota/xdrv_06_snfbridge.ino @@ -503,7 +503,7 @@ void CmndRfRaw(void) #ifdef USE_WEBSERVER -void SonoffBridgeAddFuctionButtons(void) { +void SonoffBridgeAddButton(void) { WSContentSend_P(HTTP_TABLE100); WSContentSend_P(PSTR("")); char number[4]; @@ -550,7 +550,7 @@ bool Xdrv06(uint8_t function) break; #ifdef USE_WEBSERVER case FUNC_WEB_ADD_MAIN_BUTTON: - SonoffBridgeAddFuctionButtons(); + SonoffBridgeAddButton(); break; case FUNC_WEB_GET_ARG: SonoffBridgeWebGetArg(); diff --git a/tasmota/xdrv_16_tuyamcu.ino b/tasmota/xdrv_16_tuyamcu.ino index 250c28b21..5750839c5 100644 --- a/tasmota/xdrv_16_tuyamcu.ino +++ b/tasmota/xdrv_16_tuyamcu.ino @@ -1442,15 +1442,31 @@ void TuyaSensorsShow(bool json) #endif // USE_WEBSERVER } } - #ifdef USE_WEBSERVER +#ifdef USE_WEBSERVER if (AsModuleTuyaMS()) { WSContentSend_P(PSTR("{s}" D_JSON_IRHVAC_MODE "{m}%d{e}"), Tuya.ModeSet); } - #endif // USE_WEBSERVER +#endif // USE_WEBSERVER if (RootName) { ResponseJsonEnd();} } +#ifdef USE_WEBSERVER + +void TuyaAddButton(void) { + if (AsModuleTuyaMS()) { + WSContentSend_P(HTTP_TABLE100); + WSContentSend_P(PSTR("
")); + char stemp[33]; + snprintf_P(stemp, sizeof(stemp), PSTR("" D_JSON_IRHVAC_MODE "")); + WSContentSend_P(HTTP_DEVICE_CONTROL, 26, TasmotaGlobal.devices_present + 1, + (strlen(SettingsText(SET_BUTTON1 + TasmotaGlobal.devices_present))) ? SettingsText(SET_BUTTON1 + TasmotaGlobal.devices_present) : stemp, ""); + WSContentSend_P(PSTR("")); + } +} + +#endif // USE_WEBSERVER + /*********************************************************************************************\ * Interface \*********************************************************************************************/ @@ -1507,6 +1523,9 @@ bool Xdrv16(uint8_t function) TuyaSensorsShow(1); break; #ifdef USE_WEBSERVER + case FUNC_WEB_ADD_MAIN_BUTTON: + TuyaAddButton(); + break; case FUNC_WEB_SENSOR: TuyaSensorsShow(0); break;