fixed climate card mqtt crash bug
This commit is contained in:
parent
9cd5b7132b
commit
4c77474a94
8 changed files with 128 additions and 50 deletions
|
@ -9,12 +9,16 @@ ClimateIoT::~ClimateIoT() {
|
|||
}
|
||||
|
||||
bool ClimateIoT::begin(uint8_t card_id, ExpansionCard *card, PubSubClient *mqtt, char *base_topic) {
|
||||
this->mqtt = mqtt;
|
||||
this->base_topic = base_topic;
|
||||
this->card_id = card_id;
|
||||
this->card = (ClimateCard *)card;
|
||||
// Reister Callbacks
|
||||
auto bindedSensorCallback = std::bind(&ClimateIoT::handleSensorUpdate, this, std::placeholders::_1, std::placeholders::_2);
|
||||
this->card->registerSensorCallback(bindedSensorCallback);
|
||||
auto bindedAirConditionerCallback = std::bind(&ClimateIoT::handleAirConditionerUpdate, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3);
|
||||
this->card->registerChangeCallback(bindedAirConditionerCallback);
|
||||
ESP_LOGD("ClimateIoT", "Climate IoT Component initialized");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -83,9 +87,11 @@ void ClimateIoT::publishReport() {
|
|||
}
|
||||
|
||||
void ClimateIoT::subscribe() {
|
||||
ESP_LOGD("ClimateIoT", " topics");
|
||||
this->subscribeRelative(AC_TEMPERATURE_SET_TOPIC);
|
||||
this->subscribeRelative(AC_MODE_SET_TOPIC);
|
||||
this->subscribeRelative(AC_FAN_SPEED_SET_TOPIC);
|
||||
ESP_LOGD("ClimateIoT", "Subscribed to topics");
|
||||
}
|
||||
|
||||
void ClimateIoT::loop() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue