esp-rfid icon indicating copy to clipboard operation
esp-rfid copied to clipboard

MQTT LWT

Open cyberhasse opened this issue 6 years ago • 2 comments

Will you implement "LWT" Last will and testament mqtt feature? Thanks for your great work. Regards.

cyberhasse avatar Jul 05 '19 04:07 cyberhasse

#125 #103

Identify all esp-rfids in the network by ChipID Give user an option to add their topic for LWT

omersiar avatar Sep 14 '19 15:09 omersiar

First of all: I'm no programmer but.. I have LWT success by adding:

	mqttClient.setCleanSession(true);
	mqttClient.setKeepAlive(15);
	mqttClient.setWill("/door/log/lwt", 1, false, "offline");

to config.esp and adding a function in mqtt.esp

void mqtt_publish_lwt(time_t heartbeat) { mqttClient.connect(); // More stable? String stopic (mqttTopic); stopic = stopic + "/lwt"; mqttClient.publish(stopic.c_str(), 0, false, ("online"));

and adding to main.cpp just below nextbeat = (unsigned)now() + interval;

mqtt_publish_lwt(now());

Problem now is that lwt message is hardcoded...

Regards.

cyberhasse avatar Nov 27 '19 16:11 cyberhasse