mirror of
https://github.com/Anonym-tsk/smart-domofon.git
synced 2025-12-07 03:57:04 +03:00
Mqtt retained fix
This commit is contained in:
@@ -4,12 +4,12 @@ WiFiClient espClient;
|
|||||||
PubSubClient mqttClient(espClient);
|
PubSubClient mqttClient(espClient);
|
||||||
|
|
||||||
void mqttSendCommand(const char *msg) {
|
void mqttSendCommand(const char *msg) {
|
||||||
mqttClient.publish(MQTT_TOPIC_OUT, msg, 1);
|
mqttClient.publish(MQTT_TOPIC_OUT, msg);
|
||||||
DEBUG_F("[MQTT] Message sent: %s\n", msg);
|
DEBUG_F("[MQTT] Message sent: %s\n", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mqttSendStatus(const char *msg) {
|
void mqttSendStatus(const char *msg) {
|
||||||
mqttClient.publish(MQTT_TOPIC_STATUS, msg, 1);
|
mqttClient.publish(MQTT_TOPIC_STATUS, msg, true);
|
||||||
DEBUG_F("[MQTT] Status sent: %s\n", msg);
|
DEBUG_F("[MQTT] Status sent: %s\n", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ void mqttConnect() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mqttClient.connect(MQTT_CLIENT_ID, MQTT_USER_NAME, MQTT_USER_PASSWORD, MQTT_TOPIC_STATUS, 0, 0, MSG_STATUS_LAST_WILL)) {
|
if (!mqttClient.connect(MQTT_CLIENT_ID, MQTT_USER_NAME, MQTT_USER_PASSWORD, MQTT_TOPIC_STATUS, 0, 1, MSG_STATUS_LAST_WILL)) {
|
||||||
// Ждем 2 секунды
|
// Ждем 2 секунды
|
||||||
DEBUG_F(".");
|
DEBUG_F(".");
|
||||||
ledBlink(PIN_LED_GREEN, 8);
|
ledBlink(PIN_LED_GREEN, 8);
|
||||||
|
|||||||
Reference in New Issue
Block a user