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