Fix: Tuya Switches are detected as dimmers.

Tuya switches are detected as dimmers even after setting SetOption65 to 1.
Currently SetOption65 just hides the dimmer from Web UI for Tuya switches with SetOption65 to 1 but they are advertised as dimmer to HASS.
With this change we set light_type to LT_BASIC (on/off) instead of LT_SERIAL1 (dimmable) when option 65 is set.
This commit is contained in:
Shantur Rathore 2019-08-20 11:13:37 +01:00
parent 1c7fd88ec4
commit 9fb804b426
3 changed files with 10 additions and 4 deletions

View File

@ -621,6 +621,9 @@ void CmndSetoption(void)
if (18 == pindex) { // SetOption68 for multi-channel PWM, requires a reboot
restart_flag = 2;
}
if (15 == pindex) { // SetOption65 for tuya_disable_dimmer requires a reboot
restart_flag = 2;
}
}
}
else { // SetOption32 .. 49

View File

@ -942,9 +942,7 @@ void HandleRoot(void)
if ((LST_COLDWARM == (light_type &7)) || (LST_RGBWC == (light_type &7))) {
WSContentSend_P(HTTP_MSG_SLIDER1, LightGetColorTemp());
}
if (!Settings.flag3.tuya_disable_dimmer) {
WSContentSend_P(HTTP_MSG_SLIDER2, Settings.light_dimmer);
}
WSContentSend_P(HTTP_MSG_SLIDER2, Settings.light_dimmer);
}
#endif
WSContentSend_P(HTTP_TABLE100);

View File

@ -291,7 +291,12 @@ bool TuyaModuleSelected(void)
Settings.my_gp.io[3] = GPIO_TUYA_RX;
restart_flag = 2;
}
light_type = LT_SERIAL1;
if (Settings.flag3.tuya_disable_dimmer == 0) {
light_type = LT_SERIAL1;
} else {
light_type = LT_BASIC;
}
return true;
}