mirror of https://github.com/arendst/Tasmota.git
tuya: Autoconfigure Dimmer ID when SetOption34 == 0, use 0 as default for TUYA_DIMMER_ID
This commit is contained in:
parent
0052de8b88
commit
2d94b7cc7c
|
@ -354,7 +354,7 @@
|
|||
//#define USE_MP3_PLAYER // Use of the DFPlayer Mini MP3 Player RB-DFR-562 commands: play, volume and stop
|
||||
#define MP3_VOLUME 10 // Set the startup volume on init, the range can be 0..30(max)
|
||||
#define USE_TUYA_DIMMER // Add support for Tuya Serial Dimmer
|
||||
#define TUYA_DIMMER_ID 3 // Default dimmer Id
|
||||
#define TUYA_DIMMER_ID 0 // Default dimmer Id
|
||||
|
||||
// Power monitoring sensors -----------------------
|
||||
#define USE_PZEM004T // Add support for PZEM004T Energy monitor (+2k code)
|
||||
|
|
|
@ -104,7 +104,7 @@ void KNX_CB_Action(message_t const &msg, void *arg);
|
|||
#define USE_MP3_PLAYER // Use of the DFPlayer Mini MP3 Player RB-DFR-562 commands: play, volume and stop
|
||||
#define MP3_VOLUME 10 // Set the startup volume on init, the range can be 0..30(max)
|
||||
#define USE_TUYA_DIMMER // Add support for Tuya Serial Dimmer
|
||||
#define TUYA_DIMMER_ID 3 // Default dimmer Id
|
||||
#define TUYA_DIMMER_ID 0 // Default dimmer Id
|
||||
#define USE_PZEM004T // Add support for PZEM004T Energy monitor (+2k code)
|
||||
#define USE_PZEM_AC // Add support for PZEM014,016 Energy monitor (+1k1 code)
|
||||
#define USE_PZEM_DC // Add support for PZEM003,017 Energy monitor (+1k1 code)
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#ifdef USE_TUYA_DIMMER
|
||||
|
||||
#ifndef TUYA_DIMMER_ID
|
||||
#define TUYA_DIMMER_ID 3
|
||||
#define TUYA_DIMMER_ID 0
|
||||
#endif
|
||||
#define TUYA_BUFFER_SIZE 256
|
||||
|
||||
|
@ -128,6 +128,12 @@ void TuyaPacketProcess()
|
|||
snprintf_P(log_data, sizeof(log_data), PSTR("TYA: Rcvd Dim State=%d"), tuya_buffer[13]);
|
||||
AddLog(LOG_LEVEL_DEBUG);
|
||||
|
||||
if (!Settings.param[P_TUYA_DIMMER_ID]) {
|
||||
snprintf_P(log_data, sizeof(log_data), PSTR("TYA: Autoconfiguring Dimmer ID %d"), tuya_buffer[6]);
|
||||
AddLog(LOG_LEVEL_DEBUG);
|
||||
Settings.param[P_TUYA_DIMMER_ID] = tuya_buffer[6];
|
||||
}
|
||||
|
||||
tuya_new_dim = round(tuya_buffer[13] * (100. / 255.));
|
||||
if((power) && (tuya_new_dim > 0) && (abs(tuya_new_dim - Settings.light_dimmer) > 2)) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue