fixed input publish and change climate to name

This commit is contained in:
Siwat Sirichai 2024-01-01 00:07:11 +07:00
parent 4c77474a94
commit e1f0fd5651
6 changed files with 55 additions and 14 deletions

View file

@ -4,11 +4,11 @@
#include <ClimateCard.hpp>
// #define FRAM_DEBUG
#define MQTT_DEBUG
// #define MQTT_DEBUG
// #define WRITE_DEFAULT_NETCONF
#define CLIMATE_CARD_ENABLE
#define MQTT_CARD_REGISTER
#define DISPLAY_ENABLE
// #define DISPLAY_ENABLE
// Demo PLC firmware using the ESPMegaPRO OOP library
@ -47,6 +47,14 @@ void input_change_callback(uint8_t pin, uint8_t value)
Serial.println(value);
}
void mqtt_callback(char *topic, char* payload)
{
Serial.print("MQTT Callback: ");
Serial.print(topic);
Serial.print(" ");
Serial.println(payload);
}
#ifdef WRITE_DEFAULT_NETCONF
void setNetworkConfig()
{
@ -106,6 +114,7 @@ void setup()
#endif
ESP_LOGI("Initializer", "Connecting to MQTT");
espmega.iot->connectToMqtt();
espmega.iot->registerMqttCallback(mqtt_callback);
#ifdef MQTT_CARD_REGISTER
ESP_LOGI("Initializer", "Registering cards 0");
espmega.iot->registerCard(0);