Use strings.
This commit is contained in:
parent
dd49bdfefa
commit
096cf070b2
@ -6,7 +6,9 @@ void ConnectMQTT() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Serial.println("\nconnected!");
|
Serial.println("\nconnected!");
|
||||||
mqtt_client.subscribe("brewery/setpoint/bk");
|
|
||||||
|
String topic = TOPIC_PREFIX + BKTOPIC;
|
||||||
|
mqtt_client.subscribe(topic);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageReceived(String &topic, String &payload) {
|
void MessageReceived(String &topic, String &payload) {
|
||||||
@ -24,10 +26,10 @@ void MessageReceived(String &topic, String &payload) {
|
|||||||
Serial.println(error.f_str());
|
Serial.println(error.f_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
char buf[30];
|
|
||||||
strcpy(buf,TOPIC_PREFIX);
|
String subscribed = TOPIC_PREFIX + BKTOPIC;
|
||||||
strcat(buf,BKTOPIC);
|
|
||||||
if (topic == buf) {
|
if (topic == subscribed) {
|
||||||
// Update PWM setpoint.
|
// Update PWM setpoint.
|
||||||
String name = doc["entity"];
|
String name = doc["entity"];
|
||||||
String setting = doc["setpoint"];
|
String setting = doc["setpoint"];
|
||||||
|
Loading…
Reference in New Issue
Block a user