Browse Source

Add #defines for MQTT Username+Password

fastled
Florian Pfeiffer 7 years ago
parent
commit
624b08b636
2 changed files with 4 additions and 2 deletions
  1. +2
    -0
      code/espurna/config/general.h
  2. +2
    -2
      code/espurna/mqtt.ino

+ 2
- 0
code/espurna/config/general.h View File

@ -331,6 +331,8 @@ PROGMEM const char* const custom_reset_string[] = {
#define MQTT_SSL_FINGERPRINT ""
#define MQTT_SERVER "" // Default MQTT broker address
#define MQTT_USER "" // Default MQTT broker usename
#define MQTT_PASS "" // Default MQTT broker password
#define MQTT_PORT 1883 // MQTT broker port
#define MQTT_TOPIC "/test/switch/{identifier}" // Default MQTT base topic
#define MQTT_RETAIN true // MQTT retain flag


+ 2
- 2
code/espurna/mqtt.ino View File

@ -322,8 +322,8 @@ void mqttConnect() {
char * host = strdup(getSetting("mqttServer", MQTT_SERVER).c_str());
unsigned int port = getSetting("mqttPort", MQTT_PORT).toInt();
_mqttUser = strdup(getSetting("mqttUser").c_str());
_mqttPass = strdup(getSetting("mqttPassword").c_str());
_mqttUser = strdup(getSetting("mqttUser", MQTT_USER).c_str());
_mqttPass = strdup(getSetting("mqttPassword", MQTT_PASSWORD).c_str());
if (_mqttWill) free(_mqttWill);
_mqttWill = strdup((_mqttTopic + MQTT_TOPIC_STATUS).c_str());


Loading…
Cancel
Save