Monitoring my network rack with Tasmota, DS18B20 and Uptime Kuma


Monitoring my network rack with Tasmota, DS18B20 and Uptime Kuma — almost for free

A new network rack brings some order to the basement. But once the NAS, router, Proxmox hosts and switches are packed together, the next question comes up: How hot does it actually get inside? And at what point does a fan make sense?

Rather than immediately buying a rack fan and a separate temperature controller, I looked through my box of spare electronics.

I ended up reusing an old Wi-Fi smart plug that I'd already flashed with Tasmota, a DS18B20 temperature sensor, Home Assistant and Uptime Kuma. The smart plug can even switch a fan later on.

This is why I like giving old hardware a second job. The temperature measurement was working, and I successfully tested a push request directly from Tasmota to my local Uptime Kuma instance. At the time of the original build, I still hadn't completed a multi-day temperature graph or a full alarm and failure test.

Electrical safety: This project reuses a previously modified 230 V mains smart plug. Working inside mains-powered devices is dangerous and should be left to qualified people. Never power an exposed PCB while working on it. Capacitors can retain a charge after unplugging. This is a description of my setup, not a beginner's guide to modifying mains equipment. A damaged or unsafe smart plug must not be used.

Starting point: a 12U rack in the basement

My core home infrastructure is gradually moving into a 12U wall-mounted rack: UniFi network equipment, Synology NAS, Proxmox machines, a Raspberry Pi and other small devices.

Initially, I planned on passive cooling.

The sensible first step wasn't installing a fan; it was collecting measurements. Both the air temperature inside the rack and the internal component temperatures matter, especially the NAS hard drives.

One air sensor doesn't replace the device sensors, but it gives me an additional measurement that's easy to compare over time.

Hardware I already had

  • An older Wi-Fi smart plug with an ESP-WROOM-02 / ESP8266, already flashed with Tasmota and with some connections brought out
  • A digital DS18B20 1-Wire temperature sensor
  • A 4.7 kΩ resistor as a pull-up between the data line and 3.3 V
  • My existing MQTT broker and Home Assistant
  • Local Uptime Kuma and an ntfy service for push notifications

I didn't need to buy anything for the temperature measurement itself. A fan was optional until I'd seen the data.

Connections on my smart plug

The wire colours apply only to my particular earlier modification. They aren't a general ESP pinout:

Wire Function
Yellow 3.3 V
White GND
Blue GPIO0
Purple RX / GPIO3
Green TX / GPIO1

I connected the sensor to the green wire, GPIO1/TX. That isn't the preferred default pin for 1-Wire, but it was already accessible.

The correct Tasmota GPIO configuration matters, as does disabling serial logging:

SerialLog 0

If you're starting from scratch, an unused GPIO4 or GPIO5 is usually a better choice. On an existing device, check the relay, buttons and boot-strapping pins first.

Connecting the DS18B20

For a bare DS18B20 in a TO-92 package, look at the flat labelled face with the legs pointing down. Left is GND, middle is DQ/DATA and right is VDD.

For waterproof probes with attached cables, don't assume that a particular wire colour means a particular pin. Check the actual probe's documentation.

My wiring:

ESP / Tasmota                  DS18B20

3,3 V  (gelb) ---------------- VDD
                    |
                  4,7 kΩ
                    |
DATA (grün) -------+--------- DQ
GND   (weiß) ----------------- GND

The 4.7 kΩ resistor goes between 3.3 V and DATA, not in series with the data wire. With a short cable, it can sit near the sensor.

The familiar four-band colour code is yellow, violet, red and gold.

[Photo placeholder: reused Wi-Fi smart plug and DS18B20]

Upgrading Tasmota 6.6 to a current firmware

The plug was still running Tasmota 6.6.0 from July 2019.

It worked, but I wanted something more current for permanent operation. Jumping several major releases at once is risky because configuration storage and GPIO mappings have changed over time.

After backing up the configuration, I followed the documented upgrade path through:

6.6.0 → 6.7.1 → 7.2.0 → 8.5.1 → 9.1.0 → aktuelle Release

Each firmware image went through the web UI's Firmware Upgrade function. Appropriate intermediate releases also support compressed .bin.gz images.

My ESP reported a 2 MB flash chip but only 1 MB available for program storage, so firmware image size mattered.

After every step, I checked Wi-Fi, MQTT and the temperature readings. The GPIO mapping deserves another check after the jump to 9.1.

[Screenshot placeholder: Tasmota interface showing the temperature]

Official instructions: Tasmota firmware upgrading.

Sensor position: high at the back, but hanging in free air

I placed the first sensor near the rear top of the rack, roughly 5–10 cm below the lid.

It should hang freely rather than touching the metal rack or sitting directly in the hot exhaust stream of one device. A loose cable tie on a neighbouring cable is enough, provided the sensor itself remains in the air.

The first reading was only about 18.4–18.5°C. That's a snapshot, not proof of what happens under load after several hours.

[Photo placeholder: sensor near the top of the 12U rack]

Home Assistant already sees it

The plug publishes data over MQTT, and Home Assistant discovered the DS18B20 as:

sensor.netzwerkschrank_ds18b20_temperature

That let me display the current value and its history without a separate YAML sensor definition.

My Home Assistant InfluxDB integration was also active, but I still needed to verify whether this particular entity was actually included. Depending on include/exclude filters, an active integration doesn't guarantee that every sensor is stored.

For later Grafana analysis I'm interested in:

  • Temperature curves over several days
  • Difference between rack air and basement air
  • Comparison with the Synology's drive temperatures

[Grafana chart to be added after the long-term test]

Alerting: from Tasmota straight to Uptime Kuma

Tasmota doesn't need to wait for Home Assistant to trigger an alarm.

My local Uptime Kuma instance was reachable at 192.168.1.18:3001 and offers an individual URL for each push monitor.

I successfully tested the command from the Tasmota console:

WebQuery http://192.168.1.18:3001/api/push/DEIN_PUSH_TOKEN?status=up&msg=OK GET

The token shown is a placeholder. Never publish a real Kuma push token. Treat it like a credential and rotate it if it leaks.

The architecture is straightforward:

DS18B20
   |
Tasmota smart plug
   | HTTP on local network
   v
Uptime Kuma (push monitor)
   |
   v
ntfy → iPhone

Important distinction: Kuma receives up or down status, not an ongoing temperature measurement. Tasmota decides whether the threshold has been crossed. Home Assistant and InfluxDB handle the temperature history.

Why use local Kuma? My public ntfy endpoint uses HTTPS, and a direct Tasmota HTTP request to the public domain can fail when it's redirected to HTTPS. The local Kuma push URL was simpler and already connected to notification channels.

Originally planned states

State Planned response
Below 32°C Normal operation
35°C or higher Temperature alarm via Kuma
38°C or higher Critical temperature, separate escalation planned
Missing heartbeat Kuma reports the monitor unavailable

A push monitor only detects the absence of a heartbeat if its timeout is configured appropriately.

A broken sensor isn't automatically detected just because you use push monitoring: if the rules keep sending up, Kuma will see green.

I still needed to validate missing-sensor behaviour, startup behaviour and recovery.

The Tasmota rules documentation explains the local rule engine.

Fan control was already possible

Another advantage of the modified smart plug was its relay. A suitable plug-in fan could be controlled directly without adding another switch.

My initial planned thresholds:

  • On: above 32°C
  • Off: below 29°C

That's a 3°C hysteresis, preventing constant relay chatter around a single threshold.

The first rule I prepared was:

Rule3 ON DS18B20#Temperature>32 DO Power1 ON ENDON ON DS18B20#Temperature<29 DO Power1 OFF ENDON
Rule3 1

At that stage, the rule was only prepared. I hadn't connected a fan or validated failure conditions in real operation.

Before permanent use, the setup needs tests for power restoration, missing or invalid sensor values and manual relay switching. A simple temperature-trigger rule does not automatically guarantee a safe state if the sensor fails.

And of course, you cannot just connect a random 12 V PC fan to a 230 V outlet. Use a properly enclosed mains-powered fan or a correctly designed low-voltage supply.

What was still missing: a real long-term test

I didn't want to buy fans without evidence that I needed them.

My checklist was:

  1. Record two or three days of readings under different equipment loads.
  2. Compare the upper rack temperature with the basement air.
  3. Compare against Synology drive and other device temperatures.
  4. Test a simulated Kuma alarm and a missing heartbeat.
  5. Only then activate the fan logic permanently and test its safety behaviour.

The numbers 32/29/35/38°C are operational thresholds for this particular rack, not universal limits for network equipment. The manufacturers' specified operating temperatures still matter.

Initial conclusion

A discarded Tasmota plug and a DS18B20 turned into a surprisingly useful monitor.

Temperature was visible in Home Assistant, and the direct push from Tasmota to Uptime Kuma worked. That laid the groundwork for independent alerting and simple fan control later.

The project cost almost nothing because I reused equipment I already owned.

But whether the rack actually needed a fan would be decided by measurements, not guesswork.


Useful links


Update, 24 October 2026: fan installed and thresholds adjustable in Home Assistant

The sections above describe my initial build and plans. If you're going to copy the switching thresholds, read this update first. The hardware has moved on, and the fan-off temperature changed.

Temperature monitoring has now turned into active fan control. An installed fan is switched directly by the Tasmota plug's relay. The DS18B20 still measures the temperature.

The entire control loop runs locally in Tasmota. It continues working even if Home Assistant or MQTT is unavailable.

Why an update was necessary

The first switching histories looked much more hectic than expected. Sometimes the fan switched off after less than two minutes, then came back on shortly afterwards.

Home Assistant showed swings from roughly 25°C to more than 31°C within minutes.

That suggests the temperature probe is being influenced too strongly by the fan's airflow. Instead of representative rack temperature, it may be measuring a pocket of air that cools extremely quickly when the fan runs.

My first response will therefore be to move the sensor, ideally into the upper third of the rack and away from the direct fan airflow.

Only after that will I decide whether minimum run times or restart lockouts are necessary.

Three independent temperature thresholds

Home Assistant now has three input_number helpers to adjust the settings:

Purpose Tasmota variable Home Assistant entity Initial value
Fan ON Mem2 input_number.netzwerkschrank_lufter_ein 32°C
Fan OFF Mem3 input_number.netzwerkschrank_lufter_aus 25°C
Temperature alarm ON Mem4 input_number.netzwerkschrank_alarm 35°C

The alarm-clear threshold stays fixed below 28°C for now. Fan hysteresis and alarm hysteresis are separate on purpose.

Initial values in the Tasmota console:

Backlog Mem2 32; Mem3 25; Mem4 35

To inspect them:

Mem
Rule1
Rule2
Rule3

Rule1: temperature alarm and watchdog

The first rule tracks alarm state in Var1 and resets a 180-second watchdog whenever a valid DS18B20 reading arrives.

If readings stop, the timer expires and the alarm is set.

The upper alarm threshold uses the persistent Mem4 value:

Rule1 ON System#Boot DO Backlog Var1 1; RuleTimer1 180 ENDON ON DS18B20#Temperature DO RuleTimer1 180 ENDON ON DS18B20#Temperature>%mem4% DO Var1 1 ENDON ON DS18B20#Temperature<28 DO Var1 0 ENDON ON Rules#Timer=1 DO Var1 1 ENDON

Enable it when needed:

Rule1 1

After sensor failure, Var1 is set to 1. If a subsequent reading below 28°C arrives, the rule clears the alarm again. That recovery behaviour needs a deliberate failure simulation.

Rule2: push status to Uptime Kuma

Rule2 is unchanged. Every minute it sends the alarm state stored in Var1 to a local Uptime Kuma push monitor.

  • Var1=0 → status=up
  • Var1=1 → status=down

The actual push URL and token are intentionally omitted.

The principle looks like this:

ON Time#Minute DO Event kuma=%var1% ENDON
ON Event#kuma=0 DO WebQuery http://KUMA-HOST:3001/api/push/TOKEN?status=up GET ENDON
ON Event#kuma=1 DO WebQuery http://KUMA-HOST:3001/api/push/TOKEN?status=down GET ENDON

Don't paste that schematic in place of the production Rule2. It contains placeholders; my working rule remains unchanged.

Rule3: locally controlled fan

The fan now switches based on two variable thresholds:

Rule3 ON DS18B20#Temperature>%mem2% DO Power1 ON ENDON ON DS18B20#Temperature<%mem3% DO Power1 OFF ENDON

Activate it:

Rule3 1

So the current behaviour is ON above 32°C and OFF below 25°C.

The Mem values persist in Tasmota, and the fan keeps working even without Home Assistant.

Syncing dashboard sliders over MQTT

The three numeric helpers live on my Home Assistant Lovelace dashboard called “Netzwerkschrank”.

Each helper has an automation that publishes its new value to Tasmota.

Here's the example for the alarm threshold:

alias: Netzwerkschrank – Temperaturalarm an Tasmota
triggers:
  - trigger: state
    entity_id: input_number.netzwerkschrank_alarm
actions:
  - action: mqtt.publish
    data:
      topic: cmnd/sonoff-sd5/Mem4
      payload: "0"
      qos: 1
      retain: false
mode: restart

The other two use the same pattern:

Helper MQTT command topic
input_number.netzwerkschrank_lufter_ein cmnd/sonoff-sd5/Mem2
input_number.netzwerkschrank_lufter_aus cmnd/sonoff-sd5/Mem3
input_number.netzwerkschrank_alarm cmnd/sonoff-sd5/Mem4

The two fan automations additionally check that the off threshold is lower than the on threshold. That check doesn't yet guarantee a minimum hysteresis.

Current limitation: The sync runs from Home Assistant to Tasmota. If I change a Mem variable directly on the Sonoff, the dashboard slider won't update automatically.

After a restart, the intended setpoints should also be checked. Until then, Tasmota continues using its own stored values.

Conclusion after the update

The fan is installed, the control loop is autonomous and I can adjust all three thresholds from Home Assistant.

The original Uptime Kuma alarm remains independent of that control loop.

But the most important lesson so far isn't about software. The sensor's position has a major influence on how often the relay switches.

I'm moving the sensor before adding more timers and complicated logic.

What I actually want to measure next

The short on/off cycles worry me more than the absolute temperature.

Before adding timing rules, I want four numbers:

  1. Minimum and maximum temperature over the last 12 and 24 hours.
  2. Number of switching events per hour and per day.
  3. Average ON duration over the last two hours.
  4. Average OFF duration over the last two hours.

Those last two immediately reveal whether the fan is operating sensibly or constantly cycling.

The statistics should come from Home Assistant's history. Tasmota stays responsible for local control.

Still outstanding: proper measurements after repositioning the sensor. Only then will I know whether the wider hysteresis is enough or a minimum runtime would help.

A few pretty charts don't automatically prove that a control loop is any good.

Previous Next