From 4ebafa7cb785473bd4778066ca22e2506bf63a58 Mon Sep 17 00:00:00 2001 From: Siwat Sirichai Date: Tue, 3 Oct 2023 03:19:51 +0700 Subject: [PATCH] Update user_code.cpp --- src/user_code.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/user_code.cpp b/src/user_code.cpp index 2816e3e..93ffdc2 100644 --- a/src/user_code.cpp +++ b/src/user_code.cpp @@ -55,7 +55,7 @@ void user_init() elcd.print("page dashboard"); elcd_sendstop(); memcpy(AC_LOCK_TOPIC, MQTT_BASE_TOPIC, 20); - strcat(AC_LOCK_TOPIC, "/ac/lock/set"); + strcat(AC_LOCK_TOPIC, "/ac/set/lock"); memcpy(AC_LOCK_REPORT_TOPIC, MQTT_BASE_TOPIC, 20); strcat(AC_LOCK_REPORT_TOPIC, "/ac/lock"); ac_lock = ESPMega_FRAM.read8(AC_LOCK_ADDRESS); @@ -252,6 +252,7 @@ void ac_update_lcd() { void ac_lock_callback(String topic, String payload) { + Serial.println("INPAYLOAD"); if (payload.equals("lock")) { ac_lock = true; @@ -272,7 +273,7 @@ void ac_lock_callback(String topic, String payload) } void ac_lock_report() { - mqtt_client.publish(AC_LOCK_REPORT_TOPIC,ac_lock?"lock":"unlock"); + //mqtt_client.publish(AC_LOCK_REPORT_TOPIC,ac_lock?"lock":"unlock"); } void elcd_sendstop() { @@ -294,7 +295,8 @@ void pwm_update_lcd() { } void mqtt_connected_user_callback() { - mqtt.subscribe(AC_LOCK_TOPIC, ac_lock_callback); + Serial.println("User Subscribing"); + mqtt.subscribe(String(AC_LOCK_TOPIC), ac_lock_callback); ac_lock_report(); }