This component is an addition to the EPEX Spot integration.
EPEX Spot Sensor add one or more binary sensors which can be configured to turn on at the cheapest or most expensive time interval of the day. The length of the time interval can be configured, as well as whether the interval shall be used contiguously or intermittently.
If you like this component, please give it a star on github.
-
Ensure that HACS is installed.
-
Open HACS, then select
Integrations. -
Select ⋮ and then
Custom repositories. -
Set
Repositoryto https://github.com/mampfes/ha_epex_spot_sensor
andCategoryto Integration. -
Install EPEX Spot Sensor integration via HACS:
If the button doesn't work: Open
HACS>Integrations>Explore & Download Repositoriesand select integrationEPEX Spot Sensor. -
Add helper(s) provided by EPEX Spot Sensor to Home Assistant:
If the button doesn't work: Open
Settings>Devices & services>Helpers>Create Helperand selectEPEX Spot Sensor.
In case you would like to install manually:
-
Copy the folder
custom_components/epex_spot_sensortocustom_componentsin your Home Assistantconfigfolder. -
Add helper(s) provided by EPEX Spot Sensor to Home Assistant:
If the button doesn't work: Open
Settings>Devices & services>Helpers>Create Helperand selectEPEX Spot Sensor.
-
Earliest Start Time
Earliest time to start the appliance. -
Latest End Time
Latest time to end the appliance. Set it to same value as earliest start time to cover 24h. If set to smaller value than earliest start time, it automatically refers to following day. -
Duration
Required duration to complete the appliance. In Exact mode, this is the exact duration. In Flexible mode, this becomes the maximum duration. -
Remaining Duration Entity
Optional entity which indicates the remaining duration. If entity is set, it replaces the static duration and overrides flexible duration mode. If the state of theRemaining Duration Entitychanges betweenEarliest Start TimeandLatest End Time, the configuredEarliest Start Timewill be ignore and the latest change time of theRemaining Duration Entitywill the used instead. -
Duration Mode
Selects whether the duration is Exact (default) or Flexible:- Exact: Find intervals of exactly the specified duration
- Flexible: Find intervals between minimum and maximum duration, stopping when prices exceed the threshold
-
Minimum Duration
(Flexible mode only) The minimum required duration. Only appears whenDuration Modeis set to Flexible. Must be less than or equal to the configured duration (maximum). -
Price Tolerance (%)
Allow time slots within ±X% of the cheapest/most expensive price. Default is 0% (exact matching). Higher values provide more flexibility in scheduling while staying close to optimal prices.- 0% = Exact cheapest/most expensive (default behavior)
- 10-20% = Moderate flexibility, good for most use cases
- 50%+ = High flexibility, prioritizes convenience over cost optimization
When multiple intervals are within tolerance, the system prefers earlier start times.
-
Price Mode
Selects whether the sensor shall react on the cheapest or the most expensive prices betweenEarliest Start TimeandLatest End Time. -
Interval Mode
Selects whether the specified duration shall be completed in a single, contiguous interval or can be split into multiple, not contiguous intervals (intermittend).
-
Earliest Start Time
Reflects the configuredEarliest Start Time. -
Latest End Time
Reflects the configuredLatest End Time. -
Duration
Reflects the used value for duration. In Exact mode, this is the configured duration (orRemaining Duration Entitystate). In Flexible mode, this represents the maximum duration. -
Remaining Duration Entity
Optional entity which indicates the remaining duration. If entity is set, it replaces the static duration and overrides flexible duration mode. -
Duration Mode
Reflects the configuredDuration Mode(Exact or Flexible). In Flexible mode, the system finds intervals between minimum and maximum duration that stay within the price threshold. -
Minimum Duration
(Flexible mode only) The minimum required duration. Only present whenDuration Modeis set to Flexible. -
Price Tolerance
Reflects the configuredPrice Tolerancepercentage (0-100%). Shows how much price flexibility is allowed when selecting time slots. -
Interval Start Time Reflects the actual start time of the interval, which is either the configured
Earliest Start Timeor the latest change time of theRemaining Duration Entityif the state of the entity changed betweenEarliest Start TimeandLatest End Time. -
Price Mode
Reflects the configuredPrice Mode. -
Interval Mode
Reflects the configuredInterval Mode. -
Enabled
Set totrueif current time is betweenEarliest Start TimeandLatest End Time. -
Data
List of calculated intervals to switch sensor on, consisting ofstart_time,end_timeandrank(for Interval Mode intermittend only).
Each binary sensor now exposes an additional attribute visualization_data that is designed for dashboards.
It contains:
market_prices: historic/forecast price buckets (start_time,end_time,price)selected_intervals: the intervals chosen by the sensor logicprice_range: min/max values for quick chart scalingprice_unit,window_start,window_end
You can use this attribute with custom Lovelace cards (for example [apexcharts-card]) to overlay selected runtime intervals on top of the hourly prices.
Example template sensor to flatten data for charts:
template:
- sensor:
- name: "Waschmaschine Price Points"
state: "{{ now() }}"
attributes:
points: >-
{{ state_attr('binary_sensor.waschmaschine', 'visualization_data').market_prices
if state_attr('binary_sensor.waschmaschine', 'visualization_data') else [] }}
selected: >-
{{ state_attr('binary_sensor.waschmaschine', 'visualization_data').selected_intervals
if state_attr('binary_sensor.waschmaschine', 'visualization_data') else [] }}