← Blog

ESP32 Email Alerts Without Home Assistant

You have an ESP32 reporting data. You want an email when a reading crosses a threshold, plus a dashboard where you can see what led up to it. Warblet gives you that path without running Home Assistant or a server at home.

This example uses the published ESP32 temperature demo and a short routine. It queues one alert when a reading reaches 30 °C, then waits for the reading to fall to 28 °C before another alert can be queued. Both thresholds are example settings you can change.

Start with a reading you can see

You need a Warblet account, an ESP32 supported by the generic temperature demo, a USB data cable, and internet access for the board. Follow the demo's board and firmware instructions, then use Warblet setup to connect it to your account.

The demo reads the chip's internal temperature. That is useful for learning the data path; it is not a measurement of room or greenhouse air. For those projects, connect an appropriate external sensor and adapt the reading function.

Install the demo's decoder in the device spec, which tells Warblet how to interpret the packet. It produces a field named temp_c. Before adding an alert, confirm that incoming messages show a numeric value in that field.

Add the email destination

Set an alert email address in your Warblet account settings. Email alerts are off until an address is set. The destination belongs in account settings, so the routine can stay focused on what happened.

The current account limit is ten alert emails per hour, shared by its routines. An alert in the dashboard is not, by itself, confirmation that an email reached the inbox.

Write the condition once

Create a routine and scope it to the temperature demo's spec. Set its minimum interval to 0 so it can evaluate each incoming reading. Paste this example into the editor:

TRIP_C = 30.0
RESET_C = 28.0

def routine(event, state, mem):
    temperature = event["fields"].get("temp_c")
    if temperature == None:
        return
    key = "hot:" + event["hw_id"]
    if temperature >= TRIP_C and not mem.get(key, False):
        alert(
            "ESP32 temperature alert",
            "%s reported %s C." % (event["hw_id"], temperature),
        )
        mem[key] = True
    elif temperature <= RESET_C:
        mem[key] = False

The routine remembers whether it has already alerted for each device. A reading of 31 °C queues an alert; the next reading of 32 °C does not queue another. A reading of 28 °C resets the condition. The gap between the two thresholds stops small changes around 30 °C from repeatedly triggering messages.

This is a latch, not a timer. If a project repeatedly moves through both thresholds, it can still generate many alerts. Choose the thresholds for your sensor and use a cooldown if the application needs a minimum time between messages.

Check the behavior before enabling it

Use the routine editor's dry run to inspect the proposed action without sending an email. Use your device and a temp_c field of 31 for an alert case, then test a value of 27 and a message without temp_c for cases with no action.

A dry run does not save the live routine's memory. To check the full sequence after enabling the routine, use a controlled test source and watch its run history:

Reading in sequenceExpected result
27 °CNo alert; ready for the next rise
31 °COne alert queued
32 °CNo additional alert
29 °CStill waiting for the reset threshold
28 °CReset; no alert
31 °COne new alert queued

For a real sensor, choose a safe test condition you can deliberately produce. You can also temporarily choose thresholds around its ordinary readings; restore the intended values after testing. Confirm the alert appears in Warblet and that its email arrives.

If the alert does not arrive

What you seeWhat to check next
No incoming readingBoard connection and the demo setup
Raw messages, but no temp_cDecoder installation and payload format
Readings, but no routine runEnabled state, spec scope, and minimum interval
A run with no actionThresholds and whether the earlier alert is still latched
An alert in Warblet, but no emailAccount email setting, delivery status, account limit, and inbox spam folder

Keep the field name consistent when changing firmware. A decoder that returns temperature will not satisfy a routine looking for temp_c until you update the routine too.

Build the project you had in mind

Replace the chip reading with a sensor that answers your question: greenhouse air temperature, a counter, or another value you can measure. Keep the same path—read, decode, inspect, respond—and change one part at a time.

Warblet's dashboard, routines, and email alerts need internet access. Any behavior that must continue while offline belongs in your device's firmware.

Explore the demo or start building with Warblet.