Browse code

uptime la 5 min \n SSID modificat din ClickHOME in ClickHOME-$devid sa fie unic\n fixat bug pentru spatiu alocat variabilelor in cazul in care userul are 8 caractere

Andrei Bucur authored on 19/03/2018 12:03:53
Showing 8 changed files
... ...
@@ -9,23 +9,24 @@
9 9
 const char* mqtt_user="64x35up";
10 10
 const char* mqtt_devid="5566";
11 11
 #define DEBUG 0 //0=off 1=on
12
-#define RELAY 0 //  pinul de date 
12
+#define RELAY 2 //  pinul de date 
13 13
 
14 14
 /********** NU edita mai jos ******************/
15 15
 char mqttPassword[15]; //urmatoarele le va genera cu functia gen
16
-char mqttSUB[22];
17
-char espName[13];
18
-char mqttESP[22];
19
-char mqttRELAY[23];
20
-char mqttLWT[22];
21
-char mqttSTA[24];
16
+char mqttSUB[23];
17
+char espName[14];
18
+char mqttESP[23];
19
+char mqttRELAY[24];
20
+char mqttLWT[23];
21
+char mqttSTA[25];
22
+char wifiID[15];
22 23
 
23 24
 const String model = "ESP8266 Releu";
24
-const String ver = "v1.1.0";
25
+const String ver = "v1.1.1";
25 26
 const char* mqttServer = "mqtt.clickhome.ro";
26 27
 const int mqttPort = 1883;
27 28
 String mqttMessage;
28
-const unsigned long interval_update=1000*60*60; // face update la 60 min 
29
+const unsigned long interval_update=1000*60*5; // face update la 5 min 
29 30
 unsigned long t_update=0;
30 31
 
31 32
 WiFiClient espClient;
... ...
@@ -58,6 +59,9 @@ void generate_vars(){
58 58
   strcpy (mqttSTA, "tele/");
59 59
   strcat (mqttSTA, espName);
60 60
   strcat (mqttSTA, "/STATE");
61
+
62
+  strcpy (wifiID, "ClickHome-");
63
+  strcat (wifiID, mqtt_devid);
61 64
 }
62 65
 
63 66
 String ipToString(IPAddress ip){
... ...
@@ -148,7 +152,7 @@ void setup()
148 148
    WiFiManager wifi;
149 149
    wifi.setConfigPortalTimeout(120); // a timeout so the ESP doesn't hang waiting to be configured, for instance after a power failure
150 150
    wifi.setTimeout(180); // sta AP 3 minute apoi se reseteaza din nou
151
-   if (!wifi.autoConnect("ClickHome")) {
151
+   if (!wifi.autoConnect(wifiID)) {
152 152
      #if DEBUG
153 153
      Serial.println("timeout - going to sleep");
154 154
      #endif
... ...
@@ -8,28 +8,29 @@
8 8
 
9 9
 //ESP8266-01 nu are suficienta memorie pt update http
10 10
 const char* mqtt_user="64x35up";
11
-const char* mqtt_devid="1791";
11
+const char* mqtt_devid="1903";
12 12
 #define ONE_WIRE_BUS 2 // pinul de date
13 13
 #define DEBUG 0 //0=off 1=on
14 14
 
15 15
 /********** NU edita mai jos ******************/
16 16
 char mqttPassword[15]; //urmatoarele le va genera cu functia gen
17
-char mqttSUB[22];
18
-char espName[13];
19
-char mqttESP[22];
20
-char mqttTEMP[23];
21
-char mqttLWT[22];
22
-char mqttSTA[24];
17
+char mqttSUB[23];
18
+char espName[14];
19
+char mqttESP[23];
20
+char mqttTEMP[24];
21
+char mqttLWT[23];
22
+char mqttSTA[25];
23
+char wifiID[15];
23 24
 
24 25
 const String model = "ESP8266 Dallas";
25
-const String ver = "v1.1.0";
26
+const String ver = "v1.1.1";
26 27
 const char* mqttServer = "mqtt.clickhome.ro";
27 28
 const int mqttPort = 1883;
28 29
 long loopTimer = 900000; // miliseconds - by default trimite la 15 minute
29 30
 long lastMsg = 0;
30 31
 float loopTemp = 0;
31 32
 String mqttMessage;
32
-const unsigned long interval_update=1000*60*60; // face update la 60 min 
33
+const unsigned long interval_update=1000*60*5; // face update la 5 min 
33 34
 unsigned long t_update=0;
34 35
 
35 36
 // senzor de temperatura DALLAS
... ...
@@ -68,6 +69,9 @@ void generate_vars(){
68 68
   strcpy (mqttSTA, "tele/");
69 69
   strcat (mqttSTA, espName);
70 70
   strcat (mqttSTA, "/STATE");
71
+
72
+  strcpy (wifiID, "ClickHome-");
73
+  strcat (wifiID, mqtt_devid);
71 74
 }
72 75
 
73 76
 String ipToString(IPAddress ip){
... ...
@@ -150,7 +154,7 @@ void setup()
150 150
    WiFiManager wifi;
151 151
    wifi.setConfigPortalTimeout(120); // a timeout so the ESP doesn't hang waiting to be configured, for instance after a power failure
152 152
    wifi.setTimeout(180); // sta AP 3 minute apoi se reseteaza din nou
153
-   if (!wifi.autoConnect("ClickHome")) {
153
+   if (!wifi.autoConnect(wifiID)) {
154 154
      #if DEBUG
155 155
      Serial.println("timeout - going to sleep");
156 156
      #endif
... ...
@@ -18,15 +18,16 @@ const char* mqtt_devid="1790";
18 18
 /********** NU edita mai jos ******************/
19 19
 
20 20
 char mqttPassword[15]; //urmatoarele le va genera cu functia gen
21
-char mqttSUB[22];
22
-char espName[13];
23
-char mqttESP[22];
24
-char mqttTEMP[23];
25
-char mqttLWT[22];
26
-char mqttSTA[24];
21
+char mqttSUB[23];
22
+char espName[14];
23
+char mqttESP[23];
24
+char mqttTEMP[24];
25
+char mqttLWT[23];
26
+char mqttSTA[25];
27
+char wifiID[15];
27 28
 
28 29
 const String model = "ESP8266 ";
29
-const String ver = "v1.1.0";
30
+const String ver = "v1.1.1";
30 31
 const char* mqttServer = "mqtt.clickhome.ro";
31 32
 const int mqttPort = 1883;
32 33
 long loopTimer = 900000; // miliseconds - by default trimite la 15 minute
... ...
@@ -38,7 +39,7 @@ float h = 0;
38 38
 String mqttMessage;
39 39
 bool bDHTstarted;
40 40
 int acquireresult;
41
-const unsigned long interval_update=1000*60*60; // face update la 60 min 
41
+const unsigned long interval_update=1000*60*5; // face update la 5 min 
42 42
 unsigned long t_update=0;
43 43
 
44 44
 
... ...
@@ -80,6 +81,9 @@ void generate_vars(){
80 80
   strcpy (mqttSTA, "tele/");
81 81
   strcat (mqttSTA, espName);
82 82
   strcat (mqttSTA, "/STATE");
83
+
84
+  strcpy (wifiID, "ClickHome-");
85
+  strcat (wifiID, mqtt_devid);
83 86
 }
84 87
 
85 88
 String ipToString(IPAddress ip){
... ...
@@ -164,7 +168,7 @@ void setup()
164 164
    WiFiManager wifi;
165 165
    wifi.setConfigPortalTimeout(120); // a timeout so the ESP doesn't hang waiting to be configured, for instance after a power failure
166 166
    wifi.setTimeout(180); // sta AP 3 minute apoi se reseteaza din nou
167
-   if (!wifi.autoConnect("ClickHome")) {
167
+   if (!wifi.autoConnect(wifiID)) {
168 168
      #if DEBUG
169 169
      Serial.println("timeout - going to sleep");
170 170
      #endif
... ...
@@ -9,8 +9,8 @@
9 9
 #define DEBUG 0 //0=off 1=on
10 10
 
11 11
 // Variables
12
-const char* set_mqtt_user="quyhgw";
13
-const char* set_mqtt_devid="1870";
12
+const char* set_mqtt_user="64x35up";
13
+const char* set_mqtt_devid="1330";
14 14
 
15 15
 // Default configuration values
16 16
 char mqtt_user[9]; //le va lua din FS
... ...
@@ -20,16 +20,17 @@ unsigned long t_update=0;
20 20
 char mqtt_user[9]; //le va lua din FS
21 21
 char mqtt_devid[5]; //le va lua din FS
22 22
 char mqttPassword[15]; //urmatoarele le va genera cu functia gen
23
-char mqttSUB[22];
24
-char espName[13];
25
-char mqttESP[22];
26
-char mqttALM[24];
27
-char mqttPIR[22];
28
-char mqttLWT[22];
29
-char mqttSTA[24];
23
+char mqttSUB[23];
24
+char espName[14];
25
+char mqttESP[23];
26
+char mqttALM[25];
27
+char mqttPIR[23];
28
+char mqttLWT[23];
29
+char mqttSTA[25];
30
+char wifiID[15];
30 31
 
31 32
 const String model = "NodeMCU PIR";
32
-const String ver = "v2.1.1";
33
+const String ver = "v2.1.2";
33 34
 const char* mqttServer = "mqtt.clickhome.ro";
34 35
 const int mqttPort = 1883;
35 36
 String mqttMessage;
... ...
@@ -69,6 +70,9 @@ void generate_vars(){
69 69
   strcpy (mqttSTA, "tele/");
70 70
   strcat (mqttSTA, espName);
71 71
   strcat (mqttSTA, "/STATE");
72
+
73
+  strcpy (wifiID, "ClickHome-");
74
+  strcat (wifiID, mqtt_devid);
72 75
 }
73 76
 
74 77
 String ipToString(IPAddress ip){
... ...
@@ -166,7 +170,7 @@ void setup()
166 166
    WiFiManager wifi;
167 167
    wifi.setConfigPortalTimeout(120); // a timeout so the ESP doesn't hang waiting to be configured, for instance after a power failure
168 168
    wifi.setTimeout(180); // sta AP 3 minute apoi se reseteaza din nou
169
-   if (!wifi.autoConnect("ClickHome")) {
169
+   if (!wifi.autoConnect(wifiID)) {
170 170
      #if DEBUG
171 171
      Serial.println("timeout - going to sleep");
172 172
      #endif
... ...
@@ -14,20 +14,21 @@
14 14
 char mqtt_user[9]; //le va lua din FS
15 15
 char mqtt_devid[5]; //le va lua din FS
16 16
 char mqttPassword[15]; //urmatoarele le va genera cu functia gen
17
-char mqttSUB[22];
18
-char espName[13];
19
-char mqttESP[22];
20
-char mqttRELAY[23];
21
-char mqttLWT[22];
22
-char mqttSTA[24];
17
+char mqttSUB[23];
18
+char espName[14];
19
+char mqttESP[23];
20
+char mqttRELAY[24];
21
+char mqttLWT[23];
22
+char mqttSTA[25];
23
+char wifiID[15];
23 24
 
24 25
 const String model = "NodeMCU Releu";
25
-const String ver = "v2.1.0";
26
+const String ver = "v2.1.1";
26 27
 const char* mqttServer = "mqtt.clickhome.ro";
27 28
 const int mqttPort = 1883;
28 29
 String mqttMessage;
29 30
 
30
-const unsigned long interval_update=1000*60*60; // face update la 60 min 
31
+const unsigned long interval_update=1000*60*5; // face update la 5 min 
31 32
 unsigned long t_update=0;
32 33
 
33 34
 WiFiClient espClient;
... ...
@@ -61,6 +62,9 @@ void generate_vars(){
61 61
   strcpy (mqttSTA, "tele/");
62 62
   strcat (mqttSTA, espName);
63 63
   strcat (mqttSTA, "/STATE");
64
+
65
+  strcpy (wifiID, "ClickHome-");
66
+  strcat (wifiID, mqtt_devid);
64 67
 }
65 68
 
66 69
 String ipToString(IPAddress ip){
... ...
@@ -170,7 +174,7 @@ void setup()
170 170
    WiFiManager wifi;
171 171
    wifi.setConfigPortalTimeout(120); // a timeout so the ESP doesn't hang waiting to be configured, for instance after a power failure
172 172
    wifi.setTimeout(180); // sta AP 3 minute apoi se reseteaza din nou
173
-   if (!wifi.autoConnect("ClickHome")) {
173
+   if (!wifi.autoConnect(wifiID)) {
174 174
      #if DEBUG
175 175
      Serial.println("timeout - going to sleep");
176 176
      #endif
... ...
@@ -12,25 +12,26 @@
12 12
 #define DEBUG 0 //0=off 1=on
13 13
 
14 14
 const String model = "NodeMCU Dallas";
15
-const String ver = "v2.2.0";
15
+const String ver = "v2.2.2";
16 16
 const char* mqttServer = "mqtt.clickhome.ro";
17 17
 const int mqttPort = 1883;
18 18
 long loopTimer = 900000; // miliseconds - by default trimite la 15 minute
19 19
 long lastMsg = 0;
20 20
 float loopTemp = 0;
21 21
 String mqttMessage;
22
-const unsigned long interval_update=1000*60*60; // face update la 60 min 
22
+const unsigned long interval_update=1000*60*5; // face update la 5 min 
23 23
 unsigned long t_update=0;
24 24
 
25 25
 char mqtt_user[9]; //le va lua din FS
26 26
 char mqtt_devid[5]; //le va lua din FS
27 27
 char mqttPassword[15]; //urmatoarele le va genera cu functia gen
28
-char mqttSUB[22];
29
-char espName[13];
30
-char mqttESP[22];
31
-char mqttTEMP[23];
32
-char mqttLWT[22];
33
-char mqttSTA[24];
28
+char mqttSUB[23];
29
+char espName[14];
30
+char mqttESP[23];
31
+char mqttTEMP[24];
32
+char mqttLWT[23];
33
+char mqttSTA[25];
34
+char wifiID[15];
34 35
 
35 36
 // senzor de temperatura DALLAS
36 37
 #define ONE_WIRE_BUS D4  // pinul de date care se conecteaza la dallas
... ...
@@ -71,6 +72,9 @@ void generate_vars(){
71 71
   strcpy (mqttSTA, "tele/");
72 72
   strcat (mqttSTA, espName);
73 73
   strcat (mqttSTA, "/STATE");
74
+
75
+  strcpy (wifiID, "ClickHome-");
76
+  strcat (wifiID, mqtt_devid);
74 77
 }
75 78
 
76 79
 String ipToString(IPAddress ip){
... ...
@@ -166,7 +170,7 @@ void setup()
166 166
    WiFiManager wifi;
167 167
    wifi.setConfigPortalTimeout(120); // a timeout so the ESP doesn't hang waiting to be configured, for instance after a power failure
168 168
    wifi.setTimeout(180); // sta AP 3 minute apoi se reseteaza din nou
169
-   if (!wifi.autoConnect("ClickHome")) {
169
+   if (!wifi.autoConnect(wifiID)) {
170 170
      #if DEBUG
171 171
      Serial.println("timeout - going to sleep");
172 172
      #endif
... ...
@@ -21,15 +21,16 @@
21 21
 char mqtt_user[9]; //le va lua din FS
22 22
 char mqtt_devid[5]; //le va lua din FS
23 23
 char mqttPassword[15]; //urmatoarele le va genera cu functia gen
24
-char mqttSUB[22];
25
-char espName[13];
26
-char mqttESP[22];
27
-char mqttTEMP[23];
28
-char mqttLWT[22];
29
-char mqttSTA[24];
24
+char mqttSUB[23];
25
+char espName[14];
26
+char mqttESP[23];
27
+char mqttTEMP[24];
28
+char mqttLWT[23];
29
+char mqttSTA[25];
30
+char wifiID[15];
30 31
 
31 32
 const String model = "NodeMCU ";
32
-const String ver = "v2.1.0";
33
+const String ver = "v2.1.1";
33 34
 const char* mqttServer = "mqtt.clickhome.ro";
34 35
 const int mqttPort = 1883;
35 36
 long loopTimer = 900000; // miliseconds - by default trimite la 15 minute
... ...
@@ -41,7 +42,7 @@ float h = 0;
41 41
 String mqttMessage;
42 42
 bool bDHTstarted;
43 43
 int acquireresult;
44
-const unsigned long interval_update=1000*60*60; // face update la 60 min 
44
+const unsigned long interval_update=1000*60*5; // face update la 5 min 
45 45
 unsigned long t_update=0;
46 46
 
47 47
 void dht_wrapper();
... ...
@@ -84,6 +85,9 @@ void generate_vars(){
84 84
   strcpy (mqttSTA, "tele/");
85 85
   strcat (mqttSTA, espName);
86 86
   strcat (mqttSTA, "/STATE");
87
+
88
+  strcpy (wifiID, "ClickHome-");
89
+  strcat (wifiID, mqtt_devid);
87 90
 }
88 91
 
89 92
 String ipToString(IPAddress ip){
... ...
@@ -181,7 +185,7 @@ void setup()
181 181
    WiFiManager wifi;
182 182
    wifi.setConfigPortalTimeout(120); // a timeout so the ESP doesn't hang waiting to be configured, for instance after a power failure
183 183
    wifi.setTimeout(180); // sta AP 3 minute apoi se reseteaza din nou
184
-   if (!wifi.autoConnect("ClickHome")) {
184
+   if (!wifi.autoConnect(wifiID)) {
185 185
      #if DEBUG
186 186
      Serial.println("timeout - going to sleep");
187 187
      #endif