An electricity price integration for Home Assistant from Selectra.
Turn your devices on and off based on the real-time price of electricity. Perfect for off-peak schedules, demand-response programs, and dynamic pricing offers.
This integration is currently in beta. We are actively developing new features and improving reliability. We'd love your feedback โ whether it's a bug report, a feature request, or just an idea. Don't hesitate to open an issue or start a discussion!
- Real-time electricity pricing โ Access current and upcoming electricity prices for your plan directly in Home Assistant.
- A ready-to-automate "Planned Run" signal โ A single binary sensor that turns
onwhen it's a good time to run your devices, whatever your tariff type. - Smart automations โ Trigger automations based on price thresholds, off-peak windows, or the cheapest upcoming hours.
- Feed-in tariffs โ If you have solar panels, track what your exported kWh earn you, right next to what you pay.
- Massive coverage โ 80 countries, 2,000+ energy providers, and 16,000+ electricity plans supported today.
- Always free โ This integration is and will remain free to use.
| Current | Goal (end of 2026) | |
|---|---|---|
| Countries | 80 | Worldwide |
| Energy providers | 2,000+ | All residential providers |
| Electricity plans | 16,000+ | Every residential plan |
Can't find your provider or plan? Open an issue and we'll look into adding it.
- Home Assistant 2025.12.0 or newer.
- A free Selectra API token โ see Data Source & API Access.
- Open HACS in Home Assistant.
- Search for Selectra and install it.
- Restart Home Assistant.
- Go to Settings โ Devices & Services โ Add Integration โ search for Selectra.
Not finding it? Go to HACS โ three-dot menu โ Custom repositories, paste
https://github.com/Selectra-Dev/selectra-haand select Integration.
- Download the latest release from the Releases page.
- Copy the
custom_components/selectrafolder into your Home Assistantconfig/custom_components/directory. - Restart Home Assistant.
- Go to Settings โ Devices & Services โ Add Integration โ search for Selectra.
Everything is configured through the Home Assistant UI โ no YAML required. After adding the integration you'll go through a short guided setup:
-
API token โ Paste your free Selectra API token (see below).
-
Qualification โ Identify your exact contract: country, postal code, electricity provider, offer, pricing option, subscribed power, and off-peak hours where applicable. Where feed-in tariffs are available you'll also be asked whether you export solar power, and if so a few questions about your installation (see Feed-in tariffs).
-
Behaviour โ For classic (multi-period) and dynamic plans, you'll then either:
- pick the active periods (classic plans, e.g. peak / off-peak), or
- choose an optimization strategy (dynamic plans).
Flat-rate plans skip this step โ the integration is ready as soon as qualification is done.
Need to change something later? Select the integration โ โฎ menu โ Reconfigure. This is Home Assistant's native reconfigure flow: it reuses your existing API token and re-runs qualification โ you won't be asked for the token again.
The integration adapts to your tariff. The Planned Run binary sensor turns on according to one of three modes:
| Mode | For which plans | When Planned Run is on |
|---|---|---|
| Flat | Single flat-rate tariffs | Always on (the price never changes). |
| Classic | Multi-period plans (e.g. peak / off-peak) | During the periods you selected at setup. |
| Dynamic | Dynamic / spot-price plans | During the cheapest hours, based on your chosen strategy. |
For dynamic plans, two strategies are available:
- Cheapest X% of the day โ the sensor is
onduring the cheapestX%of today's hours (e.g. the cheapest 30%). - Cheapest X consecutive hours โ the sensor is
onduring the single cheapest uninterrupted window ofXhours (great for EV charging or a dishwasher run).
Once configured, the integration creates the following entities:
| Entity | Type | Description |
|---|---|---|
| Planned Run | binary_sensor |
The core entity. on = good time to run your devices (see modes above). |
| Current Price | sensor |
The current electricity price per kWh, in your currency. |
| Feed-in Price | sensor (optional) |
What you are paid per kWh exported. Only created if you qualified with a feed-in tariff. |
| Provider | sensor (diagnostic) |
Your electricity provider. |
| Offer | sensor (diagnostic) |
Your offer/plan. Carries rich attributes (category, distributor, off-peak hours, featuresโฆ). |
| Option | sensor (diagnostic) |
Your pricing option. |
Exact entity IDs depend on your setup โ check them under Settings โ Devices & Services โ Selectra. The examples below use
binary_sensor.selectra_planned_runandsensor.selectra_current_price.
Planned Run exposes, among others:
current_period_name,current_price,currencynext_changeโ when the sensor will next switch on/offpricesโ the full list of upcoming price periods, each withname,price,start,end, andis_active. Ideal for building charts (see Visualization). Periods also carryfeed_in_pricewhen you have a feed-in tariff.
Current Price exposes period_name, period_start, period_end, and next_update.
Feed-in Price exposes period_name plus whatever extras your market defines โ grid fees (feed_in_monthly_fee, feed_in_yearly_fee, feed_in_yearly_fee_per_kw), the scheme or band you fall under, and any free-form conditions (feed_in_extra_text).
If you export solar power to the grid, the integration can also track what that export earns you.
During setup you'll be asked whether you have a feed-in tariff. Say yes and the integration asks a few follow-up questions about your installation โ which ones depends on your country: commissioning date, peak power (kWp/kWc), whether you sell your surplus or your full production, which compensation scheme applies, or simply which tariff you're on.
You then get a Feed-in Price sensor holding your current export rate per kWh, and every period in the prices attribute gains a feed_in_price.
Not asked about it? Feed-in tariffs are available on a subset of countries and API tokens. If the question doesn't appear, your token or your country isn't covered yet โ open an issue and we'll tell you where it stands. Saying no, or never being asked, leaves everything else unchanged.
Charge the home battery from the grid only when importing costs less than exporting pays:
automation:
- alias: "Battery โ charge while import beats export"
trigger:
- platform: state
entity_id: sensor.selectra_current_price
condition:
- condition: template
value_template: >
{{ states('sensor.selectra_current_price') | float
< states('sensor.selectra_feed_in_price') | float }}
action:
- action: switch.turn_on
target:
entity_id: switch.battery_grid_chargeYour entity IDs may differ from the examples below. Check the real IDs under Settings โ Devices & Services โ Selectra and adjust the automations and chart config accordingly.
Run your water heater during the planned (cheap) periods:
automation:
- alias: "Water heater โ cheap hours only"
trigger:
- platform: state
entity_id: binary_sensor.selectra_planned_run
to: "on"
action:
- action: switch.turn_on
target:
entity_id: switch.water_heater
- alias: "Water heater โ off outside cheap hours"
trigger:
- platform: state
entity_id: binary_sensor.selectra_planned_run
to: "off"
action:
- action: switch.turn_off
target:
entity_id: switch.water_heaterCharge the EV only when the price drops below a threshold:
automation:
- alias: "EV charging โ below 0.15 /kWh"
trigger:
- platform: numeric_state
entity_id: sensor.selectra_current_price
below: 0.15
action:
- action: switch.turn_on
target:
entity_id: switch.ev_chargerYou can plot today's prices using the prices attribute of the Planned Run sensor โ for example with the popular ApexCharts card:
type: custom:apexcharts-card
header:
title: Electricity prices today
series:
- entity: binary_sensor.selectra_planned_run
name: Price
type: column
data_generator: |
return entity.attributes.prices.map(p => [new Date(p.start).getTime(), p.price]);With a feed-in tariff you can plot both sides at once by adding a second series:
- entity: binary_sensor.selectra_planned_run
name: Feed-in
type: line
data_generator: |
return entity.attributes.prices
.filter(p => p.feed_in_price != null)
.map(p => [new Date(p.start).getTime(), p.feed_in_price]);All electricity pricing data is provided by the Selectra Electricity Planning API.
This integration requires an API token. To get one:
- Visit the Selectra Electricity Planning API registration page.
- Follow the instructions to request your free API key.
- Paste the token during the integration's setup (first step).
Need help? Contact us at support.home-assistant@selectra.info.
"Reconfiguration Required" notification appears / entities show as unavailable.
Your contract details need to be refreshed (e.g. your provider changed something). Open Settings โ Devices & Services โ Selectra โ Reconfigure and re-run the setup. Entities come back automatically once reconfiguration succeeds.
"Invalid or missing API key" during setup. Double-check the token, or register for a free one at the API page. Still stuck? Email support.home-assistant@selectra.info.
"Too many requests" / rate limited. The Selectra API applies rate limits. Wait a few minutes and try again โ the integration also backs off automatically and retries on its own.
Current Price or Planned Run shows unknown / no data.
This can happen when no price data is available yet for the current day. The integration polls regularly and will populate the values as soon as data is published.
How often does it update?
Polling is dynamic: the integration follows the API's next_update hint (at most once a minute, ~every 15 minutes by default) and recalculates the Planned Run state locally at each period boundary โ so transitions are on time without hammering the API.
Does it re-download everything when I restart Home Assistant?
No. Responses are cached on disk: your contract details for 48 hours, and prices until the next_update the API returns with them. A restart reuses what is still valid, so restarting often costs you nothing against your rate limit. Reconfiguring, or removing the integration, clears the cache.
We welcome contributions of all kinds! Here's how you can help:
- ๐ Report bugs โ Open an issue with steps to reproduce.
- ๐ก Suggest features โ We're very open to ideas and requests. Tell us what would make this integration more useful for you.
- ๐ง Submit a PR โ Fork the repo, make your changes, and open a pull request.
Running the tests:
pip install -r requirements-test.txt
pytestHome Assistant doesn't run on Windows โ use WSL or Linux.
This project is licensed under the Apache License 2.0.
Made with โก by Selectra