@@ -54,8 +54,7 @@ const char HASS_DISCOVER_LIGHT_DIMMER[] PROGMEM =
54
54
const char HASS_DISCOVER_LIGHT_COLOR[] PROGMEM =
55
55
" %s,\" rgb_command_topic\" :\" %s2\" ," // cmnd/led2/Color2
56
56
" \" rgb_state_topic\" :\" %s\" ," // stat/led2/RESULT
57
- " \" rgb_value_template\" :\" {{value_json." D_CMND_COLOR " }}\" " ;
58
- // "\"rgb_value_template\":\"{{value_json." D_CMND_COLOR " | join(',')}}\"";
57
+ " \" rgb_value_template\" :\" {{value_json." D_CMND_COLOR " .split(',')[0:3]|join(',')}}\" " ;
59
58
60
59
const char HASS_DISCOVER_LIGHT_CT[] PROGMEM =
61
60
" %s,\" color_temp_command_topic\" :\" %s\" ," // cmnd/led2/CT
@@ -115,19 +114,17 @@ const char HASS_DISCOVER_LIGHT_COLOR_SHORT[] PROGMEM =
115
114
" %s,\" rgb_cmd_t\" :\" %s2\" ," // cmnd/led2/Color2
116
115
" \" rgb_stat_t\" :\" %s\" ," // stat/led2/RESULT
117
116
" \" rgb_val_tpl\" :\" {{value_json." D_CMND_COLOR " .split(',')[0:3]|join(',')}}\" " ;
118
- // "\"rgb_val_tpl\":\"{{value_json." D_CMND_COLOR " | join(',')}}\"";
119
117
120
118
const char HASS_DISCOVER_LIGHT_CT_SHORT[] PROGMEM =
121
119
" %s,\" clr_temp_cmd_t\" :\" %s\" ," // cmnd/led2/CT
122
120
" \" clr_temp_stat_t\" :\" %s\" ," // stat/led2/RESULT
123
121
" \" clr_temp_val_tpl\" :\" {{value_json." D_CMND_COLORTEMPERATURE " }}\" " ;
124
- /*
125
- const char HASS_DISCOVER_LIGHT_SCHEME[] PROGMEM =
126
- "%s,\"effect_command_topic\":\"%s\"," // cmnd/led2/Scheme
127
- "\"effect_state_topic\":\"%s\"," // stat/led2/RESULT
128
- "\"effect_value_template\":\"{{value_json." D_CMND_SCHEME "}}\","
129
- "\"effect_list\":[\"0\",\"1\",\"2\",\"3\",\"4\"]"; // string list with reference to scheme parameter. Currently only supports numbers 0 to 11 as it make the mqtt string too long
130
- */
122
+
123
+ const char HASS_DISCOVER_LIGHT_SCHEME_SHORT[] PROGMEM =
124
+ " %s,\" fx_cmd_t\" :\" %s\" ," // cmnd/led2/Scheme
125
+ " \" fx_stat_t\" :\" %s\" ," // stat/led2/RESULT
126
+ " \" fx_val_tpl\" :\" {{value_json." D_CMND_SCHEME " }}\" ,"
127
+ " \" fx_list\" :[\" 0\" ,\" 1\" ,\" 2\" ,\" 3\" ,\" 4\" ]" ; // string list with reference to scheme parameter.
131
128
132
129
const char HASS_DISCOVER_SENSOR_SHORT[] PROGMEM =
133
130
" {\" name\" :\" %s\" ," // dualr2 1 BTN
@@ -239,12 +236,15 @@ void HAssAnnounceRelayLight(void)
239
236
Shorten (&rgb_command_topic, prefix);
240
237
snprintf_P (mqtt_data, sizeof (mqtt_data), Settings.flag3 .hass_short_discovery_msg ?HASS_DISCOVER_LIGHT_COLOR_SHORT:HASS_DISCOVER_LIGHT_COLOR,
241
238
mqtt_data, rgb_command_topic, state_topic);
242
- /*
243
- char effect_command_topic[TOPSZ];
244
239
240
+ char _effect_command_topic[TOPSZ];
241
+ char *effect_command_topic = _effect_command_topic;
245
242
GetTopic_P (effect_command_topic, CMND, mqtt_topic, D_CMND_SCHEME);
246
- snprintf_P(mqtt_data, sizeof(mqtt_data), HASS_DISCOVER_LIGHT_SCHEME, mqtt_data, effect_command_topic, state_topic);
247
- */
243
+ if (Settings.flag3 .hass_short_discovery_msg ) {
244
+ Shorten (&effect_command_topic, prefix);
245
+ snprintf_P (mqtt_data, sizeof (mqtt_data), HASS_DISCOVER_LIGHT_SCHEME_SHORT, mqtt_data, effect_command_topic, state_topic);
246
+ }
247
+
248
248
}
249
249
if ((LST_COLDWARM == light_subtype) || (LST_RGBWC == light_subtype)) {
250
250
char _color_temp_command_topic[TOPSZ];
0 commit comments