
With a ESP32 C3 Mini
The temperatur ist puplish in a homeautomation Software named IP-Symcon, Code:
Code: [Local Link Removed for Guests]
' 5 mal 18B20 Sensoren überwachen die Fernheizungs Station
OPTION.WDT 12000
print mqtt.setup("mqtt://192.168.x.x", 1)
print mqtt.connect("xxxx", "xxxxx") ' login / pass required
print mqtt.subscribe("/Heizung") ' subscribe to the topic /Heizung Deutsch aboniert alle topic mit /Heizung als Topic, für später
goto messen
Messen:
Do
onmqtt mqtt_msg ' Kommt per MQTT was, dann springe zu mqtt_msg , for later
'Print "Die Temperature 1 ist ";TEMPR$(2, 1) ; " °C"
'Print "Die Temperature 2 ist ";TEMPR$(2, 2) ; " °C"
'Print "Die Temperature 3 ist ";TEMPR$(2, 3) ; " °C"
ret1$ = TEMPR$(2, 1) 'read the 1. sensor on the pin 2
ret2$ = TEMPR$(2, 2) 'read the 2. sensor on the pin 2
ret3$ = TEMPR$(2, 3) 'read the 3. sensor on the pin 2
ret4$ = TEMPR$(2, 4) 'read the 4. sensor on the pin 2
ret5$ = TEMPR$(2, 5) 'read the 5. sensor on the pin 2
OPTION.WDTRESET
r1 = VAL(ret1$)
ret1$ = str$(r1, "%5.1f °C")
r2 = VAL(ret2$)
ret2$ = str$(r2, "%5.1f °C")
r3 = VAL(ret3$)
ret3$ = str$(r3, "%5.1f °C")
r4 = VAL(ret4$)
ret4$ = str$(r4, "%5.1f °C")
r5 = VAL(ret5$)
ret5$ = str$(r5, "%5.1f °C")
OPTION.WDTRESET
wlog ret1$, " ", ret2$, " ", ret3$, " ", ret4$, " ", ret5$
print mqtt.publish("/FH Vorlauf", "" + ret1$)
print mqtt.publish("/FH Rücklauf", "" + ret2$)
print mqtt.publish("/Warm Wasser Tauscher", "" + ret3$)
print mqtt.publish("/Vorlauf", "" + ret4$)
print mqtt.publish("/Rücklauf", "" + ret5$)
OPTION.WDTRESET
CLS
a$ = "<center><h2> - FH Vorlauf - "+ ret1$ + " - </h1><br>"
a$ = a$ + "<center><h2> - FH Rücklauf - "+ ret2$ +" - </h1><br>"
a$ = a$ + "<center><h2> - Warmwasser Tauscher - "+ ret3$ +" - </h1><br>"
a$ = a$ + "<center><h2> - Vorlauf- "+ ret4$ +" - </h1><br>"
a$ = a$ + "<center><h2> - Rücklauf - "+ ret5$ +" - </h1><br>"
HTML a$
OPTION.WDTRESET
loop while (ret1$<> "-127.0 °C") or (ret2$<> "-127.0 °C") or (ret3$<> "-127.0 °C") or (ret4$<> "-127.0 °C") or (ret5$<> "-127.0 °C")
CLS
a$ = "Sensorfehler"
HTML a$
Print "Sensorfehler"
mqtt_msg:
' later i use , für später
return
END