Home Assistant Dynamic Tariff Automation 2026: Step-by-Step Setup
You have a dynamic electricity tariff. Prices change every 30 minutes. You know you should run the dishwasher at 2 AM and charge your EV overnight. But who has time to track 48 price intervals per day?
Home Assistant does. Once configured, it reads the current electricity price, compares it to your thresholds, and automatically turns on the dishwasher, heats the water, charges the EV, and cycles the battery. You do not touch anything. The system runs 24/7, responding to price signals faster than you ever could manually.
This guide walks you through the complete setup: connecting Home Assistant to your tariff, building the automations, and optimizing for maximum savings.
What You Need
Before starting, gather these components:
Home Assistant running on a device (Raspberry Pi 4, mini PC, or Home Assistant OS). See our Home Assistant beginner guide if you need help with setup.
A dynamic electricity tariff. TOU, RTP, or dynamic TOU from your utility. See our dynamic tariffs explained guide for options in your area.
Smart devices to control:
- Smart plugs with energy monitoring ($15-25 each) for appliances
- Smart thermostat (Ecobee, Nest, or Tuya-based) for HVAC
- Smart EV charger or smart plug on the EV charger ($200-800)
- Home battery with API access (Tesla, Sigenergy, Enphase)
- Smart water heater switch ($50-150) or smart plug on the water heater
For device recommendations, see our best energy monitoring devices guide.
Step 1: Connect Home Assistant to Your Tariff
Home Assistant needs to know the current electricity price. The integration depends on your utility.
Option 1: Utility-Specific Integration
Several utilities have dedicated Home Assistant integrations:
Octopus Energy (UK): The octopus_energy integration provides real-time Agile prices, consumption data, and tariff information. Install via HACS (Home Assistant Community Store).
Tibber (EU/US): The tibber integration provides real-time pricing for Tibber customers. Native integration in Home Assistant.
Greenely (Sweden): Native integration available.
ComEd (Illinois): The comed integration provides real-time pricing for ComEd Real-Time Pricing customers.
Option 2: Entso-E or Nordpool (European Spot Prices)
For European users on spot-price tariffs, the nordpool or entso-e integration pulls wholesale electricity prices from the European power exchange.
Option 3: Manual Setup via REST API
If your utility provides a REST API, you can pull prices into Home Assistant using a rest sensor or command_line sensor.
Example for a generic REST API:
sensor:
- platform: rest
name: "Electricity Price"
resource: "https://api.yourutility.com/v1/prices/current"
value_template: "{{ value_json.price_per_kwh }}"
unit_of_measurement: "USD/kWh"
scan_interval: 300 # Update every 5 minutes
Option 4: Utility Rate Schedule (Static TOU)
If you are on a fixed TOU tariff, you can define the schedule directly in Home Assistant without an API:
input_select:
electricity_rate_period:
name: "Electricity Rate Period"
options:
- "off_peak"
- "mid_peak"
- "peak"
automation:
- alias: "Set off-peak period"
trigger:
- platform: time
at: "00:00:00"
- platform: time
at: "21:00:00"
action:
- service: input_select.select_option
target:
entity_id: input_select.electricity_rate_period
data:
option: "off_peak"
- alias: "Set peak period"
trigger:
- platform: time
at: "16:00:00"
action:
- service: input_select.select_option
target:
entity_id: input_select.electricity_rate_period
data:
option: "peak"
Step 2: Create Price Threshold Helpers
Create helper entities that classify the current price as cheap, normal, or expensive. These become the triggers for your automations.
input_number:
electricity_price_cheap:
name: "Cheap Price Threshold"
min: 0
max: 1
step: 0.01
unit_of_measurement: "USD/kWh"
initial: 0.10
electricity_price_expensive:
name: "Expensive Price Threshold"
min: 0
max: 1
step: 0.01
unit_of_measurement: "USD/kWh"
initial: 0.30
template:
- sensor:
- name: "Electricity Price Level"
state: >
{% set price = states('sensor.electricity_price') | float %}
{% set cheap = states('input_number.electricity_price_cheap') | float %}
{% set expensive = states('input_number.electricity_price_expensive') | float %}
{% if price <= cheap %}
cheap
{% elif price >= expensive %}
expensive
{% else %}
normal
{% endif %}
attributes:
current_price: "{{ states('sensor.electricity_price') | float }}"
This creates a sensor.electricity_price_level entity that returns “cheap”, “normal”, or “expensive” based on your thresholds. Adjust the thresholds based on your tariff.
Step 3: Automate Dishwasher and Laundry
The dishwasher and washing machine are the easiest loads to shift. They are flexible on timing and draw significant power.
Dishwasher Automation
automation:
- alias: "Run dishwasher when electricity is cheap"
trigger:
- platform: state
entity_id: sensor.electricity_price_level
to: "cheap"
condition:
- condition: state
entity_id: input_boolean.dishwasher_loaded
state: "on"
- condition: time
after: "20:00:00"
before: "08:00:00"
action:
- service: switch.turn_on
target:
entity_id: switch.dishwasher
- service: input_boolean.turn_off
target:
entity_id: input_boolean.dishwasher_loaded
- service: notify.mobile_app
data:
message: "Dishwasher started at {{ states('sensor.electricity_price') }} USD/kWh (cheap rate)"
You need a input_boolean.dishwasher_loaded toggle that you (or a door sensor) set when you load the dishwasher. The automation waits for cheap electricity and runs it.
Washing Machine Automation
Similar approach, but with a tighter time window to ensure the laundry is done before morning:
automation:
- alias: "Run washing machine when electricity is cheap"
trigger:
- platform: state
entity_id: sensor.electricity_price_level
to: "cheap"
condition:
- condition: state
entity_id: input_boolean.washing_machine_loaded
state: "on"
- condition: time
after: "21:00:00"
before: "05:00:00"
action:
- service: switch.turn_on
target:
entity_id: switch.washing_machine
Step 4: Automate Water Heater
The water heater is one of the best candidates for load shifting. It draws 3-5 kW and stores hot water for hours, so timing is flexible.
Option 1: Smart switch on the water heater circuit
automation:
- alias: "Heat water during cheap hours"
trigger:
- platform: state
entity_id: sensor.electricity_price_level
to: "cheap"
condition:
- condition: numeric_state
entity_id: sensor.water_heater_temperature
below: 55 # Only heat if water is below 55C
action:
- service: switch.turn_on
target:
entity_id: switch.water_heater
- alias: "Stop heating water during expensive hours"
trigger:
- platform: state
entity_id: sensor.electricity_price_level
to: "expensive"
action:
- service: switch.turn_off
target:
entity_id: switch.water_heater
Option 2: Smart thermostat on the water heater
Some water heaters support smart thermostats (like the Shelly Plus Add-On with temperature sensor). This gives you temperature-based control combined with price-based scheduling.
Step 5: Automate EV Charging
EV charging is the largest flexible load in most homes. Shifting it to cheap hours saves $200-600 per year.
automation:
- alias: "Start EV charging when cheap"
trigger:
- platform: state
entity_id: sensor.electricity_price_level
to: "cheap"
condition:
- condition: state
entity_id: sensor.ev_plugged_in
state: "on"
- condition: numeric_state
entity_id: sensor.ev_battery_level
below: 80
action:
- service: switch.turn_on
target:
entity_id: switch.ev_charger
- alias: "Stop EV charging when expensive"
trigger:
- platform: state
entity_id: sensor.electricity_price_level
to: "expensive"
action:
- service: switch.turn_off
target:
entity_id: switch.ev_charger
For smarter EV charging, integrate your EV’s API (Tesla, Hyundai, Kia all have Home Assistant integrations) to control charging speed and target state of charge.
For EV-specific smart home setup, see our best EVs with bidirectional charging guide.
Step 6: Automate Home Battery
If you have a home battery, combine dynamic tariff automation with battery control for maximum savings.
Charge During Cheap Hours
automation:
- alias: "Charge home battery during cheap hours"
trigger:
- platform: state
entity_id: sensor.electricity_price_level
to: "cheap"
condition:
- condition: numeric_state
entity_id: sensor.home_battery_soc
below: 90
action:
- service: select.select_option
target:
entity_id: select.battery_mode
data:
option: "charge_from_grid"
Discharge During Expensive Hours
automation:
- alias: "Discharge home battery during expensive hours"
trigger:
- platform: state
entity_id: sensor.electricity_price_level
to: "expensive"
condition:
- condition: numeric_state
entity_id: sensor.home_battery_soc
above: 20 # Keep 20% reserve for outages
action:
- service: select.select_option
target:
entity_id: select.battery_mode
data:
option: "self_consumption"
For battery comparisons, see our Tesla Powerwall vs Sigenergy vs Enphase article.
Step 7: Pre-Cooling and Pre-Heating
Instead of running the HVAC during expensive peak hours, pre-cool or pre-heat your home during cheap hours and coast through the expensive period.
automation:
- alias: "Pre-cool house before peak hours"
trigger:
- platform: time
at: "14:00:00" # 2 hours before peak (4 PM in many TOU plans)
action:
- service: climate.set_temperature
target:
entity_id: climate.main_thermostat
data:
temperature: 70 # Cool to 70F
- alias: "Let house coast during peak hours"
trigger:
- platform: time
at: "16:00:00" # Peak starts
action:
- service: climate.set_temperature
target:
entity_id: climate.main_thermostat
data:
temperature: 76 # Allow temperature to rise to 76F
A well-insulated home holds temperature for 2-4 hours. Pre-cooling to 70F at 2 PM means the AC does not run during the 4-9 PM peak window, saving $1-3 per day in summer.
For thermostat options, see our best smart thermostat guide.
Step 8: Create a Dashboard
Build a dashboard that shows your current price, price level, and what is currently running.
type: entities
title: "Energy Tariff Status"
entities:
- entity: sensor.electricity_price
name: "Current Price"
- entity: sensor.electricity_price_level
name: "Price Level"
- entity: input_number.electricity_price_cheap
name: "Cheap Threshold"
- entity: input_number.electricity_price_expensive
name: "Expensive Threshold"
- entity: switch.dishwasher
name: "Dishwasher"
- entity: switch.washing_machine
name: "Washing Machine"
- entity: switch.water_heater
name: "Water Heater"
- entity: switch.ev_charger
name: "EV Charger"
- entity: sensor.home_battery_soc
name: "Battery State of Charge"
For more dashboard ideas, see our Home Assistant energy dashboard guide.
Expected Savings
With full automation (dishwasher, laundry, water heater, EV charging, HVAC pre-conditioning, battery cycling), here are realistic annual savings by market:
| Market | Annual Savings | Automation Complexity |
|---|---|---|
| California (steep TOU) | $800-1,400 | Medium |
| Texas (free nights) | $600-1,000 | Low |
| UK (Octopus Agile) | $800-1,200 | Medium |
| Illinois (ComEd RTP) | $400-800 | High |
| Average US (mild TOU) | $300-600 | Low |
The savings compound over time. Over 10 years, a well-automated dynamic tariff system saves $5,000-14,000 compared to a flat tariff with no automation.
Related Guides
FAQ
Do I need Home Assistant for dynamic tariff automation?
No, but it is the best option. Some smart devices (Ecobee, Wallbox, Tesla) have built-in TOU scheduling. But Home Assistant coordinates everything in one platform: appliances, HVAC, EV, battery, and water heater all responding to the same price signal. The alternative is managing 4-5 separate apps with inconsistent scheduling.
What if electricity prices spike unexpectedly?
Set guardrails. Configure a maximum price threshold above which your home switches to battery power or reduces consumption entirely. Home Assistant can send you an alert when prices exceed your threshold, and you can decide whether to override the automation.
How much time does this take to set up?
The basic setup (connecting to your tariff and automating the dishwasher) takes 1-2 hours. A full setup with EV charging, battery control, HVAC pre-conditioning, and dashboards takes 4-8 hours spread over a weekend. The ongoing maintenance is minimal, the automations run unattended.
Can I automate this without smart plugs?
Some appliances have built-in WiFi and Home Assistant integrations (Samsung, LG, Bosch dishwashers and washing machines). If your appliances support this, you do not need smart plugs. Otherwise, a $15-25 smart plug with energy monitoring is the cheapest way to add control and monitoring.
Does load shifting affect my comfort?
Not if you automate it correctly. The dishwasher runs at 2 AM when you are asleep. The water heater heats overnight and stores hot water for morning showers. The house pre-cools before peak hours so the temperature is comfortable when you get home. The EV charges overnight and is full by morning. You do not change your behavior at all.
What if my utility does not offer a dynamic tariff?
Check if you are in a deregulated market (Texas, parts of the Northeast). You may be able to switch to a retail provider that offers dynamic pricing. If no dynamic tariff is available, you can still benefit from basic TOU scheduling if your utility offers TOU rates.