TuyaMcu : Use SetOption66 to enable / disable publishing TuyaMcuReceived over Mqtt

This commit is contained in:
Shantur Rathore 2019-10-25 07:05:12 +01:00
parent 3d7e122d34
commit 4944b30830
3 changed files with 8 additions and 4 deletions

View File

@ -79,7 +79,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu
uint32_t no_power_feedback : 1; // bit 13 (v6.5.0.9) - SetOption63 - Don't scan relay power state at restart
uint32_t use_underscore : 1; // bit 14 (v6.5.0.12) - SetOption64 - Enable "_" instead of "-" as sensor index separator
uint32_t fast_power_cycle_disable : 1; // bit 15 (v6.6.0.20) - SetOption65 - Disable fast power cycle detection for device reset
uint32_t ex_tuya_dimmer_range_255 : 1; // bit 16 (v6.6.0.1) - SetOption66 - Enable or Disable Dimmer range 255 slider control
uint32_t tuya_serial_mqtt_publish : 1; // bit 16 (v6.6.0.21) - SetOption66 - Enable or Disable TuyaMcuReceived messages over Mqtt
uint32_t buzzer_enable : 1; // bit 17 (v6.6.0.1) - SetOption67 - Enable buzzer when available
uint32_t pwm_multi_channels : 1; // bit 18 (v6.6.0.3) - SetOption68 - Enable multi-channels PWM instead of Color PWM
uint32_t ex_tuya_dimmer_min_limit : 1; // bit 19 (v6.6.0.5) - SetOption69 - Limits Tuya dimmers to minimum of 10% (25) when enabled.

View File

@ -1126,7 +1126,7 @@ void SettingsDelta(void)
}
if (Settings.version < 0x06060008) {
// Move current tuya dimmer range to the new param.
if (Settings.flag3.ex_tuya_dimmer_range_255) {
if (Settings.flag3.tuya_serial_mqtt_publish) { // ex Settings.flag3.ex_tuya_dimmer_range_255 SetOption
Settings.param[P_ex_DIMMER_MAX] = 100;
} else {
Settings.param[P_ex_DIMMER_MAX] = 255;
@ -1200,7 +1200,7 @@ void SettingsDelta(void)
if (Settings.version < 0x06060014) {
// Clear unused parameters for future use
/*
Settings.flag3.ex_tuya_dimmer_range_255 = 0;
Settings.flag3.tuya_serial_mqtt_publish = 0; // ex Settings.flag3.ex_tuya_dimmer_range_255
Settings.flag3.ex_tuya_dimmer_min_limit = 0;
Settings.param[P_ex_TUYA_RELAYS] = 0;
Settings.param[P_ex_DIMMER_MAX] = 0;

View File

@ -680,7 +680,11 @@ void TuyaSerialInput(void)
ResponseAppend_P(PSTR("}}"));
MqttPublishPrefixTopic_P(RESULT_OR_TELE, PSTR(D_JSON_TUYA_MCU_RECEIVED));
if (Settings.flag3.tuya_serial_mqtt_publish) {
MqttPublishPrefixTopic_P(RESULT_OR_TELE, PSTR(D_JSON_TUYA_MCU_RECEIVED));
} else {
AddLog_P(LOG_LEVEL_DEBUG, mqtt_data);
}
XdrvRulesProcess();
if (!Tuya.low_power_mode) {