From 45286b5881ed47125bcefbbfbe5783362923db65 Mon Sep 17 00:00:00 2001 From: Adrian Scillato <35405447+ascillato@users.noreply.github.com> Date: Sat, 28 Aug 2021 15:02:06 -0300 Subject: [PATCH] Fix compilation if undef USE_LIGHT and def USE_HOME_ASSISTANT --- tasmota/xdrv_12_home_assistant.ino | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tasmota/xdrv_12_home_assistant.ino b/tasmota/xdrv_12_home_assistant.ino index 5fb759f15..38ce11a41 100644 --- a/tasmota/xdrv_12_home_assistant.ino +++ b/tasmota/xdrv_12_home_assistant.ino @@ -422,7 +422,9 @@ void HAssAnnounceRelayLight(void) char stemp3[TOPSZ]; char unique_id[30]; +#ifdef USE_LIGHT bool LightControl = light_controller.isCTRGBLinked(); // SetOption37 - Color remapping for led channels, also provides an option for allowing independent handling of RGB and white channels +#endif //USE_LIGHT bool PwmMulti = Settings->flag3.pwm_multi_channels; // SetOption68 - Multi-channel PWM instead of a single light bool is_topic_light = false; // Switch HAss domain between Lights and Relays bool ind_light = false; // Controls Separated Lights when SetOption37 is >= 128 @@ -448,14 +450,15 @@ void HAssAnnounceRelayLight(void) if (TUYA_DIMMER == TasmotaGlobal.module_type || SK03_TUYA == TasmotaGlobal.module_type) { TuyaMod = true; } #endif //ESP8266 +#ifdef USE_LIGHT // 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; } if (!LightControl) { ind_light = true; if (!PwmMulti) { max_lights = 2;} } +#endif //USE_LIGHT #ifdef USE_SHUTTER if (Settings->flag3.shutter_mode) { @@ -500,9 +503,11 @@ void HAssAnnounceRelayLight(void) if (bitRead(shutter_mask, i-1)) { // suppress shutter relays +#ifdef USE_LIGHT } else if ((i < Light.device) && !RelayX) { err_flag = true; AddLog(LOG_LEVEL_ERROR, PSTR("%s"), kHAssError2); +#endif //USE_LIGHT } else { if (Settings->flag.hass_discovery && (RelayX || (Light.device > 0) && (max_lights > 0)) && !err_flag ) { // SetOption19 - Control Home Assistant automatic discovery (See SetOption59)