Cleanup
This commit is contained in:
parent
5b45347914
commit
3022da7fe4
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -150,3 +150,4 @@ out.*
|
||||||
*.csv
|
*.csv
|
||||||
*.txt
|
*.txt
|
||||||
*.json
|
*.json
|
||||||
|
.aider*
|
||||||
|
|
|
@ -12,15 +12,9 @@ MqttClient mqttClient(wc);
|
||||||
ESP8266WebServer server(80);
|
ESP8266WebServer server(80);
|
||||||
|
|
||||||
String deviceName;
|
String deviceName;
|
||||||
|
String topic;
|
||||||
#define OUTPUT_PIN 4
|
|
||||||
|
|
||||||
|
|
||||||
// Broker IP and port are now defined in secrets.h
|
|
||||||
// const char broker[] = "192.168.69.106";
|
|
||||||
// int port = 1883;
|
|
||||||
String topic; // Changed from const char[]
|
|
||||||
#define QOS_2 2
|
#define QOS_2 2
|
||||||
|
#define OUTPUT_PIN 4
|
||||||
|
|
||||||
void (* resetFunc) (void) = 0;
|
void (* resetFunc) (void) = 0;
|
||||||
|
|
||||||
|
@ -104,9 +98,9 @@ void setup() {
|
||||||
mqttClient.setId(deviceName.c_str());
|
mqttClient.setId(deviceName.c_str());
|
||||||
|
|
||||||
Serial.print("[MQTT] Attempting to connect to the MQTT broker: ");
|
Serial.print("[MQTT] Attempting to connect to the MQTT broker: ");
|
||||||
Serial.println(SECRET_MQTT_BROKER_IP);
|
Serial.println(MQTT_BROKER_IP);
|
||||||
|
|
||||||
if (!mqttClient.connect(SECRET_MQTT_BROKER_IP, SECRET_MQTT_PORT)) {
|
if (!mqttClient.connect(MQTT_BROKER_IP, MQTT_PORT)) {
|
||||||
Serial.print("MQTT connection failed! Error code = ");
|
Serial.print("MQTT connection failed! Error code = ");
|
||||||
Serial.println(mqttClient.connectError());
|
Serial.println(mqttClient.connectError());
|
||||||
Serial.println("Reseting...");
|
Serial.println("Reseting...");
|
||||||
|
@ -138,7 +132,7 @@ void loop() {
|
||||||
Serial.print("[MQTT] Not connected! Error code = ");
|
Serial.print("[MQTT] Not connected! Error code = ");
|
||||||
Serial.println(mqttClient.connectError());
|
Serial.println(mqttClient.connectError());
|
||||||
Serial.println("[MQTT] Reconnecting...");
|
Serial.println("[MQTT] Reconnecting...");
|
||||||
mqttClient.connect(SECRET_MQTT_BROKER_IP, SECRET_MQTT_PORT);
|
mqttClient.connect(MQTT_BROKER_IP, MQTT_PORT);
|
||||||
delay(5000);
|
delay(5000);
|
||||||
|
|
||||||
Serial.print("[MQTT] Subscribing to topic: ");
|
Serial.print("[MQTT] Subscribing to topic: ");
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#define SECRET_SSID ""
|
#define SECRET_SSID ""
|
||||||
#define SECRET_PASS ""
|
#define SECRET_PASS ""
|
||||||
|
|
||||||
#define SECRET_MQTT_BROKER_IP "192.168.69.106"
|
#define MQTT_BROKER_IP ""
|
||||||
#define SECRET_MQTT_PORT 1883
|
#define MQTT_PORT 1883
|
||||||
|
|
Loading…
Reference in New Issue
Block a user