diff --git a/wled00/blynk.cpp b/wled00/blynk.cpp
index 39b43ba8..ef53ca9b 100644
--- a/wled00/blynk.cpp
+++ b/wled00/blynk.cpp
@@ -8,12 +8,12 @@
uint16_t blHue = 0;
byte blSat = 255;
-void initBlynk(const char* auth)
+void initBlynk(const char *auth, const char *host, uint16_t port)
{
#ifndef WLED_DISABLE_BLYNK
if (!WLED_CONNECTED) return;
blynkEnabled = (auth[0] != 0);
- if (blynkEnabled) Blynk.config(auth);
+ if (blynkEnabled) Blynk.config(auth, host, port);
#endif
}
diff --git a/wled00/cfg.cpp b/wled00/cfg.cpp
index 4bacb9a7..68eba7a3 100644
--- a/wled00/cfg.cpp
+++ b/wled00/cfg.cpp
@@ -212,6 +212,10 @@ void deserializeConfig() {
if (tdd > 20 || tdd == 0)
getStringFromJson(blynkApiKey, apikey, 36); //normally not present due to security
+ JsonObject if_blynk = interfaces[F("blynk")];
+ getStringFromJson(blynkHost, if_blynk[F("host")], 33);
+ CJSON(blynkPort, if_blynk[F("port")]);
+
JsonObject if_mqtt = interfaces[F("mqtt")];
CJSON(mqttEnabled, if_mqtt[F("en")]);
getStringFromJson(mqttServer, if_mqtt[F("broker")], 33);
@@ -531,6 +535,8 @@ void serializeConfig() {
if_va_macros.add(macroAlexaOff);
JsonObject if_blynk = interfaces.createNestedObject("blynk");
if_blynk[F("token")] = strlen(blynkApiKey) ? "Hidden":"";
+ if_blynk[F("host")] = blynkHost;
+ if_blynk[F("port")] = blynkPort;
JsonObject if_mqtt = interfaces.createNestedObject("mqtt");
if_mqtt[F("en")] = mqttEnabled;
diff --git a/wled00/data/settings_sync.htm b/wled00/data/settings_sync.htm
index aa9f0333..77814294 100644
--- a/wled00/data/settings_sync.htm
+++ b/wled00/data/settings_sync.htm
@@ -79,6 +79,8 @@ Alexa invocation name:
This may impact the responsiveness of the ESP8266.
For best results, only use one of these services at a time.
(alternatively, connect a second ESP to them and use the UDP sync)
+Host:
+Port:
Device Auth token:
Clear the token field to disable. Setup info
MQTT
diff --git a/wled00/fcn_declare.h b/wled00/fcn_declare.h
index ea819f70..a1c60eee 100644
--- a/wled00/fcn_declare.h
+++ b/wled00/fcn_declare.h
@@ -15,7 +15,7 @@ void handleAlexa();
void onAlexaChange(EspalexaDevice* dev);
//blynk.cpp
-void initBlynk(const char* auth);
+void initBlynk(const char* auth, const char* host, uint16_t port);
void handleBlynk();
void updateBlynk();
diff --git a/wled00/html_settings.h b/wled00/html_settings.h
index b6c7297f..8943ddfe 100644
--- a/wled00/html_settings.h
+++ b/wled00/html_settings.h
@@ -255,9 +255,10 @@ maxlength="32">Blynk
Blynk, MQTT and Hue sync all connect to external hosts!
This may impact the responsiveness of the ESP8266.
For best results, only use one of these services at a time.
-(alternatively, connect a second ESP to them and use the UDP sync)
-Device Auth token:
-Clear the token field to disable. Host:
+ Port: Device Auth token: Clear the token field to disable. Setup info
MQTT Enable MQTT: Broker:
Port: hasArg(F("AL"));
strlcpy(alexaInvocationName, request->arg(F("AI")).c_str(), 33);
+ strlcpy(blynkHost, request->arg("BH").c_str(), 33);
+ t = request->arg(F("BP")).toInt();
+ if (t > 0) blynkPort = t;
+
if (request->hasArg("BK") && !request->arg("BK").equals(F("Hidden"))) {
- strlcpy(blynkApiKey, request->arg("BK").c_str(), 36); initBlynk(blynkApiKey);
+ strlcpy(blynkApiKey, request->arg("BK").c_str(), 36); initBlynk(blynkApiKey, blynkHost, blynkPort);
}
#ifdef WLED_ENABLE_MQTT
diff --git a/wled00/wled.cpp b/wled00/wled.cpp
index b58676f6..0dd3704c 100644
--- a/wled00/wled.cpp
+++ b/wled00/wled.cpp
@@ -493,7 +493,7 @@ void WLED::initInterfaces()
if (ntpEnabled)
ntpConnected = ntpUdp.begin(ntpLocalPort);
- initBlynk(blynkApiKey);
+ initBlynk(blynkApiKey, blynkHost, blynkPort);
e131.begin(e131Multicast, e131Port, e131Universe, E131_MAX_UNIVERSE_COUNT);
reconnectHue();
initMqtt();
diff --git a/wled00/wled.h b/wled00/wled.h
index 213abf6a..ca19bdba 100644
--- a/wled00/wled.h
+++ b/wled00/wled.h
@@ -249,6 +249,8 @@ WLED_GLOBAL bool alexaEnabled _INIT(false); // enable devi
WLED_GLOBAL char alexaInvocationName[33] _INIT("Light"); // speech control name of device. Choose something voice-to-text can understand
WLED_GLOBAL char blynkApiKey[36] _INIT(""); // Auth token for Blynk server. If empty, no connection will be made
+WLED_GLOBAL char blynkHost[33] _INIT("blynk-cloud.com"); // Default Blynk host
+WLED_GLOBAL uint16_t blynkPort _INIT(80); // Default Blynk port
WLED_GLOBAL uint16_t realtimeTimeoutMs _INIT(2500); // ms timeout of realtime mode before returning to normal mode
WLED_GLOBAL int arlsOffset _INIT(0); // realtime LED offset
diff --git a/wled00/xml.cpp b/wled00/xml.cpp
index 7e512679..1a64eb5c 100644
--- a/wled00/xml.cpp
+++ b/wled00/xml.cpp
@@ -323,6 +323,8 @@ void getSettingsJS(byte subPage, char* dest)
sappends('s',SET_F("AI"),alexaInvocationName);
sappend('c',SET_F("SA"),notifyAlexa);
sappends('s',SET_F("BK"),(char*)((blynkEnabled)?SET_F("Hidden"):""));
+ sappends('s',SET_F("BH"),blynkHost);
+ sappend('v',SET_F("BP"),blynkPort);
#ifdef WLED_ENABLE_MQTT
sappend('c',SET_F("MQ"),mqttEnabled);