[MQTT] Publish command allow empty payload

This commit is contained in:
Ton Huisman
2023-01-31 22:22:42 +01:00
parent 231592914f
commit 9a826e0ce5
3 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -421,9 +421,9 @@
"
Publish","
:green:`Rules`","
Send command using MQTT broker service
Send command using MQTT broker service. Uses the first enabled MQTT Controller.
``Publish,<topic>,<value>``"
``Publish,<topic>[,<payload>]``"
"
Reboot","
:red:`Internal`","
+1 -1
View File
@@ -408,7 +408,7 @@ bool executeInternalCommand(command_case_data & data)
#endif
COMMAND_CASE_A( "pulse", Command_GPIO_Pulse, 3); // GPIO.h
#if FEATURE_MQTT
COMMAND_CASE_A( "publish", Command_MQTT_Publish, 2); // MQTT.h
COMMAND_CASE_A( "publish", Command_MQTT_Publish, -1); // MQTT.h
#endif // if FEATURE_MQTT
COMMAND_CASE_A( "pwm", Command_GPIO_PWM, 4); // GPIO.h
break;
+2 -2
View File
@@ -34,10 +34,10 @@ const __FlashStringHelper * Command_MQTT_Publish(struct EventStruct *event, cons
const String topic = parseStringKeepCase(Line, 2);
const String value = tolerantParseStringKeepCase(Line, 3);
# ifndef BUILD_NO_DEBUG
addLog(LOG_LEVEL_DEBUG, String(F("Publish: ")) + topic + value);
addLog(LOG_LEVEL_DEBUG, concat(F("Publish: "), topic) + value);
#endif
if ((topic.length() > 0) && (value.length() > 0)) {
if (!topic.isEmpty()) {
bool mqtt_retainFlag;
{