MQTT nun mit PubSub

Grafik etwas angepasst
This commit is contained in:
rxf
2024-08-19 17:23:13 +02:00
parent 3c170a1f69
commit eb1a102120
7 changed files with 145 additions and 146 deletions

View File

@@ -75,16 +75,15 @@ void setup() {
connectToWifi();
// Start MQTT
setupMQTT();
connectToMqtt();
Serial.println("MQTT started");
setup_mqtt();
timeinfo = gettheTime(NTPREADTIME);
showDateTime(timeinfo);
bmeReadtimer = millis();
drawChart();
showResetTime(timeinfo);
/*
// Register print function for debugging
@@ -108,15 +107,21 @@ void loop() {
if (millis() - bmeReadtimer > bmeReadTime) {
bmeReadtimer = millis();
bmedata = readBME280();
publishMQTTmessage(bmedata.temp, bmedata.hum);
doPublish(bmedata.temp+arcTemp.value_offset, bmedata.hum+arcHum.value_offset);
}
if (millis() - updatetimer > updateTime) {
updatetimer = millis();
updatechartData(bmedata.temp, bmedata.hum);
setValuetoArc(arcTemp, bmedata.temp);
setValuetoArc(arcHum, bmedata.hum);
updatechartData(bmedata.temp+arcTemp.value_offset, bmedata.hum+arcHum.value_offset);
setValuetoArc(arcTemp, bmedata.temp+arcTemp.value_offset);
setValuetoArc(arcHum, bmedata.hum+arcHum.value_offset);
}
if (!client.connected())
{
reconnect();
}
client.loop();
lv_task_handler(); // let the GUI do its work
lv_tick_inc(5); // tell LVGL how much time has passed
delay(5); // let this time pass