add gas sensor with %LEL units

This commit is contained in:
blakadder 2021-03-29 20:32:59 +02:00
parent e4e0eb9467
commit 3768d5ab9f
3 changed files with 9 additions and 5 deletions

View File

@ -843,6 +843,7 @@ const char HTTP_SNS_COLOR_RED[] PROGMEM = "{s}%s " D_COLOR_RED "{
const char HTTP_SNS_COLOR_GREEN[] PROGMEM = "{s}%s " D_COLOR_GREEN "{m}%u " "{e}";
const char HTTP_SNS_COLOR_BLUE[] PROGMEM = "{s}%s " D_COLOR_BLUE "{m}%u " "{e}";
const char HTTP_SNS_MILLILITERS[] PROGMEM = "{s}%s " D_VOLUME "{m}%s " D_UNIT_MILLILITERS "{e}";
const char HTTP_SNS_GAS[] PROGMEM = "{s}%s " D_GAS "{m}%d " D_UNIT_PERCENT "LEL{e}";
#endif // USE_WEBSERVER
#endif // _I18N_H_

View File

@ -430,7 +430,7 @@ enum TuyaSupportedFunctions { TUYA_MCU_FUNC_NONE,
TUYA_MCU_FUNC_LOWPOWER_MODE = 51,
TUYA_MCU_FUNC_ENUM1 = 61, TUYA_MCU_FUNC_ENUM2, TUYA_MCU_FUNC_ENUM3, TUYA_MCU_FUNC_ENUM4,
TUYA_MCU_FUNC_TEMP = 71, TUYA_MCU_FUNC_TEMPSET, TUYA_MCU_FUNC_HUM, TUYA_MCU_FUNC_HUMSET,
TUYA_MCU_FUNC_LX = 75, TUYA_MCU_FUNC_TVOC, TUYA_MCU_FUNC_CO2, TUYA_MCU_FUNC_ECO2,
TUYA_MCU_FUNC_LX = 75, TUYA_MCU_FUNC_TVOC, TUYA_MCU_FUNC_CO2, TUYA_MCU_FUNC_ECO2, TUYA_MCU_FUNC_GAS,
TUYA_MCU_FUNC_TIMER1 = 81, TUYA_MCU_FUNC_TIMER2, TUYA_MCU_FUNC_TIMER3, TUYA_MCU_FUNC_TIMER4,
TUYA_MCU_FUNC_MOTOR_DIR = 97,
TUYA_MCU_FUNC_ERROR = 98,

View File

@ -95,9 +95,9 @@ struct TUYA {
#define D_CMND_TUYA_SET_HUM "SetHum"
#define D_CMND_TUYA_SET_TIMER "SetTimer"
const char kTuyaSensors[] PROGMEM = // Lit of available sensors (can be expanded in the future)
const char kTuyaSensors[] PROGMEM = // List of available sensors (can be expanded in the future)
"" D_JSON_TEMPERATURE "|TempSet|" D_JSON_HUMIDITY "|HumSet|" D_JSON_ILLUMINANCE
"|" D_JSON_TVOC "|" D_JSON_ECO2 "|" D_JSON_CO2 "|||Timer1|Timer2|Timer3|TImer4";
"|" D_JSON_TVOC "|" D_JSON_ECO2 "|" D_JSON_CO2 "|" D_JSON_GAS "||Timer1|Timer2|Timer3|TImer4";
const char kTuyaCommand[] PROGMEM = D_PRFX_TUYA "|" // Prefix
D_CMND_TUYA_MCU "|" D_CMND_TUYA_MCU_SEND_STATE "|" D_CMND_TUYARGB "|" D_CMND_TUYA_ENUM "|" D_CMND_TUYA_ENUM_LIST;
@ -268,7 +268,7 @@ void CmndTuyaEnum(void) { // Command to control up to four type 4 Enum
if (added) {
ResponseAppend_P(PSTR(","));
}
ResponseAppend_P(PSTR("\"Enum%d\":%d"), i + 1, Tuya.EnumState[i]); // Returns the avtual values of Enum as list
ResponseAppend_P(PSTR("\"Enum%d\":%d"), i + 1, Tuya.EnumState[i]); // Returns the actual values of Enum as list
added = true;
}
}
@ -392,7 +392,7 @@ inline bool TuyaFuncIdValid(uint8_t fnId) {
(fnId >= TUYA_MCU_FUNC_MOTOR_DIR && fnId <= TUYA_MCU_FUNC_DUMMY) ||
(fnId == TUYA_MCU_FUNC_LOWPOWER_MODE) ||
(fnId >= TUYA_MCU_FUNC_TEMP && fnId <= TUYA_MCU_FUNC_HUMSET) ||
(fnId >= TUYA_MCU_FUNC_LX && fnId <= TUYA_MCU_FUNC_ECO2) ||
(fnId >= TUYA_MCU_FUNC_LX && fnId <= TUYA_MCU_FUNC_GAS) ||
(fnId >= TUYA_MCU_FUNC_TIMER1 && fnId <= TUYA_MCU_FUNC_TIMER4);
}
uint8_t TuyaGetFuncId(uint8_t dpid) {
@ -1381,6 +1381,9 @@ void TuyaSensorsShow(bool json)
case 78:
WSContentSend_PD(HTTP_SNS_CO2EAVG, "", Tuya.Sensors[7]);
break;
case 79:
WSContentSend_PD(HTTP_SNS_GAS, "", Tuya.Sensors[8]);
break;
case 81:
case 82:
case 83: