From 5e6010d1d09baf7559b3b885b2fe37ef98c44640 Mon Sep 17 00:00:00 2001 From: Federico Leoni Date: Wed, 20 May 2020 22:11:07 -0300 Subject: [PATCH] Fix slider for PWM_MODULE --- tasmota/xdrv_12_home_assistant.ino | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tasmota/xdrv_12_home_assistant.ino b/tasmota/xdrv_12_home_assistant.ino index e9d8bd009..292ce3831 100644 --- a/tasmota/xdrv_12_home_assistant.ino +++ b/tasmota/xdrv_12_home_assistant.ino @@ -195,10 +195,15 @@ void HAssAnnounceRelayLight(void) bool ct_light = false; // Controls a CT Light when SetOption37 is >= 128 bool wt_light = false; // Controls a White Light when SetOption37 is >= 128 bool err_flag = false; // When true it blocks the creation of entities if the order of the Relays is not correct to avoid issue with Lights + bool PwmMod = false; // Controls PWM_DIMMER module uint8_t dimmer = 1; uint8_t max_lights = 1; + #ifdef ESP8266 + if (PWM_DIMMER == my_module_type) { PwmMod = true; } + #endif //ESP8266 + // If there is a special Light to be enabled and managed with SetOption68 or SetOption37 >= 128, Discovery calculates the maximum number of entities to be generated in advance if (PwmMulti) { max_lights = Light.subtype; } @@ -255,13 +260,8 @@ void HAssAnnounceRelayLight(void) TryResponseAppend_P(HASS_DISCOVER_DEVICE_INFO_SHORT, unique_id, ESP_getChipId()); #ifdef USE_LIGHT - if ((i >= Light.device) - #ifdef ESP8266 - || PWM_DIMMER == my_module_type - #endif - ) - { - if (!RelayX) { + if ((i >= Light.device)) { + if (!RelayX || PwmMod) { char *brightness_command_topic = stemp1; strncpy_P(stemp3, Settings.flag.not_power_linked ? PSTR("last") : PSTR("brightness"), sizeof(stemp3)); // SetOption20 - Control power in relation to Dimmer/Color/Ct changes char channel_num[9];