fixed input publish and change climate to name
This commit is contained in:
parent
4c77474a94
commit
e1f0fd5651
6 changed files with 55 additions and 14 deletions
|
@ -41,15 +41,11 @@ void ClimateIoT::publishClimateTemperature() {
|
|||
}
|
||||
|
||||
void ClimateIoT::publishClimateMode() {
|
||||
char payload[2];
|
||||
itoa(this->card->getMode(), payload, 10);
|
||||
this->publishRelative(AC_MODE_REPORT_TOPIC, payload);
|
||||
this->publishRelative(AC_MODE_REPORT_TOPIC, this->card->getModeName());
|
||||
}
|
||||
|
||||
void ClimateIoT::publishClimateFanSpeed() {
|
||||
char payload[2];
|
||||
itoa(this->card->getFanSpeed(), payload, 10);
|
||||
this->publishRelative(AC_FAN_SPEED_REPORT_TOPIC, payload);
|
||||
this->publishRelative(AC_FAN_SPEED_REPORT_TOPIC, this->card->getFanSpeedName());
|
||||
}
|
||||
|
||||
void ClimateIoT::publishSensor() {
|
||||
|
@ -113,8 +109,7 @@ bool ClimateIoT::processSetTemperatureMessage(char *topic, char *payload, uint8_
|
|||
|
||||
bool ClimateIoT::processSetModeMessage(char *topic, char *payload, uint8_t topic_length) {
|
||||
if (!strcmp(topic, AC_MODE_SET_TOPIC)) {
|
||||
uint8_t mode = atoi(payload);
|
||||
this->card->setMode(mode);
|
||||
this->card->setModeByName(payload);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -122,9 +117,7 @@ bool ClimateIoT::processSetModeMessage(char *topic, char *payload, uint8_t topic
|
|||
|
||||
bool ClimateIoT::processSetFanSpeedMessage(char *topic, char *payload, uint8_t topic_length) {
|
||||
if (!strcmp(topic, AC_FAN_SPEED_SET_TOPIC)) {
|
||||
uint8_t fan_speed = atoi(payload);
|
||||
this->card->setFanSpeed(fan_speed);
|
||||
return true;
|
||||
this->card->setFanSpeedByName(payload);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue