Added MQTT port field, bumped user, pass and CID to 40 characters
This commit is contained in:
parent
95b33c9c34
commit
c57124e876
@ -253,9 +253,10 @@ Device Auth token: <input name="BK" maxlength="33"><br>
|
||||
<i>Clear the token field to disable. </i><a href="https://github.com/Aircoookie/WLED/wiki/Blynk" target="_blank">Setup info</a>
|
||||
<h3>MQTT</h3>
|
||||
Broker: <input name="MS" maxlength="32"><br>
|
||||
Username: <input name="MQTTUSER" maxlength="32"><br>
|
||||
Password: <input type="password" input name="MQTTPASS" maxlength="32"><br>
|
||||
Client ID: <input name="MQTTCID" maxlength="32"><br>
|
||||
Port: <input name="MQTTPORT" maxlength="5"><br>
|
||||
Username: <input name="MQTTUSER" maxlength="40"><br>
|
||||
Password: <input type="password" input name="MQTTPASS" maxlength="40"><br>
|
||||
Client ID: <input name="MQTTCID" maxlength="40"><br>
|
||||
Device Topic: <input name="MD" maxlength="32"><br>
|
||||
Group Topic: <input name="MG" maxlength="32"><br>
|
||||
<i>Reboot required to apply changes. </i><a href="https://github.com/Aircoookie/WLED/wiki/MQTT" target="_blank">MQTT info</a>
|
||||
|
@ -98,7 +98,7 @@
|
||||
|
||||
|
||||
//version code in format yymmddb (b = daily build)
|
||||
#define VERSION 1906201
|
||||
#define VERSION 190817
|
||||
char versionString[] = "0.8.5-dev";
|
||||
|
||||
|
||||
@ -204,9 +204,10 @@ bool e131Multicast = false;
|
||||
char mqttDeviceTopic[33] = ""; //main MQTT topic (individual per device, default is wled/mac)
|
||||
char mqttGroupTopic[33] = "wled/all"; //second MQTT topic (for example to group devices)
|
||||
char mqttServer[33] = ""; //both domains and IPs should work (no SSL)
|
||||
char mqttUser[33] = ""; //optional: username for MQTT auth
|
||||
char mqttPass[33] = ""; //optional: password for MQTT auth
|
||||
char mqttClientID[33] = ""; //override the client ID
|
||||
char mqttUser[41] = ""; //optional: username for MQTT auth
|
||||
char mqttPass[41] = ""; //optional: password for MQTT auth
|
||||
char mqttClientID[41] = ""; //override the client ID
|
||||
char mqttPort[6] = "";
|
||||
|
||||
bool huePollingEnabled = false; //poll hue bridge for light state
|
||||
uint16_t huePollIntervalMs = 2500; //low values (< 1sec) may cause lag but offer quicker response
|
||||
|
@ -257,9 +257,10 @@ void saveSettingsToEEPROM()
|
||||
writeStringToEEPROM(2300, mqttServer, 32);
|
||||
writeStringToEEPROM(2333, mqttDeviceTopic, 32);
|
||||
writeStringToEEPROM(2366, mqttGroupTopic, 32);
|
||||
writeStringToEEPROM(2399, mqttUser, 32);
|
||||
writeStringToEEPROM(2432, mqttPass, 32);
|
||||
writeStringToEEPROM(2465, mqttClientID, 32);
|
||||
writeStringToEEPROM(2399, mqttUser, 40);
|
||||
writeStringToEEPROM(2440, mqttPass, 40);
|
||||
writeStringToEEPROM(2481, mqttClientID, 40);
|
||||
writeStringToEEPROM(2522, mqttPort, 5);
|
||||
|
||||
EEPROM.commit();
|
||||
}
|
||||
@ -477,9 +478,10 @@ void loadSettingsFromEEPROM(bool first)
|
||||
|
||||
if (lastEEPROMversion > 10)
|
||||
{
|
||||
readStringFromEEPROM(2399, mqttUser, 32);
|
||||
readStringFromEEPROM(2432, mqttPass, 32);
|
||||
readStringFromEEPROM(2465, mqttClientID, 32);
|
||||
readStringFromEEPROM(2399, mqttUser, 40);
|
||||
readStringFromEEPROM(2440, mqttPass, 40);
|
||||
readStringFromEEPROM(2481, mqttClientID, 40);
|
||||
readStringFromEEPROM(2522, mqttPort, 5);
|
||||
}
|
||||
|
||||
receiveDirect = !EEPROM.read(2200);
|
||||
|
@ -308,6 +308,7 @@ void getSettingsJS(byte subPage, char* dest)
|
||||
sappend('c',"SA",notifyAlexa);
|
||||
sappends('s',"BK",(char*)((blynkEnabled)?"Hidden":""));
|
||||
sappends('s',"MS",mqttServer);
|
||||
sappends('s',"MQTTPORT",mqttPort);
|
||||
sappends('s',"MQTTUSER",mqttUser);
|
||||
sappends('s',"MQTTPASS",mqttPass);
|
||||
sappends('s',"MQTTCID",mqttClientID);
|
||||
|
@ -177,6 +177,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
||||
}
|
||||
|
||||
strcpy(mqttServer, request->arg("MS").c_str());
|
||||
strcpy(mqttPort, request->arg("MQTTPORT").c_str());
|
||||
strcpy(mqttUser, request->arg("MQTTUSER").c_str());
|
||||
strcpy(mqttPass, request->arg("MQTTPASS").c_str());
|
||||
strcpy(mqttClientID, request->arg("MQTTCID").c_str());
|
||||
|
@ -90,6 +90,10 @@ void wledInit()
|
||||
strcpy(mqttClientID, "WLED-");
|
||||
sprintf(mqttClientID+5, "%*s", 6, escapedMac.c_str()+6);
|
||||
}
|
||||
if (mqttPort[0] == 0)
|
||||
{
|
||||
strcpy(mqttPort, "1883");
|
||||
}
|
||||
|
||||
strip.service();
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
* MQTT communication protocol for home automation
|
||||
*/
|
||||
|
||||
#define WLED_MQTT_PORT 1883
|
||||
//#define WLED_MQTT_PORT 1883
|
||||
|
||||
void parseMQTTBriPayload(char* payload)
|
||||
{
|
||||
@ -223,9 +223,9 @@ bool initMqtt()
|
||||
IPAddress mqttIP;
|
||||
if (mqttIP.fromString(mqttServer)) //see if server is IP or domain
|
||||
{
|
||||
mqtt->setServer(mqttIP, WLED_MQTT_PORT);
|
||||
mqtt->setServer(mqttIP, atoi(mqttPort));
|
||||
} else {
|
||||
mqtt->setServer(mqttServer, WLED_MQTT_PORT);
|
||||
mqtt->setServer(mqttServer, atoi(mqttPort));
|
||||
}
|
||||
mqtt->setClientId(mqttClientID);
|
||||
if (mqttUser[0] && mqttPass[0] != 0) mqtt->setCredentials(mqttUser, mqttPass);
|
||||
|
Loading…
Reference in New Issue
Block a user