Now it compiles.
This commit is contained in:
parent
096cf070b2
commit
d513fce941
@ -1,3 +1,10 @@
|
||||
char * Concatenate(char *first, char *second) {
|
||||
static char buf[30];
|
||||
strcpy(buf,first);
|
||||
strcat(buf,second);
|
||||
return buf;
|
||||
}
|
||||
|
||||
void ConnectMQTT() {
|
||||
Serial.println("connecting MQTT...");
|
||||
while (!mqtt_client.connect("brewhouse", MQTT_USER, MQTT_PASSWORD)) {
|
||||
@ -7,8 +14,7 @@ void ConnectMQTT() {
|
||||
|
||||
Serial.println("\nconnected!");
|
||||
|
||||
String topic = TOPIC_PREFIX + BKTOPIC;
|
||||
mqtt_client.subscribe(topic);
|
||||
mqtt_client.subscribe(Concatenate(TOPIC_PREFIX, BKTOPIC));
|
||||
}
|
||||
|
||||
void MessageReceived(String &topic, String &payload) {
|
||||
@ -27,9 +33,7 @@ void MessageReceived(String &topic, String &payload) {
|
||||
return;
|
||||
}
|
||||
|
||||
String subscribed = TOPIC_PREFIX + BKTOPIC;
|
||||
|
||||
if (topic == subscribed) {
|
||||
if (topic == Concatenate(TOPIC_PREFIX, BKTOPIC)) {
|
||||
// Update PWM setpoint.
|
||||
String name = doc["entity"];
|
||||
String setting = doc["setpoint"];
|
||||
@ -41,7 +45,7 @@ void MessageReceived(String &topic, String &payload) {
|
||||
}
|
||||
}
|
||||
|
||||
void SetupMQTT(String broker) {
|
||||
void SetupMQTT(char *broker) {
|
||||
// Note: Local domain names (e.g. "Computer.local" on OSX) are not supported
|
||||
// by Arduino. You need to set the IP address directly.
|
||||
Serial.println("Setup MQTT client.");
|
||||
@ -64,9 +68,6 @@ static void SendSensorData() {
|
||||
String jstr;
|
||||
serializeJson(doc, jstr);
|
||||
|
||||
String topic = TOPIC_PREFIX;
|
||||
topic += "sensor/boil_kettle";
|
||||
|
||||
mqtt_client.publish(topic, jstr);
|
||||
mqtt_client.publish(Concatenate(TOPIC_PREFIX, "sensor/boil_kettle"), jstr);
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user