diff -r 003c20125212 -r 862de87f9f89 thermferm/mqtt.c --- a/thermferm/mqtt.c Thu May 12 21:43:07 2016 +0200 +++ b/thermferm/mqtt.c Sat Apr 29 17:07:36 2017 +0200 @@ -194,10 +194,12 @@ if (mqtt_use) { /* * Final publish 0 to clients//thermferm/state + * After that, remove the retained topic. */ syslog(LOG_NOTICE, "MQTT disconnecting"); sprintf(buf, "0"); mosquitto_publish(mosq, &mqtt_mid_sent, state, strlen(buf), buf, mqtt_qos, true); + mosquitto_publish(mosq, &mqtt_mid_sent, state, 0, NULL, mqtt_qos, true); mqtt_last_mid = mqtt_mid_sent; mqtt_status = STATUS_WAITING; mqtt_my_shutdown = TRUE; @@ -268,3 +270,17 @@ #endif } + + +void mqtt_publish_clear(char *uuid, char *tail) +{ +#ifdef HAVE_MOSQUITTO_H + char topic[1024]; + + if (mqtt_use) { + snprintf(topic, 1023, "bmsd/%s/%s/%s", my_hostname, uuid, tail); + mosquitto_publish(mosq, &mqtt_mid_sent, topic, 0, NULL, mqtt_qos, 1); + } +#endif +} +