First commit
This commit is contained in:
72
ESP_BigRoom/src/amqtt.cpp
Normal file
72
ESP_BigRoom/src/amqtt.cpp
Normal file
@@ -0,0 +1,72 @@
|
||||
// #include <amqtt.h>
|
||||
|
||||
// void connectToWifi() {
|
||||
// Serial.println("Connecting to Wi-Fi...");
|
||||
// WiFi.begin(ssid, password);
|
||||
// }
|
||||
|
||||
// void connectToMqtt() {
|
||||
// Serial.println("Connecting to MQTT...");
|
||||
// //mqttClient.connect();
|
||||
// }
|
||||
|
||||
// void onWifiConnect(const WiFiEventStationModeGotIP& event) {
|
||||
// Serial.println("Connected to Wi-Fi.");
|
||||
// Serial.print("IP: ");
|
||||
// Serial.println(WiFi.localIP());
|
||||
// connectToMqtt();
|
||||
// }
|
||||
|
||||
// void onWifiDisconnect(const WiFiEventStationModeDisconnected& event) {
|
||||
// Serial.println("Disconnected from Wi-Fi.");
|
||||
// mqttReconnectTimer.detach(); // ensure we don't reconnect to MQTT while reconnecting to Wi-Fi
|
||||
// wifiReconnectTimer.once(2, connectToWifi);
|
||||
// }
|
||||
|
||||
// void onMqttConnect(bool sessionPresent) {
|
||||
// Serial.println("Connected to MQTT.");
|
||||
// Serial.print("Session present: ");
|
||||
// Serial.println(sessionPresent);
|
||||
// //uint16_t packetIdSub =
|
||||
// // Serial.print("Subscribing Lamp1, packetId: ");
|
||||
// // Serial.println(packetIdSub);
|
||||
// //packetIdSub = mqttClient.subscribe("/home/kor/lamp2_set", 1);
|
||||
// //Serial.print("Subscribing Lamp2, packetId: ");
|
||||
// //Serial.println(packetIdSub);
|
||||
// //Serial.println("Publishing at Lamp 1");
|
||||
// //mqttClient.publish("/home/kor/lamp2", 1, false, lStat2 ? "1" : "0");
|
||||
// //Serial.println("Publishing at Lamp 2");
|
||||
// }
|
||||
|
||||
// void onMqttDisconnect(AsyncMqttClientDisconnectReason reason) {
|
||||
// Serial.println("Disconnected from MQTT.");
|
||||
|
||||
// if (WiFi.isConnected()) {
|
||||
// mqttReconnectTimer.once(2, connectToMqtt);
|
||||
// }
|
||||
// }
|
||||
|
||||
// void onMqttSubscribe(uint16_t packetId, uint8_t qos) {
|
||||
// // Serial.println("Subscribe acknowledged.");
|
||||
// // Serial.print(" packetId: ");
|
||||
// // Serial.println(packetId);
|
||||
// // Serial.print(" qos: ");
|
||||
// // Serial.println(qos);
|
||||
// }
|
||||
|
||||
// void onMqttUnsubscribe(uint16_t packetId) {
|
||||
// // Serial.println("Unsubscribe acknowledged.");
|
||||
// // Serial.print(" packetId: ");
|
||||
// // Serial.println(packetId);
|
||||
// }
|
||||
|
||||
// void onMqttMessage(char* topic, char* payload, AsyncMqttClientMessageProperties properties, size_t len, size_t index, size_t total) {
|
||||
// if(strcmp(topic, "/home/kor/lamp1_set") == 0){
|
||||
// }
|
||||
// }
|
||||
|
||||
// void onMqttPublish(uint16_t packetId) {
|
||||
// // Serial.println("Publish acknowledged.");
|
||||
// // Serial.print(" packetId: ");
|
||||
// // Serial.println(packetId);
|
||||
// }
|
||||
Reference in New Issue
Block a user