Automation

How to Cool a Server Closet: Fans, Portable AC and Alerts

This post contains affiliate links. If you buy through them, we may earn a small commission at no extra cost to you. Learn more.

A closet with a door and no vent turns every watt your rack pulls into trapped heat. The room creeps up a degree at a time until a drive or a PSU complains. Server closet cooling comes down to three pieces that work together: an exhaust fan or portable AC that moves the heat out, a sensor that reads the air leaving the rack, and an alert that reaches your phone first. Most closets get the first piece and skip the other two, which is how a dead AC goes unnoticed over a long weekend.

Original content from computingforgeeks.com - post 180419

This guide sizes the heat load from your real watts and picks the fan or the AC that matches it. Then it wires a probe thermometer into Home Assistant, so an exhaust fan switches on at 30 C and ntfy pushes alerts for overheating, a cooling failure and a silent sensor. We confirmed the whole chain working in October 2026 on Home Assistant 2026.10 in a Docker lab on Ubuntu 26.04, with a simulated Zigbee probe driving every alert below, and we rechecked the links in November 2026.

Pick the hardware for each job

You do not need all of these. A small mini rack in a ventilated closet gets by with the fan and one sensor. A closet that sits above 27 C on a summer afternoon needs the AC no matter how much air you move. We checked each pick against the maker’s spec page and its live Amazon listing on October 30, 2026.

JobPickWhy it fits
Exhaust fan for a closetAC Infinity CLOUDLINE A4 (about $80)165 CFM inline duct fan, about 500 W of heat at a 10 F rise
Enclosed rack or AV cabinetAC Infinity AIRPLATE T8 (about $119)Two quiet 6-inch fans with their own thermostat probe
House air too warmMidea Duo MAP14HS1TBL (about $630)Dual-hose portable AC, 12,000 BTU SACC
Probe at the rack exhaustSONOFF SNZB-02LD (about $20)Zigbee, 1.5 m stainless probe
Cheap room sensorGovee H5075 (about $13)Bluetooth, read locally by Home Assistant
More accurate room sensorSwitchBot Meter Pro (about $20)Bluetooth, plus or minus 0.2 C
Measure the rack’s wattsShelly Plug US Gen4 (about $25)Local power metering, rated 15 A

We didn’t have the fans or the Midea on a bench, so their numbers come from the AC Infinity and Midea spec pages. Where a spec could not be confirmed, the section says so. The Home Assistant side is different, because the sensor path, the rise-rate math and every alert ran end to end in the lab. The outputs below are the ones it printed.

Size the server closet cooling load from your watts

Every watt that goes into the rack comes out as heat, so the cooling load is simply the rack’s power draw. Read it from the UPS display, a metered PDU or a plug like the Shelly instead of adding up nameplate ratings. A server’s PSU label can be three times what it really pulls at idle. If your gear already sits on a UPS with a load readout or a metered rack PDU, you already have the number.

Two formulas turn that number into something you can shop with. AutomationDirect’s enclosure cooling guide uses BTU/h = watts x 3.413 to size an air conditioner. For fans it uses CFM = (3.17 x watts) / delta-T, where delta-T is how many degrees Fahrenheit warmer the closet may run than the air feeding it. We used a 10 F (5.6 C) rise, which keeps a closet fed with 21 C air inside ASHRAE’s recommended 18 to 27 C inlet band.

Rack drawTypical setupHeat (BTU/h)Airflow at 10 F riseWhat usually works
150 W10-inch mini rack, two mini PCs, switch51248 CFMDoor louver plus a small exhaust fan
400 WNAS, one tower server, PoE switch1,365127 CFMDucted inline fan (CLOUDLINE A4)
800 WTwo 2U servers, NAS, UPS losses2,730254 CFMLarger duct fan, or AC if the house is warm

The airflow column assumes the incoming air is cool enough to begin with, and that is the limit people miss. A fan can only bring the closet down toward the temperature of the hallway it pulls from. If that hallway sits at 29 C in July, no amount of CFM gets your inlet under 27 C, and that is the point where you stop shopping fans and look at an AC. A 10-inch mini rack of mini PCs rarely gets there, while a pair of used 2U servers often does.

Move the heat out with an exhaust fan

An exhaust fan only removes as much air as can get back into the closet, so give it a way in before you buy it. A louvered door, a door undercut or a passive grille low on the opposite wall lets cool air in near the floor. The fan then pulls hot air out near the ceiling, where it collects. Without that inlet the fan spins against a sealed box, and the airflow figure on the box means nothing.

AC Infinity CLOUDLINE A4 4-inch inline duct fan for server closet exhaust
AC Infinity CLOUDLINE A4: 4-inch inline duct fan, 165 CFM at 29 dBA. Image: AC Infinity.

The CLOUDLINE A4 (about $80, check the live price) is the fan we’d duct out of a closet first. AC Infinity rates it at 165 CFM, 29 dBA and 35 W at full speed. It also lists 324 Pa of static pressure, which matters because a 4-inch duct run into an attic or the next room pushes back. Plug 165 CFM into the formula above and it handles about 520 W at a 10 F rise in free air. The duct takes some of that away, so treat 400 W as its comfortable ceiling.

Its controller is a wired 10-speed dial with no thermostat and no Home Assistant integration. Automating it means putting it on a smart plug and letting Home Assistant decide when it runs. The 6-inch CLOUDLINE A6 (352 CFM) is the step up for 600 W and more. Its Amazon listing showed a future availability date on October 30, though, so we could not link a buyable one. Skip the A4 if your closet already carries more than about 500 W.

An enclosed cabinet is a different problem from an open closet, because the heat is trapped inside the rack’s own walls before it ever reaches the room:

AC Infinity AIRPLATE T8 dual cabinet cooling fans with thermostat controller
AC Infinity AIRPLATE T8: two 6-inch cabinet fans, 104 CFM combined at 19 dBA, thermostat probe. Image: AC Infinity.

The AIRPLATE T8 (about $119) mounts in a cabinet’s top or rear panel. One fan pulls in and one pushes out, for 104 CFM combined at 19 dBA and 3.3 W. Its controller carries a 6 ft thermal probe, an alarm and power-failure memory, so it ramps on its own without any smart home. It will not cool a closet, though. It moves heat from inside a closed rack into the room, and the room still needs its own way out.

Add a portable AC when the house air is too warm

A portable AC is the fix when the supply air is the problem, and the hose count decides how well it works in a small room. A dual-hose unit pulls outdoor air through one hose to cool its condenser and sends it back out the other. The closet’s own air stays in the closet. A single-hose unit blows room air outside to cool itself, and that air gets replaced through every gap in the door, often from the warm hallway you were trying to escape.

Midea Duo MAP14HS1TBL dual-hose portable air conditioner for a server closet
Midea Duo MAP14HS1TBL: dual hose-in-hose portable AC, 12,000 BTU SACC, cools and heats. Image: Midea.

The Midea Duo MAP14HS1TBL (about $630, check the live price) uses Midea’s hose-in-hose design, so both airflows share one window kit. Its Amazon title lists 14,000 BTU on the old ASHRAE test and 12,000 BTU SACC. Size against the SACC number, because it counts the heat a portable unit leaks back into the room. Even 12,000 BTU/h covers roughly 3,500 W of IT load before room gains, far more than a homelab closet makes. The extra capacity mostly buys a unit that idles instead of running flat out.

It evaporates most of its condensate out through the exhaust hose, though Midea says to drain the tray now and then in humid rooms. Home Assistant reaches it locally through the core Midea integration, which for newer (V3) units takes a one-time cloud login to fetch the device token and key, and the unit accepts only one local connection, so close the Midea app. We didn’t have the unit, so we cannot confirm this exact model pairs. We also could not confirm that it restarts after a power cut, and that matters more than any spec here. Pull its plug, plug it back in, and check that it resumes cooling before you trust it with a closet you can’t see.

Don’t put the AC on a smart plug to switch it. Cutting a compressor’s power bypasses the AC’s own controls, and we never confirmed this unit resumes cooling when power returns. Control it through its own integration, or leave it running on its thermostat. Skip a portable AC entirely if the closet has no exterior wall or window, because both hoses have to reach outside air.

Choose a sensor Home Assistant reads locally

Put the probe where the hot air leaves the rack, not on the closet wall. Exhaust temperature reacts first when a fan dies or the AC stops, and it is the number our thresholds are built around. A second sensor near the inlet or the door tells you what the hardware is breathing. Every sensor here talks to Home Assistant without a vendor cloud, which matters during an outage, when a cloud API may be down too.

SONOFF SNZB-02LD Zigbee probe thermometer for rack exhaust temperature alerts
SONOFF SNZB-02LD: Zigbee 3.0 thermometer with a 1.5 m stainless probe, IP65. Image: SONOFF.

The SONOFF SNZB-02LD (about $20) is the sensor our lab imitates. Its 1.5 m probe reads -40 to 115 C, so the display can sit on the closet door while the tip hangs behind the rack. It runs on a CR2477 cell and reads temperature only, no humidity. Zigbee2MQTT supports it and publishes its readings to MQTT, which is exactly the path tested below. You’ll need a Zigbee coordinator if you don’t have one, and that is the reason to skip it.

Bluetooth sensors avoid the coordinator, as long as Home Assistant has a Bluetooth adapter or an ESPHome proxy in range of the closet:

Govee H5075 Bluetooth thermo-hygrometer readable by Home Assistant
Govee H5075: Bluetooth thermo-hygrometer, plus or minus 0.5 F, read by the Govee Bluetooth integration. Image: Govee.

The Govee H5075 (about $13) is the cheapest way to get a reading into Home Assistant. The Govee Bluetooth integration lists it and pushes updates locally. Govee rates it at plus or minus 0.5 F and 3 % RH on two AAA cells. It has no probe, so it measures the closet air rather than the exhaust. It is also useless if your Bluetooth adapter can’t reach the closet through a wall.

SwitchBot Meter Pro Bluetooth temperature and humidity sensor for Home Assistant
SwitchBot Meter Pro: plus or minus 0.2 C from 0 to 65 C, 4 second refresh. Image: SwitchBot.

The SwitchBot Meter Pro (about $20) costs a little more for plus or minus 0.2 C between 0 and 65 C. It refreshes every 4 seconds and keeps 68 days of history onboard. The SwitchBot Bluetooth integration reads it without the SwitchBot hub. Like the Govee it has no remote probe, so pick it for the room reading and pair it with the SONOFF for the exhaust.

Shelly Plug US Gen4 power-metering smart plug for measuring rack watts
Shelly Plug US Gen4: 15 A power-metering plug, local control in Home Assistant. Image: Shelly.

The Shelly Plug US Gen4 (about $25) does two jobs in this setup. It measures the watts that feed the sizing table, and it switches the exhaust fan when Home Assistant tells it to. It is rated 15 A, 1800 W resistive, and the Shelly integration reads it locally. It ships with Matter firmware, which Home Assistant also handles. Keep it on the fan and off the AC, for the reason above.

Wire the probe to Home Assistant over MQTT

The alert chain has three hops, and each one is a place where a reading can get lost. The probe’s reading reaches Home Assistant through Mosquitto, Home Assistant decides whether it’s a problem, and ntfy carries the result to your phone. The diagram shows the numbered path we tested:

Server closet temperature alert architecture diagram: exhaust probe over MQTT to Home Assistant, which switches the fan plug and posts to ntfy on port 8080 for the phone

We ran all three services from one Compose file on an Ubuntu 26.04 VM, a fair stand-in for a small box in the closet. If you already run Home Assistant OS, the Mosquitto add-on and a self-hosted ntfy container elsewhere do the same job. For a fresh host, the Home Assistant install guide for Ubuntu covers Docker. Our lab host was 10.0.1.50, so replace that address in every file with your own.

Install Docker, the Compose plugin, the Mosquitto clients for testing the broker by hand, and bc, which the heat-test script later uses for its arithmetic:

sudo apt-get update && sudo apt-get install -y docker.io docker-compose-v2 mosquitto-clients bc

Create the stack’s directories, then open the Compose file:

sudo mkdir -p /opt/closet/ha/packages /opt/closet/mosquitto/config /opt/closet/mosquitto/data
sudo vim /opt/closet/compose.yaml

Home Assistant runs on the host network so it can find devices on the LAN, while Mosquitto and ntfy publish their ports. Set TZ to your own timezone, or the history graphs and automation times will be offset:

services:
  homeassistant:
    image: ghcr.io/home-assistant/home-assistant:stable
    container_name: homeassistant
    network_mode: host
    volumes:
      - /opt/closet/ha:/config
    environment:
      - TZ=Africa/Nairobi
    restart: unless-stopped

  mosquitto:
    image: eclipse-mosquitto:2
    container_name: mosquitto
    ports:
      - "1883:1883"
    volumes:
      - /opt/closet/mosquitto/config:/mosquitto/config
      - /opt/closet/mosquitto/data:/mosquitto/data
    restart: unless-stopped

  ntfy:
    image: binwiederhier/ntfy
    container_name: ntfy
    command: serve
    environment:
      - NTFY_BASE_URL=http://10.0.1.50:8080
    ports:
      - "8080:80"
    restart: unless-stopped

Mosquitto 2 refuses remote clients until it has a listener, so give it a config file:

sudo vim /opt/closet/mosquitto/config/mosquitto.conf

Our lab allowed anonymous clients to keep the test short. On a LAN with anything else on it, add a password file and point the Home Assistant MQTT integration at those credentials:

persistence true
persistence_location /mosquitto/data/
listener 1883
allow_anonymous true

Start the stack and check that all three containers stay up:

cd /opt/closet && sudo docker compose up -d && sudo docker compose ps

All three report Up, and only Mosquitto and ntfy show port mappings because Home Assistant binds 8123 straight on the host:

NAME            IMAGE                                          COMMAND                  SERVICE         CREATED          STATUS          PORTS
homeassistant   ghcr.io/home-assistant/home-assistant:stable   "/init"                  homeassistant   49 seconds ago   Up 47 seconds
mosquitto       eclipse-mosquitto:2                            "/docker-entrypoint.…"   mosquitto       49 seconds ago   Up 47 seconds   0.0.0.0:1883->1883/tcp, [::]:1883->1883/tcp
ntfy            binwiederhier/ntfy                             "ntfy serve"             ntfy            49 seconds ago   Up 47 seconds   0.0.0.0:8080->80/tcp, [::]:8080->80/tcp

Finish onboarding at http://10.0.1.50:8123. Then open Settings, Devices and services, choose Add integration, pick MQTT, and enter broker 127.0.0.1 with port 1883, leaving the other options at their defaults. The probe itself reaches MQTT through Zigbee2MQTT, which runs beside this stack with your coordinator attached; the ZHA vs Zigbee2MQTT comparison covers that install. The order matters from here, because each step depends on a name the previous one created:

  1. Pair the probe with Zigbee2MQTT and give it the friendly name closet_rack, so its readings land on zigbee2mqtt/closet_rack.
  2. Find the temperature entity Home Assistant created, and rename it to sensor.closet_rack_exhaust_temperature or change the ID in the package to match.
  3. Drop the package that reads that entity into /opt/closet/ha/packages.
  4. Point the package’s rest_command at the ntfy topic your phone subscribes to.

We had no physical probe in the lab, so we published a discovery message shaped like the one Zigbee2MQTT sends for a probe thermometer, then one reading. You can run it as is to rehearse the whole chain before the hardware arrives:

mosquitto_pub -h 127.0.0.1 -r -t homeassistant/sensor/closet_rack/exhaust_temperature/config -m '{"name":"Exhaust temperature","unique_id":"closet_rack_exhaust_temperature","state_topic":"zigbee2mqtt/closet_rack","value_template":"{{ value_json.temperature }}","unit_of_measurement":"°C","device_class":"temperature","state_class":"measurement","expire_after":900,"device":{"identifiers":["closet_rack_probe"],"name":"Closet rack","model":"SNZB-02LD (simulated)"}}'
mosquitto_pub -h 127.0.0.1 -t zigbee2mqtt/closet_rack -m '{"temperature":26.1}'

Home Assistant builds the entity ID from the device name plus the entity name, so “Closet rack” and “Exhaust temperature” became sensor.closet_rack_exhaust_temperature. A real probe will not get that ID. Zigbee2MQTT names the entity from the friendly name plus its own label, which gives sensor.closet_rack_temperature, and ZHA uses its own naming. That is why step 2 above renames it. If you skip it, the package loads cleanly and no alert ever fires.

If you rehearsed with the simulated sensor, remove it before pairing the real probe, or the rename in step 2 fails because the ID is taken. Publishing an empty retained message to the discovery topic deletes it:

mosquitto_pub -h 127.0.0.1 -r -n -t homeassistant/sensor/closet_rack/exhaust_temperature/config

In our lab the entity then answered 404 “Entity not found” from the Home Assistant API, so the ID was free again.

The expire_after: 900 line is what turns our simulated sensor unavailable after 15 minutes of silence. Zigbee2MQTT does not send it, and its device availability feature is off by default; switched on, it marks a battery device offline only after 1500 minutes. Lower that passive timeout, or override expire_after for the probe in Zigbee2MQTT, keeping it longer than the longest gap you see in the probe’s last_seen, since a probe in a steady closet reports far less often than our simulator. Then pull the battery and check that the sensor really goes unavailable, and edit the offline message’s “20 minutes” to match your timeout. Without that, the offline alert below can take a day to arrive.

Add the rise-rate sensor and alert automations

A fixed threshold alone fires too late. By the time the exhaust reads 35 C, the closet has been heating for a while. You’d rather hear about a dead AC while there is still headroom, so the package adds a derivative sensor that turns the temperature into degrees per hour. A fast rise then wakes you up even at 29 C. All of it lives in one package file, which keeps the closet logic out of automations.yaml and easy to move to another Home Assistant install.

Tell Home Assistant to load packages by adding this block at the top of /opt/closet/ha/configuration.yaml:

sudo vim /opt/closet/ha/configuration.yaml

Leave the default automation: !include automations.yaml line alone. Home Assistant merged our package automations with it without complaint:

homeassistant:
  packages: !include_dir_named packages

Now create the package itself:

sudo vim /opt/closet/ha/packages/closet_cooling.yaml

This is the exact file from the lab, with only the ntfy address changed to the example host. The first heat test ran without the max_sub_interval line, and the troubleshooting section shows why it is there now. The fan helper at the bottom stands in for your smart plug. Because homeassistant.turn_on works on a switch entity too, swapping in your plug means changing one entity ID.

sensor:
  - platform: derivative
    source: sensor.closet_rack_exhaust_temperature
    name: Closet exhaust rise rate
    unique_id: closet_exhaust_rise_rate
    round: 1
    unit_time: h
    time_window: "00:10:00"
    max_sub_interval: "00:01:00"

rest_command:
  ntfy_closet:
    url: "http://10.0.1.50:8080/closet-alerts"
    method: POST
    headers:
      Title: "{{ title }}"
      Priority: "{{ priority }}"
      Tags: "{{ tags }}"
    payload: "{{ message }}"

automation:
  - id: closet_fan_on
    alias: Closet exhaust fan on at 30 C
    triggers:
      - trigger: numeric_state
        entity_id: sensor.closet_rack_exhaust_temperature
        above: 30
        for: "00:02:00"
    actions:
      - action: homeassistant.turn_on
        target:
          entity_id: input_boolean.closet_exhaust_fan

  - id: closet_too_hot
    alias: Closet too hot
    triggers:
      - trigger: numeric_state
        entity_id: sensor.closet_rack_exhaust_temperature
        above: 35
        for: "00:05:00"
    actions:
      - action: rest_command.ntfy_closet
        data:
          title: "Server closet too hot"
          priority: "urgent"
          tags: "fire"
          message: >-
            Rack exhaust is {{ states('sensor.closet_rack_exhaust_temperature') }} C
            and has been above 35 C for 5 minutes.
      - action: persistent_notification.create
        data:
          title: "Server closet too hot"
          message: "Rack exhaust {{ states('sensor.closet_rack_exhaust_temperature') }} C"

  - id: closet_cooling_failed
    alias: Closet cooling failed (fast rise)
    triggers:
      - trigger: numeric_state
        entity_id: sensor.closet_exhaust_rise_rate
        above: 6
        for: "00:03:00"
    conditions:
      - condition: numeric_state
        entity_id: sensor.closet_rack_exhaust_temperature
        above: 28
    actions:
      - action: rest_command.ntfy_closet
        data:
          title: "Closet cooling may have failed"
          priority: "high"
          tags: "warning"
          message: >-
            Exhaust is climbing {{ states('sensor.closet_exhaust_rise_rate') }} C/h
            and reads {{ states('sensor.closet_rack_exhaust_temperature') }} C.

  - id: closet_sensor_silent
    alias: Closet sensor went silent
    triggers:
      - trigger: state
        entity_id: sensor.closet_rack_exhaust_temperature
        to: "unavailable"
        for: "00:05:00"
    actions:
      - action: rest_command.ntfy_closet
        data:
          title: "Closet sensor offline"
          priority: "default"
          tags: "mag"
          message: "No reading from the rack exhaust sensor for 20 minutes."

input_boolean:
  closet_exhaust_fan:
    name: Closet exhaust fan
    icon: mdi:fan

Our thresholds assume the probe sits in the exhaust stream, which runs several degrees above the inlet. A closet that idles at 33 C exhaust in summer would fire the 35 C alert every afternoon. Watch your own history for a week, then set above: a few degrees over your normal peak. The 28 C condition on the rise-rate alert stops it from firing when a cold closet warms up after you shut the door. The fan automation only ever turns the fan on, so it stays latched until you switch it off; that suits a closet that got hot once, but add your own turn-off rule if you want it to cycle.

Validate the configuration from inside the container before restarting, because a YAML mistake in a package stops Home Assistant from loading the whole package:

sudo docker exec homeassistant python -m homeassistant --script check_config -c /config

A clean config prints only the header line, with no errors listed under it:

Testing configuration at /config

Restart Home Assistant with sudo docker restart homeassistant, and all four automations from the package come up switched on. Open one in the editor and a banner says it cannot be edited from the UI. That is expected for package automations, and it helps here, because nobody can click the alert away by accident.

Home Assistant Closet too hot automation: numeric state above 35 for 5 minutes, then rest_command.ntfy_closet
  1. 1Above 35 C for 5 minutes
  2. 2rest_command.ntfy_closet

The editor is where you check the Home Assistant end of the handshake against the package:

  1. Above 35 C for 5 minutes: the trigger reads back above: 35 and for: "00:05:00" on the exhaust sensor.
  2. rest_command.ntfy_closet: the action that posts to the ntfy topic, followed by the persistent notification.

Run a heat test and read the alerts

Don’t wait for July to find out whether the alerts work. Subscribe to the topic first, in a second terminal or the ntfy app, so you can watch messages arrive. Note the -N flag: our first subscriber wrote nothing to its log because curl buffers output when it writes to a file:

curl -sN http://10.0.1.50:8080/closet-alerts/json

Then feed the sensor a fake heat event. This script holds 26 C for 3 minutes and climbs 0.4 C every 30 seconds to 36 C. That is 48 C per hour, the kind of curve a closet shows when its cooling quits. It then holds 36 C for 8 minutes. Publishing to the topic Zigbee2MQTT uses works with a real probe paired too, since the next real reading overwrites the fake one.

vim ramp.sh

Paste the script, which logs each value it publishes to /tmp/ramp.log:

#!/bin/bash
# Publishes simulated probe readings: 3 min baseline, ramp +0.4 C / 30 s to 36.0, then 8 min hold.
pub() {
  mosquitto_pub -h 127.0.0.1 -t zigbee2mqtt/closet_rack -m "{\"temperature\":$1}"
  echo "$(date '+%H:%M:%S') $1" >> /tmp/ramp.log
}
: > /tmp/ramp.log
for i in $(seq 1 6); do pub 26.0; sleep 30; done
t=26.0
while [ "$(echo "$t < 36.0" | bc -l)" = 1 ]; do
  t=$(echo "$t + 0.4" | bc -l | sed 's/^\./0./')
  [ "$(echo "$t > 36.0" | bc -l)" = 1 ] && t=36.0
  pub "$t"; sleep 30
done
for i in $(seq 1 16); do pub 36.0; sleep 30; done
echo "$(date '+%H:%M:%S') done" >> /tmp/ramp.log

Make it executable and run it; the whole test takes about 24 minutes, and the silent-sensor alert needs another 20 after it ends:

chmod +x ramp.sh && ./ramp.sh

We sampled the sensors every 30 seconds while it ran, and the times below count from the first 26.4 C reading. Readings are what Home Assistant held at that moment. The order is the one you want. The cooling-failed warning arrived four minutes into the climb at 29.2 C, a full twelve minutes before the over-temperature alert.

MinuteExhaustRise rateWhat happened
0:0026.4 C1.8 C/hRamp starts
1:0027.2 C6.6 C/hRate passes 6 C/h, 3-minute timer starts
4:0029.2 C18.6 C/h“Closet cooling may have failed” sent, priority high
5:0030.4 C25.8 C/hCrosses 30 C, 2-minute timer starts
7:0031.6 C33.0 C/hExhaust fan turned on
11:0035.2 C48.0 C/hCrosses 35 C, 5-minute timer starts
16:0036.0 C48.0 C/h“Server closet too hot” sent, priority urgent
20:0036.0 C48.0 C/hLast reading published
35:00unavailableunavailableexpire_after (900 s) marks the sensor dead
40:00unavailableunavailable“Closet sensor offline” sent

The three fixed timers landed on the second. The fan came on exactly two minutes after 30 C, the too-hot alert exactly five minutes after 35 C, and the offline alert five minutes after the sensor expired. The history view shows the same run, with the fan bar flipping to On partway up the climb.

Home Assistant history of the server closet exhaust temperature, rise rate and exhaust fan during the heat test

Look at the rise-rate graph at the bottom, though. Once the exhaust held flat at 36 C, the rate should have fallen toward zero. It stayed pinned at 48 C/h for the rest of the run instead. That run used the package without the max_sub_interval line, and the troubleshooting section covers the fix. The ntfy topic shows what the phone gets.

ntfy web app showing the closet-alerts topic with the three Home Assistant closet alerts

The ntfy end of the handshake has a single value that has to match Home Assistant:

  1. closet-alerts topic: the same name as the last path segment of the rest_command URL, and the topic you subscribe to in the ntfy phone app.

Polling the topic returns the three messages with the priorities the package set. High arrives as 4, urgent as 5 and default as 3, so the phone app can treat the urgent one differently from the routine ones.

curl -s "http://10.0.1.50:8080/closet-alerts/json?poll=1&since=all"

Each message carries the live reading Home Assistant templated in at the moment the automation fired:

{"id":"Q7vjf6DtH50f","time":1793340758,"expires":1793383958,"event":"message","topic":"closet-alerts","title":"Closet cooling may have failed","message":"Exhaust is climbing 18.6 C/h and reads 29.2 C.","priority":4,"tags":["warning"]}
{"id":"2cnwfGIP6mrd","time":1793341478,"expires":1793384678,"event":"message","topic":"closet-alerts","title":"Server closet too hot","message":"Rack exhaust is 36.0 C and has been above 35 C for 5 minutes.","priority":5,"tags":["fire"]}
{"id":"KQBG4IAX6cxc","time":1793342919,"expires":1793386119,"event":"message","topic":"closet-alerts","title":"Closet sensor offline","message":"No reading from the rack exhaust sensor for 20 minutes.","priority":3,"tags":["mag"]}

Under the Home Assistant bell, the too-hot automation also left a “Server closet too hot” card reading “Rack exhaust 36.0 C”. That card is the fallback if ntfy itself is down. On a phone, install the ntfy app, add your server URL and subscribe to closet-alerts. The ntfy docs warn that iPhones subscribed to a self-hosted server can get messages hours late unless the server sets upstream-base-url, and that messages live only in memory until you set a cache-file, so a container restart empties the topic. If the phone leaves the house, the server has to be reachable from outside, through a VPN or a public ntfy instance with an access token.

Troubleshoot the alert chain

These are the faults we hit in the lab, each tied to one hop of the chain. Work through them in the order the reading travels: sensor, Home Assistant, then ntfy.

Rise rate stuck at 48.0 C/h after the temperature levels off

A derivative sensor only recalculates when its source changes, as the derivative integration docs note. When the probe kept publishing 36.0, Home Assistant saw no state change. The rate froze at its last value for the eight-minute hold and rode along until the sensor expired. A stuck rate never drops back under 6 C/h, so the trigger cannot fire again for the next failure. A sensor that only reports when its value changes makes it worse.

max_sub_interval: "00:01:00" makes the sensor recalculate every minute even without a new reading, which is why it is in the package above. On each tick it drops rate segments that have aged out of the 10-minute window, so the rate decays to zero one window after the climb stops. We added the line, restarted, and ran a shorter ramp from 26.0 to 29.6 C followed by a 12-minute hold, sampling once a minute:

06:54:15 temp=26.0 rise=48.0
06:55:15 temp=26.0 rise=0.0
06:56:15 temp=26.4 rise=2.4
06:57:15 temp=27.2 rise=7.2
06:58:15 temp=28.0 rise=12.0
06:59:15 temp=28.8 rise=16.8
07:00:15 temp=29.6 rise=21.6
07:01:15 temp=29.6 rise=21.6
07:02:15 temp=29.6 rise=21.6
07:03:15 temp=29.6 rise=21.6
07:04:15 temp=29.6 rise=21.6
07:05:15 temp=29.6 rise=20.4
07:06:16 temp=29.6 rise=19.2
07:07:16 temp=29.6 rise=14.4
07:08:16 temp=29.6 rise=9.6
07:09:16 temp=29.6 rise=4.8
07:10:16 temp=29.6 rise=0.0

The first line is the stale 48.0 restored from before the restart, and the timer cleared it within a minute. Once the temperature levelled off at 29.6 C, the rate held for about five minutes and then fell to 0.0 by the tenth minute. A rate that returns to zero is what lets the cooling-failed trigger cross 6 C/h again the next time your AC quits.

Error: “Missing required permissions for Bluetooth management”

Home Assistant logged this twice on startup in our container, with the hint “Add NET_ADMIN and NET_RAW capabilities to the container to enable it”. It is harmless with a Zigbee probe. The Govee and SwitchBot sensors depend on Bluetooth, though, so on a Docker install follow the log’s hint, or use an ESPHome Bluetooth proxy near the closet. We didn’t attach a Bluetooth adapter to the lab VM, so that path is untested here.

The ntfy subscriber prints nothing

Our first subscriber ran curl -s ... > file, and the file stayed empty while the first alert went out. curl block-buffers when its output isn’t a terminal, so the messages sat in memory until curl -sN turned buffering off. If the stream is empty in a terminal too, poll with ?poll=1&since=all as shown above. Messages there mean Home Assistant delivered and the subscriber is at fault. An empty poll points back at the rest_command URL or the automation’s trace.

Keep reading

OpenCode CLI Cheat Sheet: Commands, Sessions and Fixes (PDF) AI OpenCode CLI Cheat Sheet: Commands, Sessions and Fixes (PDF) Best Mini PC for Home Assistant: 4 Picks for HAOS and Proxmox Automation Best Mini PC for Home Assistant: 4 Picks for HAOS and Proxmox Ansible + Proxmox: Automated VM Management Ansible Ansible + Proxmox: Automated VM Management Install Dagger on Rocky Linux 10 / AlmaLinux 10 AlmaLinux Install Dagger on Rocky Linux 10 / AlmaLinux 10 Dagger vs GitHub Actions: When to Use What Automation Dagger vs GitHub Actions: When to Use What GitLab and Slack Integration for notifications Automation GitLab and Slack Integration for notifications

Leave a Comment

Press ESC to close