Cleanup
This commit is contained in:
parent
5b45347914
commit
3022da7fe4
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -150,3 +150,4 @@ out.*
|
|||
*.csv
|
||||
*.txt
|
||||
*.json
|
||||
.aider*
|
||||
|
|
|
@ -12,15 +12,9 @@ MqttClient mqttClient(wc);
|
|||
ESP8266WebServer server(80);
|
||||
|
||||
String deviceName;
|
||||
|
||||
#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[]
|
||||
String topic;
|
||||
#define QOS_2 2
|
||||
#define OUTPUT_PIN 4
|
||||
|
||||
void (* resetFunc) (void) = 0;
|
||||
|
||||
|
@ -104,9 +98,9 @@ void setup() {
|
|||
mqttClient.setId(deviceName.c_str());
|
||||
|
||||
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.println(mqttClient.connectError());
|
||||
Serial.println("Reseting...");
|
||||
|
@ -138,7 +132,7 @@ void loop() {
|
|||
Serial.print("[MQTT] Not connected! Error code = ");
|
||||
Serial.println(mqttClient.connectError());
|
||||
Serial.println("[MQTT] Reconnecting...");
|
||||
mqttClient.connect(SECRET_MQTT_BROKER_IP, SECRET_MQTT_PORT);
|
||||
mqttClient.connect(MQTT_BROKER_IP, MQTT_PORT);
|
||||
delay(5000);
|
||||
|
||||
Serial.print("[MQTT] Subscribing to topic: ");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#define SECRET_SSID ""
|
||||
#define SECRET_PASS ""
|
||||
|
||||
#define SECRET_MQTT_BROKER_IP "192.168.69.106"
|
||||
#define SECRET_MQTT_PORT 1883
|
||||
#define MQTT_BROKER_IP ""
|
||||
#define MQTT_PORT 1883
|
||||
|
|
Loading…
Reference in New Issue
Block a user