MQTT messages can now be retained.
This commit is contained in:
parent
8e2d2225cb
commit
4762a852d8
@ -17,8 +17,8 @@ void mqtt_setup();
|
|||||||
|
|
||||||
void mqtt_loop();
|
void mqtt_loop();
|
||||||
|
|
||||||
void mqtt_publish(const char* topic, int number);
|
void mqtt_publish(const char* topic, int number, bool retain=false);
|
||||||
void mqtt_publish(const char* topic, const char* message);
|
void mqtt_publish(const char* topic, const char* message, bool retain=false);
|
||||||
|
|
||||||
void mqtt_log(const char* message);
|
void mqtt_log(const char* message);
|
||||||
void mqtt_log(int number);
|
void mqtt_log(int number);
|
||||||
|
@ -133,16 +133,16 @@ void mqtt_loop() {
|
|||||||
|
|
||||||
String mqtt_log_str = String();
|
String mqtt_log_str = String();
|
||||||
|
|
||||||
void mqtt_publish(const char* topic, int number) {
|
void mqtt_publish(const char* topic, int number, bool retain) {
|
||||||
char b[32];
|
char b[32];
|
||||||
sprintf(b, "%d", number);
|
sprintf(b, "%d", number);
|
||||||
mqtt_publish(topic, b);
|
mqtt_publish(topic, b, retain);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mqtt_publish(const char* topic, const char* message) {
|
void mqtt_publish(const char* topic, const char* message, bool retain) {
|
||||||
char t[127];
|
char t[127];
|
||||||
sprintf(t, MQTT_TOPIC "%s", topic);
|
sprintf(t, MQTT_TOPIC "%s", topic);
|
||||||
mqtt_client.publish(t, message);
|
mqtt_client.publish(t, message, retain);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mqtt_log(const char* message) {
|
void mqtt_log(const char* message) {
|
||||||
|
Loading…
Reference in New Issue
Block a user