What electricity really costs in money: day and night tariff at the regulated price
How to set a day and a night electricity price in Home Assistant, so that you see consumption in leva and not only in kWh. You take the prices from your own bill; we don’t give numbers.
- Level
- Intermediate
- Active time
- 45–90 minutes
- Home Assistant required
- Yes
Home Assistant shows how many kilowatt-hours (kWh) the home has used. The bill, however, is in leva and depends on the hour: day and night energy have different prices. If you set the prices, the “Energy” dashboard will show an approximate value in money, not only in kWh.
What you will learn
How to record a price per kWh in Home Assistant, how to separate day from night consumption and why the result is approximate. We don’t give electricity prices: they change and depend on your contract and supplier. Take them from your latest bill or from the regulator’s published decision for the period.
What you need
- Home Assistant with an already working sensor for energy in kWhthat only increases (a total energy meter or a metering plug). Power in W is not enough.
- A latest bill or a published regulated price for day and night energy.
- If the meter is dual-tariff: information on which hours are the day tariff and which the night one. The hours are in the contract or on the supplier’s website.
How it works
Home Assistant can calculate cost in two ways. The first is a fixed price: one number for all kWh. The second is a price sensor: a value that changes over time, for example between day and night. The dual-tariff case uses the second.
To know how many kWh are day and how many night, we use the helper Utility Meter with two tariffs. It counts the energy in two separate counters and switches between them with your automation.
Simeon takes the price from the HACS integration “Bulgarian Electricity Regulated Prices”, with the supplier Energo-Pro and two tariffs. The night tariff is 22:00–06:00 in winter time, and the hours follow the integration. His main electricity meter is a Shelly EM Gen3.
Steps
- In Settings → Dashboards → Energy check that the total consumption sensor has been added. If there is one price, under “Use a static price” enter the price per kWh from the bill. You are done here.
- For two tariffs, open Settings → Devices & services → Helpers → Create helper → Utility Meter. Set a name, choose your energy sensor and add two tariffs, for example
dayandnight. You should see two new sensors appear, one per tariff, and a selector of the current tariff. - Create an automation that switches the selector by hour. The hours in the example are examples; replace them with your own:
alias: Tariff - day/night
mode: single
triggers:
- trigger: time
at: "06:00:00"
- trigger: time
at: "22:00:00"
- trigger: homeassistant
event: start
actions:
- action: select.select_option
target:
entity_id: select.energy_tariff
data:
option: >
{{ 'day' if 6 <= now().hour < 22 else 'night' }}
- Create a price sensor. In Helpers → Create helper → Template → Template a sensor set a template that returns the day or night price depending on the selector. The numbers
0.00are a placeholder. Enter your prices:
{{ 0.00 if is_state('select.energy_tariff', 'day') else 0.00 }}
- In the Energy dashboard for consumption, choose “Use an entity tracking the price” and point to this sensor. Its unit must be a currency per kWh.
Checking the result
- Compare the counter readings for day and night with the electricity meter at the end of several days.
- The sum of the two counters should match the total consumption.
- After a restart, the tariff selector should point to the right tariff, because the automation also reacts at start.
If it doesn’t work
- Everything is counted in one tariff → the automation doesn’t switch the selector → check the entity ID of
selectand the hours. - The price in the dashboard is zero → the template returns 0 or
unknown→ check in Developer tools → Template. - Energy jumps on restart → the sensor loses its value → use a sensor with
state_class: total_increasing.
Limitations
- The calculation in Home Assistant is approximate. The bill includes fees, surcharges and taxes that you may not have added to the price.
- If the supplier changes the price, you have to update it manually. The old days keep the price at which they were calculated only if you used a price sensor, not a fixed one.
- This project doesn’t control appliances. It only shows a result.
Sources and verification status
Checked against the documentation on 22.11.2026.
Need a hand?
We can set up and install everything in this project. In some regions we install it ourselves — ask us.
Contact us


