π SlovenskΓ‘ verzia dokumentΓ‘cie / Slovak Documentation β
OKTE Integration is a comprehensive Home Assistant custom integration that provides automatic data retrieval from the Slovak Energy Market (OKTE - OperΓ‘tor krΓ‘tkodobΓ©ho trhu s elektrinou). This integration enables smart home automation based on real-time electricity prices, helping you optimize energy costs by scheduling energy-intensive devices during the cheapest price windows.
- π Automatic data synchronization from OKTE API
- π Comprehensive price sensors for today and tomorrow
- π Flexible time window calculations for finding lowest and highest price periods
- π Interactive price charts with ApexCharts support
- π HTML tables for easy price visualization
- π― Binary detectors for automation triggers
- β‘ Real-time current price tracking
- π’ Statistical sensors (min, max, average prices)
- π Sunrise/sunset integration for time window configuration
- π§ Multiple Calculator devices for independent automation scenarios
- Installation
- OKTE Master Device
- Calculator Device
- Database Optimization
- Price Charts
- HTML Price Tables
- Automation Examples
- Troubleshooting
- Support
- Open HACS in your Home Assistant
- Go to Integrations
- Click the 3 dots menu in the top right corner
- Select Custom repositories
- Add repository URL:
https://github.com/jozef-moravcik-homeassistant/okte - Category: Integration
- Click Download
- Restart Home Assistant
- Download the latest release from GitHub
- Extract the
oktefolder to yourcustom_componentsdirectory:config/ βββ custom_components/ βββ okte/ βββ __init__.py βββ manifest.json βββ config_flow.py βββ ... - Restart Home Assistant
The OKTE integration uses two types of virtual devices:
- Automatically installed first during initial setup
- Only ONE Master device is allowed per Home Assistant instance
- Handles automatic data fetching from OKTE API
- Provides price sensors, statistics, and data for Calculator devices
- Default data fetch time: 14:00 (OKTE publishes next day prices around 13:00)
- Add unlimited number of Calculator devices
- Each Calculator device is independently configured
- Automatically numbered: Calculator 1, Calculator 2, Calculator 3, etc.
- Uses data from OKTE Master to find optimal price windows
- Perfect for different automation scenarios (battery charging, heat pump operation, etc.)
- Go to Settings β Devices & Services
- Click + Add Integration
- Search for "OKTE"
- Select device type:
- Master (API Data Fetcher) - if this is your first installation
- Calculator (Time Window Calculator) - for additional calculator devices
Both device types offer an option to include device name in entity names:
OKTE Master:
- β
Enabled (default):
sensor.okte_current_price - β¬ Disabled:
sensor.current_price
Calculator Devices:
- β
Enabled (default):
sensor.okte_1_lowest_price_window - β¬ Disabled:
sensor.lowest_price_window
π‘ Tip: Keep this enabled when using multiple Calculator devices to easily distinguish between them!
The OKTE Master device is the core component that handles all communication with the OKTE API. It automatically downloads electricity price data and provides it to the system.
| Parameter | Default | Description |
|---|---|---|
| Add 'OKTE -' prefix to entity names | β Enabled | Adds "okte_" prefix to all entity IDs |
| Daily fetch time | 14:00 | Time when data is automatically downloaded from OKTE API |
β οΈ Important: OKTE publishes next day prices around 13:00, so the default fetch time of 14:00 ensures you always have up-to-date data for both days. Data is also automatically downloaded at 10, 60 and 120 seconds after midnight to update the data for the current day, but since in OKTE the data for the next day is only available after 13:00, with this midnight download only the current day is loaded, the next day only with the next download (default 14:00). In case of unsuccessful data download, for example due to an interrupted internet connection or a malfunction on the OKTE side, the integration will try to download the data every minute until it is successfully downloaded. This status is indicated by the sensor.okte_connection_status sensor and the error code is recorded in the sensor.okte_error_code sensor.
The Master device creates the following entities:
| Entity ID | Description | Unit | Attributes |
|---|---|---|---|
sensor.okte_current_price |
Current electricity price | EUR/MWh | - |
sensor.okte_average_price_today |
Today's average price | EUR/MWh | - |
sensor.okte_min_price_today |
Today's minimum price | EUR/MWh | time_from, time_to |
sensor.okte_max_price_today |
Today's maximum price | EUR/MWh | time_from, time_to |
sensor.okte_average_price_tomorrow |
Tomorrow's average price | EUR/MWh | - |
sensor.okte_min_price_tomorrow |
Tomorrow's minimum price | EUR/MWh | time_from, time_to |
sensor.okte_max_price_tomorrow |
Tomorrow's maximum price | EUR/MWh | time_from, time_to |
| Entity ID | Description | Purpose |
|---|---|---|
sensor.okte_prices_today |
Today's prices | For ApexCharts graphs |
sensor.okte_prices_tomorrow |
Tomorrow's prices | For ApexCharts graphs |
Attributes:
period_data: Array of objects containing:time: ISO timestampprice: Price value in EUR/MWhperiod: period of the day
| Entity ID | Description | Purpose |
|---|---|---|
sensor.okte_html_table_today |
Today's price table in HTML | For HTML template cards |
sensor.okte_html_table_tomorrow |
Tomorrow's price table in HTML | For HTML template cards |
Attributes:
html_table: Complete HTML table code with:- Periodical breakdown (00:00 - 23:59)
- Color-coded prices (green=low, yellow=medium, red=high)
- Formatted prices with 2 decimal places
| Entity ID | Description | Values |
|---|---|---|
sensor.okte_connection_status |
API connection status | Connected / Disconnected |
sensor.okte_last_update |
Last successful data fetch | Timestamp |
sensor.okte_data_count |
Number of price records | Integer |
| Entity ID | Description | Action |
|---|---|---|
button.okte_update_data |
Manual data fetch | Triggers immediate API data download |
type: grid
cards:
- type: entities
entities:
- entity: sensor.okte_current_price
- type: divider
- entity: sensor.okte_prices_today
- entity: sensor.okte_prices_tomorrow
- type: divider
- entity: sensor.okte_max_price_today
- entity: sensor.okte_max_price_tomorrow
- type: divider
- entity: sensor.okte_min_price_today
- entity: sensor.okte_min_price_tomorrow
- type: divider
- entity: sensor.okte_average_price_today
- entity: sensor.okte_average_price_tomorrow
- type: divider
- entity: sensor.okte_html_table_today
- entity: sensor.okte_html_table_tomorrow
- type: divider
- entity: sensor.okte_error_code sensor
- entity: sensor.okte_data_count
- entity: sensor.okte_connection_status
- entity: sensor.okte_last_update
- entity: button.okte_update_data
title: OKTE Master
grid_options:
columns: full
column_span: 2The Calculator device uses data from the OKTE Master to find optimal time windows with the lowest or highest electricity prices. You can add unlimited Calculator devices, each with independent configuration for different automation scenarios.
| Parameter | Default | Description |
|---|---|---|
| Insert device name before entity name | β Enabled | Adds device identifier to entity names |
| Window size | 3 hours | Default size for price window calculations |
| Time range from | 00:00 | Default start time for window search |
| Time range to | 23:59 | Default end time for window search |
Each Calculator device creates a comprehensive set of entities for finding and tracking optimal price windows:
Calculator devices use numbered prefixes in entity IDs:
| Device | Entity ID Example | Pattern |
|---|---|---|
| Calculator 1 | sensor.okte_1_lowest_price_window |
okte_1_{entity_name} |
| Calculator 2 | sensor.okte_2_lowest_price_window |
okte_2_{entity_name} |
| Calculator 3 | sensor.okte_3_lowest_price_window |
okte_3_{entity_name} |
π‘ Note: The number automatically increments for each new Calculator device
| Entity ID Pattern | Description | Attributes |
|---|---|---|
sensor.okte_N_lowest_price_window |
Combined lowest price window (today or tomorrow) | start_time, end_time, average_price, min_price, max_price, prices |
sensor.okte_N_lowest_price_window_today |
Today's lowest price window | start_time, end_time, average_price, min_price, max_price, prices |
sensor.okte_N_lowest_price_window_tomorrow |
Tomorrow's lowest price window | start_time, end_time, average_price, min_price, max_price, prices |
sensor.okte_N_lowest_price_window_size |
Window duration in H:MM format | - |
sensor.okte_N_lowest_price_search_window_size |
Search window duration in H:MM format | - |
| Entity ID Pattern | Description | Attributes |
|---|---|---|
sensor.okte_N_highest_price_window |
Combined highest price window (today or tomorrow) | start_time, end_time, average_price, min_price, max_price, prices |
sensor.okte_N_highest_price_window_today |
Today's highest price window | start_time, end_time, average_price, min_price, max_price, prices |
sensor.okte_N_highest_price_window_tomorrow |
Tomorrow's highest price window | start_time, end_time, average_price, min_price, max_price, prices |
sensor.okte_N_highest_price_window_size |
Window duration in H:MM format | - |
sensor.okte_N_highest_price_search_window_size |
Search window duration in H:MM format | - |
These detectors automatically turn ON when the current time is within the calculated price window:
Lowest Price Detectors:
| Entity ID Pattern | Description | States |
|---|---|---|
binary_sensor.okte_N_detector_lowest_price |
ON when in lowest price window (combined) | ON / OFF |
binary_sensor.okte_N_detector_lowest_price_today |
ON when in today's lowest price window | ON / OFF |
binary_sensor.okte_N_detector_lowest_price_tomorrow |
ON when in tomorrow's lowest price window | ON / OFF |
Highest Price Detectors:
| Entity ID Pattern | Description | States |
|---|---|---|
binary_sensor.okte_N_detector_highest_price |
ON when in highest price window (combined) | ON / OFF |
binary_sensor.okte_N_detector_highest_price_today |
ON when in today's highest price window | ON / OFF |
binary_sensor.okte_N_detector_highest_price_tomorrow |
ON when in tomorrow's highest price window | ON / OFF |
π‘ Use Case: Perfect for automation triggers! Turn on battery charging when detector is ON, or reduce consumption during high price periods.
Time Range Configuration:
| Entity ID Pattern | Type | Description | Default |
|---|---|---|---|
switch.okte_N_lowest_price_window_from_as_day_start |
Switch | Auto-set start time to sunrise | OFF |
time.okte_N_lowest_price_time_from |
Time | Manual start time | 00:00 |
switch.okte_N_lowest_price_window_to_as_day_end |
Switch | Auto-set end time to sunset | OFF |
time.okte_N_lowest_price_time_to |
Time | Manual end time | 23:59 |
number.okte_N_lowest_price_window_size |
Number | Price window duration (hours) | 3 |
How Sunrise/Sunset Switches Work:
- β ON: Time is automatically set to sunrise/sunset
- β¬ OFF: Manual time from
timeentity is used
π Example: Enable sunrise switch to automatically search for lowest prices starting from sunrise each day
Time Range Configuration:
| Entity ID Pattern | Type | Description | Default |
|---|---|---|---|
switch.okte_N_highest_price_window_from_as_day_start |
Switch | Auto-set start time to sunrise | OFF |
time.okte_N_highest_price_time_from |
Time | Manual start time | 00:00 |
switch.okte_N_highest_price_window_to_as_day_end |
Switch | Auto-set end time to sunset | OFF |
time.okte_N_highest_price_time_to |
Time | Manual end time | 23:59 |
number.okte_N_highest_price_window_size |
Number | Price window duration (hours) | 3 |
type: grid
cards:
# Lowest Price Window Information
- type: entities
entities:
- entity: binary_sensor.okte_1_detector_lowest_price
- entity: binary_sensor.okte_1_detector_lowest_price_today
- entity: binary_sensor.okte_1_detector_lowest_price_tomorrow
- entity: sensor.okte_1_lowest_price_window
- entity: sensor.okte_1_lowest_price_window_today
- entity: sensor.okte_1_lowest_price_window_tomorrow
- entity: sensor.okte_1_lowest_price_window_size
- entity: sensor.okte_1_lowest_price_search_window_size
title: OKTE Calculator 1 - Lowest Prices
grid_options:
columns: full
rows: auto
# Lowest Price Window Controls
- type: entities
entities:
- entity: switch.okte_1_lowest_price_window_from_as_day_start
- entity: time.okte_1_lowest_price_time_from
- entity: switch.okte_1_lowest_price_window_to_as_day_end
- entity: time.okte_1_lowest_price_time_to
- entity: number.okte_1_lowest_price_window_size
title: Lowest Price - Settings
grid_options:
columns: full
rows: auto
# Highest Price Window Information
- type: entities
entities:
- entity: binary_sensor.okte_1_detector_highest_price
- entity: binary_sensor.okte_1_detector_highest_price_today
- entity: binary_sensor.okte_1_detector_highest_price_tomorrow
- entity: sensor.okte_1_highest_price_window
- entity: sensor.okte_1_highest_price_window_today
- entity: sensor.okte_1_highest_price_window_tomorrow
- entity: sensor.okte_1_highest_price_window_size
- entity: sensor.okte_1_highest_price_search_window_size
title: OKTE Calculator 1 - Highest Prices
grid_options:
columns: full
rows: auto
# Highest Price Window Controls
- type: entities
entities:
- entity: switch.okte_1_highest_price_window_from_as_day_start
- entity: time.okte_1_highest_price_time_from
- entity: switch.okte_1_highest_price_window_to_as_day_end
- entity: time.okte_1_highest_price_time_to
- entity: number.okte_1_highest_price_window_size
title: Highest Price - Settings
grid_options:
columns: full
rows: auto
column_span: 2The OKTE integration includes sensors with large data volumes (HTML tables, price arrays) that can significantly increase your Home Assistant database size. These entities are fully functional and visible in the UI but should be excluded from the recorder to prevent database performance issues.
Add the following configuration to your configuration.yaml:
recorder:
exclude:
entities:
- sensor.okte_prices_today
- sensor.okte_prices_tomorrow
- sensor.okte_html_table_today
- sensor.okte_html_table_tomorrow
β οΈ After adding this configuration, restart Home Assistant to apply the changes.
| Entity | Data Size | Reason |
|---|---|---|
sensor.okte_prices_today |
~16 KB | Contains 24-48 hours of detailed price data |
sensor.okte_prices_tomorrow |
~16 KB | Contains 24-48 hours of detailed price data |
sensor.okte_html_table_today |
~8 KB | Full HTML table with styling |
sensor.okte_html_table_tomorrow |
~8 KB | Full HTML table with styling |
After installation, the integration will display a system notification recommending these exclusions:
π‘ Note: These entities will still work perfectly in your dashboards and automations - they just won't be stored in historical database records.
The OKTE integration provides price data perfectly formatted for ApexCharts Card visualization. This allows you to create beautiful, interactive price charts.
Install the ApexCharts Card via HACS:
- Open HACS β Frontend
- Search for "ApexCharts Card"
- Install and restart Home Assistant
type: custom:apexcharts-card
grid_options:
columns: 12
rows: auto
card_mod:
style: |
ha-card {
min-width: 400px;
padding: 0px 10px 0px 0px;
}
ha-card div#header__title {
font-size: 17px !important;
color:#1a60b2;
padding: 5px 0px 10px 10px;
}
apex_config:
chart:
zoom:
autoScaleYaxis: false
plotOptions:
bar:
columnWidth: 70%
graph_span: 24h
span:
start: day
header:
show: true
title: OKTE - Electricity prices today [β¬/MWh]
show_states: true
colorize_states: true
now:
show: true
experimental:
color_threshold: true
series:
- entity: sensor.okte_prices_today
name: Price β¬/MWh
type: column
color_threshold:
- value: 0
color: red
- value: 0
color: "#FFAA10"
- value: 20
color: "#219610"
- value: 300
color: "#2196F0"
stroke_width: 0
color: "#219610"
data_generator: |
const data = entity.attributes.period_data || [];
return data
.slice(0,96)
.map((entry) => {
return [new Date(entry.time).getTime(), entry.price];
});
show:
extremas: false
in_header: false
- entity: sensor.okte_current_price
name: Current price
color: "#219610"
data_generator: |
const now = new Date();
const currentValue = parseFloat(entity.state);
return [[now.getTime(), currentValue]];
show:
in_chart: false
in_header: true
- entity: sensor.okte_min_price_today
name: Min today
color: red
data_generator: |
const now = new Date();
const minValue = parseFloat(entity.state);
return [[now.getTime(), minValue]];
show:
in_chart: false
in_header: true
- entity: sensor.okte_max_price_today
name: Max today
color: "#2196F0"
data_generator: |
const now = new Date();
const maxValue = parseFloat(entity.state);
return [[now.getTime(), maxValue]];
show:
in_chart: false
in_header: truetype: custom:apexcharts-card
grid_options:
columns: 12
rows: auto
card_mod:
style: |
ha-card {
min-width: 400px;
padding: 0px 10px 0px 0px;
}
ha-card div#header__title {
font-size: 17px !important;
color:#1a60b2;
padding: 5px 0px 10px 10px;
}
apex_config:
chart:
zoom:
autoScaleYaxis: false
plotOptions:
bar:
columnWidth: 70%
graph_span: 24h
span:
start: day
offset: +1d
header:
show: true
title: OKTE - Electricity prices tomorrow [β¬/MWh]
show_states: true
colorize_states: true
now:
show: false
experimental:
color_threshold: true
series:
- entity: sensor.okte_prices_tomorrow
name: Price β¬/MWh
type: column
color_threshold:
- value: 0
color: red
- value: 0
color: "#FFAA10"
- value: 20
color: "#219610"
- value: 300
color: "#2196F0"
stroke_width: 0
color: "#219610"
data_generator: |
const data = entity.attributes.period_data || [];
return data
.slice(0,96)
.map((entry) => {
return [new Date(entry.time).getTime(), entry.price];
});
show:
extremas: false
in_header: false
- entity: sensor.okte_min_price_tomorrow
name: Min tomorrow
color: red
data_generator: |
const now = new Date();
const minValue = parseFloat(entity.state);
return [[now.getTime(), minValue]];
show:
in_chart: false
in_header: true
- entity: sensor.okte_max_price_tomorrow
name: Max tomorrow
color: "#2196F0"
data_generator: |
const now = new Date();
const maxValue = parseFloat(entity.state);
return [[now.getTime(), maxValue]];
show:
in_chart: false
in_header: true- π Color-coded bars based on price ranges
- π― Current time indicator (today's chart)
- π Min/Max/Current prices in header
- π±οΈ Interactive zoom and hover tooltips
- π± Responsive design for mobile devices
The OKTE integration generates fully formatted HTML tables with color-coded prices for easy visualization.
Install the HTML Template Card via HACS:
- Open HACS β Frontend
- Search for "HTML Template Card"
- Install and restart Home Assistant
type: grid
cards:
- type: custom:html-template-card
content: |
{{ state_attr('sensor.okte_html_table_today', 'html_table') }}type: grid
cards:
- type: custom:html-template-card
content: |
{{ state_attr('sensor.okte_html_table_tomorrow', 'html_table') }}- π¨ Color-coded prices:
- π’ Green: Low prices (good for energy consumption)
- π‘ Yellow: Medium prices
- π΄ Red: High prices (reduce consumption)
- π Periodical breakdown from 00:00 to 23:59
- π° Formatted prices with 2 decimal places
- π± Responsive design adapts to screen size
The OKTE integration provides powerful tools for creating smart energy automations based on electricity prices.
Automatically charge your battery when electricity prices are at their lowest:
automation:
- alias: "Battery - Charge During Lowest Price Window"
description: "Charge battery when in lowest price window"
trigger:
- platform: state
entity_id: binary_sensor.okte_1_detector_lowest_price
to: "on"
condition:
- condition: numeric_state
entity_id: sensor.battery_level
below: 80
action:
- service: switch.turn_on
target:
entity_id: switch.battery_charger
- service: notify.mobile_app
data:
title: "β‘ Battery Charging Started"
message: "Charging during low price period ({{ states('sensor.okte_current_price') }} β¬/MWh)"
- alias: "Battery - Stop Charging After Lowest Price Window"
description: "Stop charging when lowest price window ends"
trigger:
- platform: state
entity_id: binary_sensor.okte_1_detector_lowest_price
to: "off"
action:
- service: switch.turn_off
target:
entity_id: switch.battery_charger
- service: notify.mobile_app
data:
title: "π Battery Charging Stopped"
message: "Low price period ended"Optimize heat pump operation based on electricity prices:
automation:
- alias: "Heat Pump - Boost During Low Prices"
description: "Increase heat pump power during lowest price window"
trigger:
- platform: state
entity_id: binary_sensor.okte_2_detector_lowest_price
to: "on"
condition:
- condition: numeric_state
entity_id: sensor.outdoor_temperature
below: 5
action:
- service: climate.set_temperature
target:
entity_id: climate.heat_pump
data:
temperature: 23
- service: number.set_value
target:
entity_id: number.heat_pump_power_limit
data:
value: 100Reduce energy consumption during the most expensive periods:
automation:
- alias: "Energy - Reduce Consumption During High Prices"
description: "Disable non-essential devices during highest price window"
trigger:
- platform: state
entity_id: binary_sensor.okte_3_detector_highest_price
to: "on"
action:
- service: switch.turn_off
target:
entity_id:
- switch.electric_water_heater
- switch.pool_pump
- switch.ev_charger
- service: notify.mobile_app
data:
title: "β οΈ High Price Period"
message: "Non-essential devices disabled ({{ states('sensor.okte_current_price') }} β¬/MWh)"Automatically adjust the price window size based on battery level:
automation:
- alias: "Battery - Adjust Charging Window Size"
description: "Increase charging window when battery is very low"
trigger:
- platform: numeric_state
entity_id: sensor.battery_level
below: 20
action:
- service: number.set_value
target:
entity_id: number.okte_1_lowest_price_window_size
data:
value: 6
- alias: "Battery - Normal Charging Window Size"
description: "Use normal window size when battery is OK"
trigger:
- platform: numeric_state
entity_id: sensor.battery_level
above: 50
action:
- service: number.set_value
target:
entity_id: number.okte_1_lowest_price_window_size
data:
value: 3Get notified about tomorrow's lowest price window:
automation:
- alias: "OKTE - Tomorrow's Lowest Price Notification"
description: "Send notification with tomorrow's cheapest time"
trigger:
- platform: time
at: "14:30:00"
action:
- service: notify.mobile_app
data:
title: "β‘ Tomorrow's Lowest Price Window"
message: >
Lowest prices tomorrow:
{{ state_attr('sensor.okte_1_lowest_price_window_tomorrow', 'start_time') }} -
{{ state_attr('sensor.okte_1_lowest_price_window_tomorrow', 'end_time') }}
Average: {{ state_attr('sensor.okte_1_lowest_price_window_tomorrow', 'average_price') }} β¬/MWhπ‘ Best Practices:
- Use multiple Calculator devices for different appliances (battery, heat pump, water heater)
- Adjust window sizes based on your needs (3h for battery, 6h for heat pump)
- Combine price detectors with other conditions (temperature, battery level)
- Set sunrise/sunset switches for more natural automation patterns
- Use notifications to stay informed about price changes
- Check logs in Settings β System β Logs
- Verify installation - files should be in
custom_components/okte/ - Restart Home Assistant after installation
- Clear browser cache if UI doesn't show the integration
- Check OKTE Master connection: Verify
sensor.okte_connection_statusis "Connected" - Manually trigger data fetch: Press
button.okte_update_data - Verify fetch time: Ensure it's after 13:00 when OKTE publishes prices
- Check API accessibility: OKTE API might be temporarily unavailable
- Verify time range settings in Calculator configuration
- Check window size - ensure it's not larger than the search range
- Verify OKTE Master has valid data
- Check sunrise/sunset switches - they might override manual times
- Implement recorder exclusions as described in Database Optimization
- Restart Home Assistant after adding exclusions
- Purge old data: Developer Tools β Services β
recorder.purge
- Install ApexCharts Card via HACS
- Clear browser cache
- Check entity IDs in card configuration match your device names
- Verify sensor data: Check if
sensor.okte_prices_todayhasperiod_dataattribute
- GitHub Repository: https://github.com/jozef-moravcik-homeassistant/okte
- Issues & Bug Reports: GitHub Issues
- Author: Jozef Moravcik
- Email: jozef.moravcik@moravcik.eu
When reporting issues, please include:
- Home Assistant version
- OKTE integration version
- Relevant log entries from Settings β System β Logs
- Steps to reproduce the issue
- Screenshots if applicable
If you find this integration useful, please consider:
- β Star the repository on GitHub
- π Report bugs or suggest features
- π Share your automation examples with the community
- β Buy me a coffee (donation link in repository)
This project is licensed under the MIT License - see the LICENSE file for details.
- OKTE (OperΓ‘tor krΓ‘tkodobΓ©ho trhu s elektrinou) for providing the public API
- Home Assistant Community for continuous support and inspiration
- All Contributors who helped improve this integration
Made with β€οΈ for the Home Assistant community










