Home Assistant Deep Dive: Automating the Hot Tub
How I used Home Assistant, ESPHome, and probably too many hours to automate hot tub frost protection.
When you live in Scotland and own a hot tub, winter frost protection isn’t optional - it’s essential. But checking temperatures manually at 2 AM? That’s what computers are for. Here’s how I over-engineered a solution using Home Assistant.
The Problem
The hot tub sits outside (obviously) and needs to maintain minimum temperatures even when not in use. The manufacturer’s solution: check it yourself. My solution: let Home Assistant handle it with the elegance of a Rube Goldberg machine.
The Hardware Stack
- DS18B20 Temperature Sensors (3x): Water temp, ambient temp, and a backup because paranoia
- ESP32 Board with ESPHome: The brain of the operation
- Smart Plug (Zigbee): Controls the heating circulation pump
- Raspberry Pi 4: Running Home Assistant OS
The Setup
First, I waterproofed the DS18B20 sensors in heat-shrink tubing and silicone. Over-engineered? Perhaps. But water and electronics have opinions about mixing.
The ESPHome configuration was surprisingly straightforward:
sensor:
- platform: dallas
address: 0x1234567890abcdef
name: "Hot Tub Water Temperature"
- platform: dallas
address: 0xfedcba0987654321
name: "Hot Tub Ambient Temperature"
The Automation Logic
Home Assistant automation triggers when:
- Water temp drops below 10°C
- OR ambient temp drops below 0°C
- AND it’s been below threshold for 5+ minutes (prevents false triggers)
Action: Turn on circulation pump for 30 minutes, then re-evaluate.
The Complications (Naturally)
Week 1: The sensor gave wildly varying readings. Turns out, it was reading the voltage drop from the ESP32’s power supply. Fixed with a proper 5V adapter.
Week 2: Automation triggered constantly because I’d mounted the ambient sensor directly in the hot tub’s steam exhaust. Moved it 2 meters away. Problem solved.
Week 3: Discovered the smart plug didn’t handle the pump’s inductive load well. Replaced with a proper contactor relay. Much better.
The Dashboard
Created a Lovelace dashboard card showing:
- Real-time water temperature
- Ambient temperature
- Pump status
- Historical data (because graphs are pretty)
- Manual override buttons (for when the algorithm is too clever for its own good)
Power Consumption Tracking
Bonus feature: integrated my Zappi EV charger API to calculate heating costs. Because if you’re going to over-engineer something, track everything.
Average winter power consumption: ~2.3 kWh/day for frost protection
Cost at current rates: About £0.70/day
Smug satisfaction of automation: Priceless
Lessons Learned
- Waterproofing matters - More than you think
- Test in summer - Debugging in January at midnight is suboptimal
- Always include manual overrides - For when the automation gains sentience
- Documentation is future-you’s friend - I spent 30 minutes figuring out my own YAML
Future Improvements
- Add notifications for sustained freezing temps
- Integrate with weather forecast API (preemptive heating)
- Maybe a camera to check water level remotely
- Or… I could just accept it’s working fine and resist further tinkering
Who am I kidding? That last one’s not happening.
The complete ESPHome and Home Assistant YAML configs are too long for this post, but the source of my overthinking is available for those who want to replicate this particular brand of madness.