Powering Down Smart: A Practical Guide to Energy-Saving Automations in Home Assistant
Our smart homes can be more than just convenient. In an era of rising energy costs and growing environmental awareness, they can be conscientious. Home Assistant (HA), with its unparalleled flexibility and local-first ethos, is the perfect platform to surpass manual “off” switches. It helps implement intelligent, context-aware energy conservation. This guide will introduce you to the principles. It will show you practical automations and share pro-tips to turn your HA setup into a silent, efficient energy manager.
Why Automate Energy Savings?
Manual effort is inconsistent. Automations work on triggers, conditions, and actions that are always “on,” responding instantly to real-world changes. The goals are clear:
- Reduce Waste: Remove “vampire” standby power and make sure devices run only when needed.
- Shift Load: Use high-power devices (like EV chargers, dishwashers) during off-peak tariff periods.
- Optimize Comfort/Efficiency Balance: Adjust heating/cooling based on occupancy, windows, and external weather, not just a fixed schedule.
- Gain Awareness: Integrate with HA’s Energy Dashboard to track the impact of your automations.
Prerequisites: Laying the Foundation
Before writing automations, make sure your foundation is solid:
- The Energy Dashboard: Set up this first (
Settings > Dashboards > Energy). Add your main grid meter, solar production, and key devices (HVAC, EV charger). This is your mission control for measuring success. - Reliable Sensors: You need data. Key sensors include:
- Presence/Occupancy:
device_tracker(phone GPS),binary_sensor(motion, door/window opens). - Environmental:
sensorfor temperature, humidity, CO2, particulate matter. - Power: Smart plugs with energy monitoring (e.g., TP-Link Kasa, Shelly Plug) or a whole-home monitor like the Shelly EM.
- Presence/Occupancy:
- Integrations: Make sure devices are properly integrated. For custom devices, ESPHome is a powerful, local choice for adding energy monitoring.
4 Practical, High-Impact Automations (with YAML)
Let’s dive into actionable automations. These examples assume you have the necessary sensors and entities.
1. The “Heater/AC Zombie Killer”
Problem: Space heaters, electric blankets, or AC units left running in empty rooms. Solution: A two-part automation: turn off after inactivity, and prevent turning on if a window is open.
alias: "Climate - Turn Off Heater After No Motion"
trigger:
- platform: state
entity_id: binary_sensor.living_room_motion
to: "off"
for: "00:30:00" # 30 minutes of no motion
condition:
- condition: state
entity_id: climate.living_room_heater
state: "heat"
action:
- service: climate.turn_off
target:
entity_id: climate.living_room_heater
mode: restart
alias: "Climate - Prevent Heater With Open Window"
trigger:
- platform: state
entity_id: binary_sensor.living_room_window
to: "on"
condition:
- condition: state
entity_id: climate.living_room_heater
state: "heat"
action:
- service: climate.turn_off
target:
entity_id: climate.living_room_heater
- service: notify.mobile_app_my_phone
data:
message: "Heater turned off because a window was opened!"
mode: single
Tip: Use for: in triggers for de-bouncing. The restart mode on the first automation means the 30-minute timer resets if motion is detected again.
2. Adaptive Lighting with Lux & Occupancy
Problem: Lights on full blast during sunny afternoons or in unoccupied rooms. Solution: Use a combination of a light sensor and occupancy.
alias: "Lighting - Adaptive Brightness (Kitchen)"
trigger:
- platform: state
entity_id: binary_sensor.kitchen_occupancy
to: "on"
- platform: state
entity_id: sensor.kitchen_lux
condition:
# Only adjust if lights are actually on (avoid turning on)
- condition: state
entity_id: light.kitchen_pendants
state: "on"
action:
- service: light.turn_on
target:
entity_id: light.kitchen_pendants
data:
# Brightness is a percentage (0-100) or 0-255.
# Map lux (0-1000) to brightness (30%-100%).
# You can use templates for more complex mappings.
brightness_pct: >
{{ [
30, # Minimum brightness
(state_attr('sensor.kitchen_lux', 'state') | float / 1000 * 70) + 30
] | min | max(30, 100) }}
mode: single
Tip: This uses a simple inline template. For better performance, create a template sensor (via template: integration in configuration.yaml) that calculates the target brightness and reference that sensor in your automation.
3. Off-Peak Appliance Scheduler (Dishwasher/Washing Machine)
Problem: Running high-wattage appliances during expensive peak grid hours. Solution: Use your utility’s time-based tariff or a dynamic electricity price sensor (if available from your integration).
alias: "Appliance - Delay Start to Off-Peak"
trigger:
- platform: state
entity_id: input_boolean.dishwasher_ready
to: "on"
condition:
# Check current time against off-peak window (e.g., 10 PM - 6 AM)
- condition: time
after: "22:00:00"
before: "06:00:00"
# Ensure we're not already in a delayed start period
- condition: state
entity_id: input_boolean.dishwasher_delayed
state: "off"
action:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.dishwasher_delayed
- service: notify.mobile_app_my_phone
data:
message: "Dishwasher will start at 10:00 PM to use off-peak rates."
# You would then have a separate time-triggered automation at 22:00
# that checks `input_boolean.dishwasher_ready` and starts the machine.
mode: single
Tip: The input_boolean acts as a flag. Create a second simple time automation at 22:00 that checks if dishwasher_ready and dishwasher_delayed are both on, then triggers the actual start (switch.turn_on for your dishwasher’s power).
4. “Nobody Home” Eco Mode
Problem: The house maintains “away” comfort levels even when everyone is gone for hours. Solution: A master automation triggered by a group of people’s absence.
alias: "House - Away Mode - HVAC & Media"
trigger:
- platform: state
entity_id: group.all_household
to: "not_home"
for: "00:15:00" # 15 min grace period
action:
- service: climate.set_preset_mode
target:
entity_id: climate.all_climate_devices
data:
preset_mode: "away" # Or a custom "eco" preset
- service: switch.turn_off
target:
entity_id: group.all_media_switches
- service: light.turn_off
target:
entity_id: group.all_lights
mode: restart # If someone returns, this automation cancels and resets.
alias: "House - Return from Away"
trigger:
- platform: state
entity_id: group.all_household
to: "home"
condition:
- condition: state
entity_id: input_boolean.away_mode_active
state: "on"
action:
- service: input_boolean.turn_off
target:
entity_id: input_boolean.away_mode_active
- service: climate.set_preset_mode
target:
entity_id: climate.all_climate_devices
data:
preset_mode: "home"
mode: restart
Tip: Create group.all_household by combining all your device_tracker entities. Use the for: parameter to avoid false trips from someone briefly stepping out.
Advanced Strategies & Pro Tips
- Leverage the
utility_meterIntegration: This is essential for time-of-use tariffs. Create sensors likesensor.electricity_peak,sensor.electricity_offpeak,sensor.electricity_solarthat track consumption in those periods. Your automations can then reference these. - Predict with Weather & Forecast: Integrate your local weather (
weatherintegration or Met.no). An automation can pre-cool or pre-heat your house before a predicted hot/cold snap, avoiding expensive peak-hour runtimes. - Use
wait_templatefor Sequencing: Need to start the dryer only after the washer finishes? Use await_templatein a script or automation to pause execution until a condition (e.g.,sensor.washer_power< 5W) is met. - Template the Logic: For complex decisions, create a template binary sensor or template sensor. Example:
binary_sensor.hvac_should_runthat returnsononly if(occupancy == on) AND (window == closed) AND (outside_temp > 15 AND < 25). - Start Small & Monitor: Implement one automation at a time. Use the Energy Dashboard and the Logbook (
Developer Tools > Logbook) to see the immediate impact. A 5% reduction on a major load (HVAC) is a huge win. - Safety First: Never automate a device that could cause damage or danger without a physical override. This is especially true for heating elements, pumps, or anything with a high-fire risk. Automate when it runs, not if it can run unsafely.
- Document Your Automations: Use the
alias:field clearly. Add adescription:field (in YAML) explaining the why and how. Future you will thank past you.
Conclusion: From Reactive to Proactive
Energy-saving automations in Home Assistant transform your smart home from a reactive tool to a proactive, optimizing system. The journey starts with awareness. This means the Energy Dashboard. It then moves to simple dead-man switches, called the zombie killer. Finally, it evolves into a context-aware ecosystem that understands occupancy, weather, and tariffs. Start with the examples provided, tailor them to your home and climate, and iterate. Every watt saved is a direct contribution to your wallet and the grid. The most powerful automation runs silently and efficiently. It requires no further thought. This is exactly what Home Assistant lets you build.
Some of the links in this article are "affiliate links", a link with a special tracking code. This means if you click on an affiliate link and purchase the item, we will receive an affiliate commission. The price of the item is the same whether it is an affiliate link or not. Regardless, we only recommend products or services we believe will add value to our readers. By using the affiliate links, you are helping support our Website, and we genuinely appreciate your support.