diff --git a/platformio.ini b/platformio.ini index 9b6c034..00e7197 100644 --- a/platformio.ini +++ b/platformio.ini @@ -48,6 +48,7 @@ lib_deps = lovyan03/LovyanGFX@1.1.16 dvarrel/ESPping@1.0.4 jpb10/SolarCalculator@2.0.1 + RobTillaart/UUID@0.1.6 lib_deps_8266 = vshymanskyy/Preferences@2.1.0 diff --git a/src/net/MQTTClient.h b/src/net/MQTTClient.h index 6731599..9fb0bec 100644 --- a/src/net/MQTTClient.h +++ b/src/net/MQTTClient.h @@ -30,6 +30,7 @@ #include #include #include +#include #include "Task.h" #include "data/Module.h" @@ -108,6 +109,14 @@ namespace Net { } brokerUrl += address + String(":") + port; + UUID uuid; + uint32_t seed1 = random(999999999); + uint32_t seed2 = random(999999999); + uuid.seed(seed1, seed2); + uuid.generate(); + clientId = uuid.toCharArray(); + + mqtt_cfg.client_id = clientId.c_str(); mqtt_cfg.uri = brokerUrl.c_str(); mqtt_cfg.username = username.c_str(); mqtt_cfg.password = password.c_str(); @@ -210,6 +219,7 @@ namespace Net { private: static String encryptionKey; static bool enableEncryption; + String clientId; String brokerUrl; String username; String password; diff --git a/src/service/api/HomeGenieHandler.h b/src/service/api/HomeGenieHandler.h index 2dcd966..56f75fa 100644 --- a/src/service/api/HomeGenieHandler.h +++ b/src/service/api/HomeGenieHandler.h @@ -138,7 +138,36 @@ namespace Service { namespace API { " \"value\": \"Off\"\n" " }\n" " }\n" - " }\n" + " },\n" + " {\n" + " \"id\": \"net_http_call\",\n" + " \"script\": \"$$.net.webService('$url$').call();\\n\",\n" + " \"config\": {\n" + " \"url\": {\n" + " \"options\": {\n" + " \"maxLength\": 1024\n" + " },\n" + " \"type\": \"text\",\n" + " \"value\": \"\"\n" + " }\n" + " }\n" + " },\n" + " {\n" + " \"id\": \"pause\",\n" + " \"script\": \"$$.pause($seconds$);\\n\",\n" + " \"config\": {\n" + " \"seconds\": {\n" + " \"type\": \"slider\",\n" + " \"options\": {\n" + " \"min\": 0.01,\n" + " \"max\": 2,\n" + " \"step\": 0.01\n" + " },\n" + " \"value\": 0.1,\n" + " \"transform\": \"time:seconds\"\n" + " }\n" + " }\n" + " }" "]"; }} diff --git a/src/version.h b/src/version.h index 181019d..fe38be5 100644 --- a/src/version.h +++ b/src/version.h @@ -29,7 +29,7 @@ #define VERSION_MAJOR 1 #define VERSION_MINOR 2 -#define VERSION_PATCH 43 +#define VERSION_PATCH 44 #define STRING_VALUE(...) STRING_VALUE__(__VA_ARGS__) #define STRING_VALUE__(...) #__VA_ARGS__