summaryrefslogtreecommitdiff
path: root/cricket.ino
diff options
context:
space:
mode:
Diffstat (limited to 'cricket.ino')
-rw-r--r--cricket.ino12
1 files changed, 9 insertions, 3 deletions
diff --git a/cricket.ino b/cricket.ino
index 0166db5..a78091d 100644
--- a/cricket.ino
+++ b/cricket.ino
@@ -87,9 +87,15 @@ void loop() {
connectMqtt();
}
dtostrf(t, 1, 2, t_msg);
- mqttClient.publish("cricket1/temperature", t_msg);
dtostrf(h, 1, 2, h_msg);
- mqttClient.publish("cricket1/humidity", h_msg);
dtostrf(m, 1, 2, m_msg);
- mqttClient.publish("cricket1/moisture", m_msg);
+ char temp_topic[20];
+ char humidity_topic[20];
+ char moisture_topic[20];
+ sprintf(temp_topic, "%s/temperature", MQTT_ID);
+ sprintf(humidity_topic, "%s/humidity", MQTT_ID);
+ sprintf(moisture_topic, "%s/moisture", MQTT_ID);
+ mqttClient.publish(temp_topic, t_msg);
+ mqttClient.publish(humidity_topic, h_msg);
+ mqttClient.publish(moisture_topic, m_msg);
}