Fix slider for PWM_MODULE

This commit is contained in:
Federico Leoni 2020-05-20 22:11:07 -03:00
parent 7f40acb0a5
commit 5e6010d1d0
1 changed files with 7 additions and 7 deletions

View File

@ -195,10 +195,15 @@ void HAssAnnounceRelayLight(void)
bool ct_light = false; // Controls a CT Light when SetOption37 is >= 128 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 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 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 dimmer = 1;
uint8_t max_lights = 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 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 (PwmMulti) { max_lights = Light.subtype; }
@ -255,13 +260,8 @@ void HAssAnnounceRelayLight(void)
TryResponseAppend_P(HASS_DISCOVER_DEVICE_INFO_SHORT, unique_id, ESP_getChipId()); TryResponseAppend_P(HASS_DISCOVER_DEVICE_INFO_SHORT, unique_id, ESP_getChipId());
#ifdef USE_LIGHT #ifdef USE_LIGHT
if ((i >= Light.device) if ((i >= Light.device)) {
#ifdef ESP8266 if (!RelayX || PwmMod) {
|| PWM_DIMMER == my_module_type
#endif
)
{
if (!RelayX) {
char *brightness_command_topic = stemp1; 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 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]; char channel_num[9];