Browse Source

Possibility to disable MQTT

save ~6k
gpiosensors
Mathieu Maret 5 years ago
parent
commit
e0f600baf0
  1. 14
      WifiControlSensor/MQTT.h
  2. 2
      WifiControlSensor/MQTT.ino

14
WifiControlSensor/MQTT.h

@ -1,4 +1,5 @@
#pragma once
#ifndef CONFIG_DISABLE_MQTT
#include "Adafruit_MQTT.h"
Adafruit_MQTT_Publish *MqttCreatePublisher(const char *fmt, ...);
@ -13,3 +14,16 @@ void MqttCheckSubscription();
void MqttChangeGpioValue(int gpio, int value);
void MqttChangePWMValue(int gpio, int value);
bool MqttIsConfigured();
#else
int MqttConnect(){return 0;}
int MqttIsConnected(){return 0;}
int MqttSetup(char *server, char *user, char *passwd, int port, char * hostname){return 0;}
int MqttPublish(double temp, double pressure){return 0;}
int MqttDhtPublish(float temp, float humidity){return 0;}
int MqttDryPublish(int dry){return 0;}
int MqttIPPublish(const String &ip){return 0;}
void MqttCheckSubscription(){}
void MqttChangeGpioValue(int gpio, int value){}
void MqttChangePWMValue(int gpio, int value){}
bool MqttIsConfigured(){}
#endif

2
WifiControlSensor/MQTT.ino

@ -1,3 +1,4 @@
#ifndef CONFIG_DISABLE_MQTT
#include <stdarg.h>
#include "utils.h"
#include "MQTT.h"
@ -214,3 +215,4 @@ void MqttCheckSubscription() {
}
}
}
#endif
Loading…
Cancel
Save