Get rid of some unnecessary serial output.

This commit is contained in:
Chris Giacofei 2023-01-27 10:55:13 -05:00
parent 123d70f7f7
commit 59df30351e
2 changed files with 5 additions and 9 deletions

View File

@ -129,8 +129,5 @@ void Communicator::mqtt_discovery(const String topic, StaticJsonDocument<1536> &
}
void Communicator::publish_data(String topic, String value) {
Serial.print(topic);
Serial.print(" --> ");
Serial.println(value);
_mqtt_client.publish(topic.c_str(), value.c_str(), true);
}

View File

@ -32,12 +32,11 @@ unsigned long currentMillis;
void mqttCallback(char *topic, byte *payload, unsigned int length) {
payload[length] = '\0';
for (int i=0;i<TOTAL_DEVICES;i++) {
if (strcmp((char *)topic, (DEVICE_LIST[i].mode.CmdTopic).c_str() ) == 0){
DEVICE_LIST[i].mode.Setting = (char*)payload;
Serial.print("Swing: ");
Serial.println(DEVICE_LIST[i].swing_topic);
if (DEVICE_LIST[i].mode.Setting == "auto") {
DEVICE_LIST[i].swing_state = "off";
hass_comm.publish_data(DEVICE_LIST[i].swing_topic, "on");
@ -45,11 +44,11 @@ void mqttCallback(char *topic, byte *payload, unsigned int length) {
DEVICE_LIST[i].swing_state = "on";
hass_comm.publish_data(DEVICE_LIST[i].swing_topic, "off");
}
hass_comm.publish_data(DEVICE_LIST[i].mode.StateTopic, DEVICE_LIST[i].mode.Setting);
break;
}
int setpoint_count;
bool dual_mode = DEVICE_LIST[i].dual;
if (dual_mode) {
@ -191,7 +190,7 @@ void setup() {
const char* password = WIFI_PASSWORD;
sensors.begin();
sensors.setResolution(glycol_ds18b20, 9);
Serial.begin(115200);
WiFi.begin(ssid, password);