Skip to content

Commit

Permalink
v1.2.44
Browse files Browse the repository at this point in the history
- Added new schedule action commands: "Pause" and "Call HTTP URL"
- Improved security with randomly generated MQTT client ID
  • Loading branch information
genemars committed Dec 22, 2024
1 parent 77dc09f commit 6585bd6
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 2 deletions.
1 change: 1 addition & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ lib_deps =
lovyan03/[email protected]
dvarrel/[email protected]
jpb10/[email protected]
RobTillaart/[email protected]
lib_deps_8266 =
vshymanskyy/[email protected]

Expand Down
10 changes: 10 additions & 0 deletions src/net/MQTTClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <mbedtls/base64.h>
#include <mqtt_client.h>
#include <LinkedList.h>
#include <UUID.h>

#include "Task.h"
#include "data/Module.h"
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -210,6 +219,7 @@ namespace Net {
private:
static String encryptionKey;
static bool enableEncryption;
String clientId;
String brokerUrl;
String username;
String password;
Expand Down
31 changes: 30 additions & 1 deletion src/service/api/HomeGenieHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
" }"
"]";

}}
Expand Down
2 changes: 1 addition & 1 deletion src/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__
Expand Down

0 comments on commit 6585bd6

Please sign in to comment.