|
|
@@ -49,7 +49,7 @@ void MQTTcallback(char*, byte*, unsigned int); |
|
|
|
|
|
|
|
//MQTT |
|
|
|
const char *MQTT_BROKER = "loxberry"; |
|
|
|
IPAddress mqttbroker(192,168,1,104); |
|
|
|
IPAddress mqttbroker(192,168,1,128); |
|
|
|
EthernetClient ethClient; |
|
|
|
PubSubClient MQTTclient(ethClient); |
|
|
|
|
|
|
@@ -89,8 +89,8 @@ void setup() { |
|
|
|
Serial.println(mqttbroker); |
|
|
|
} else { |
|
|
|
Serial.println("dns failed "); |
|
|
|
Serial.println( (MQTT_BROKER, mqttbroker,10)); |
|
|
|
mqttbroker.fromString("192.168.1.127"); |
|
|
|
Serial.println( dnClient.getHostByName(MQTT_BROKER, mqttbroker,10)); |
|
|
|
mqttbroker.fromString("192.168.1.128"); |
|
|
|
Serial.println(mqttbroker); |
|
|
|
} |
|
|
|
bme.read(Pressure, Temperatur, Humidity); |
|
|
@@ -123,15 +123,15 @@ void loop() { |
|
|
|
Serial.println("connected to MQTT"); |
|
|
|
} |
|
|
|
temp.toCharArray(buff,temp.length()); |
|
|
|
MQTTclient.publish("Arduino/Stall/Temperatur", buff); |
|
|
|
MQTTclient.publish("Arduino/Aussen/Temperatur", buff); |
|
|
|
press.toCharArray(buff,press.length()); |
|
|
|
MQTTclient.publish("Arduino/Stall/Pressure", buff); |
|
|
|
MQTTclient.publish("Arduino/Aussen/Pressure", buff); |
|
|
|
hum.toCharArray(buff,hum.length()); |
|
|
|
MQTTclient.publish("Arduino/Stall/Humidity", buff); |
|
|
|
MQTTclient.publish("Arduino/Aussen/Humidity", buff); |
|
|
|
snprintf(msg, 50, "%ld", millis()); |
|
|
|
Serial.println("Publish message: "); |
|
|
|
Serial.println(msg); |
|
|
|
MQTTclient.publish("Arduino/Stall/data/Alive", msg); |
|
|
|
MQTTclient.publish("Arduino/Aussen/data/Alive", msg); |
|
|
|
|
|
|
|
// MQTTclient.loop(); // Schleife für MQTT |
|
|
|
|
|
|
@@ -171,10 +171,10 @@ void loop() { |
|
|
|
|
|
|
|
client.print("Feuchtigkeit = "); //Prints information within qoutation |
|
|
|
client.print(hum); //Prints the Humidity read from the DHT11 on PIN 5 |
|
|
|
client.println("% "); |
|
|
|
client.println(" % "); |
|
|
|
client.print("Temperature = "); |
|
|
|
client.print(temp); //Prints the temperature read from the DHT11 on PIN 5 |
|
|
|
client.println("C "); |
|
|
|
client.println(" C "); |
|
|
|
client.print("Luftdruck = "); |
|
|
|
client.print(press); |
|
|
|
client.println(" [hPa]"); |
|
|
|