---
title: "Бойлер на нощна тарифа и колко струва токът"
description: "Свързваш бойлера към реле с измерване на мощността, следиш дневната и нощната тарифа в Home Assistant, получаваш дневен отчет за разхода в евро и известие, когато водата е загряла."
canonical: "https://realhomeautomations.com/bg/projects/boyler-na-noshtna-tarifa-i-kolko-struva-tokat-u-doma/"
language: bg-BG
updated: 2026-11-23T16:24:04+00:00
---

# Бойлер на нощна тарифа и колко струва токът

Свързваш бойлера към реле с измерване на мощността, следиш дневната и нощната тарифа в Home Assistant, получаваш дневен отчет за разхода в евро и известие, когато водата е загряла.

> Канонична HTML страница: https://realhomeautomations.com/bg/projects/boyler-na-noshtna-tarifa-i-kolko-struva-tokat-u-doma/

- **Difficulty:** Средно ниво
- **Build time:** 60–120 минути
- **Време за четене:** 9 minutes

## Tools required

- Ogemray Smart Relay 25A (one unit; goes on the live wire to the water heater)
- Home Assistant с HACS (за интеграцията на тарифата)
- Phone with the Home Assistant Companion app (for the daily report and the hot-water notification)
- Данни за твоя доставчик и тип броило (двутарифно броило и часовете на скалите)


## What readers will learn

- To check by the water heater's power and current that the relay suits it
- Да добавиш сензор за дневна и нощна тарифа и да го сравниш с броилото си
- Да направиш автоматизация, която включва бойлера по тарифата и го изключва по мощността
- To see in Home Assistant when the water heater is actually heating
- To get a notification when the water is hot after a long heating cycle
- To calculate the water heater's cost in euros and get a daily report
- To keep manual control and a backup way to switch the water heater on


## Skill requirements

- To add a device to Home Assistant
- Да редактираш автоматизация в YAML
- Да четеш историята на сензор за мощност
- Да добавяш custom repository в HACS

## Комплект за проекта

- [Умно реле Ogemray 25A – умно управление на мощни товари, с пълната функционалност на Shelly](https://realhomeautomations.com/bg/produkt/ogemray-smart-relay-25a-smart-control-for-high-power-loads-with-full-shelly-functionality/index.md)

The night tariff is cheaper only if the water heater really heats at night. Switching it on by hand before bed gets forgotten, and a mechanical timer doesn't know when the supplier changes the hours.

 Тук свързваш бойлера към реле с измерване на мощността, взимаш дневната и нощната тарифа като сензор в Home Assistant и оставяш релето да загрява само при нощна тарифа. Накрая добавяш дневен отчет за разхода в евро и известие, когато водата е загряла.

 ## Как работи

 Три части работят заедно. Релето подава или прекъсва захранването на бойлера и мери мощността му. Сензорът за тарифата казва дали сега е ден (`day`) или нощ (`night`). Автоматизацията включва релето при начало на нощта и го изключва при връщането на деня.

 At night the relay is not stopped by the clock but by the power. When the water is hot, the water heater's thermostat stops the heating element and the power drops below a set threshold. Then Home Assistant switches the relay off.

 That is why the most reliable sign of "heated" is not the time of day but power that has dropped for a few minutes. It works the same when you switch the water heater on by hand.

 ## Часовете на тарифата не са еднакви за всички

 Don't take someone else's schedule as your own. ENERGO-PRO publishes for its customers a night tariff from 23:00 to 07:00 from April to October and from 22:00 to 06:00 from November to March. Other companies and your meter may be set differently, so ask your supplier and check the meter.

 The sensor we use comes from the Bulgarian Electricity Regulated Pricing integration. It supports Electrohold, EVN and ENERGO-PRO and follows the official rules. If your meter doesn't switch to summer time, the integration has the option Use Legacy Night Tariff Algorithm.

 Преди да поверяваш бойлера на сензора, сравни момента, в който той минава на `night`, с момента, в който броилото сменя скалата.

 ## 1. Избери релето и го монтирай

 To check that the relay suits your water heater, take its power from the label in watts and divide by 230 V. A water heater of about 2 kW draws about 9 A. Ours shows about 2.1 kW on the sensor while heating. The result has to be below the relay's rating.

 Ползваме [Ogemray Smart Relay 25A](https://realhomeautomations.com/bg/produkt/ogemray-smart-relay-25a-smart-control-for-high-power-loads-with-full-shelly-functionality/). Производителят го описва за товар до 25 A и 6000 W с измерване на мощност, така че обикновен бойлер от 2 до 3 kW е далеч в границите му.

 Релето се свързва на фазата между таблото и бойлера.

 After installing, add the relay from Settings → Devices & services → Add integration → Shelly. You get a switch and Power and Energy sensors. Switch the water heater on and off from Home Assistant. Power should jump from close to 0 to its power and come back.

 ## 2. Измери как изглежда загряването

 Open the history of the Power sensor (Settings → Devices & services → Entities → select the sensor → History) for a day when the water heater was heating. You are looking for two values: the power while heating and the power when the thermostat has stopped the heating element.

 From them you pick thresholds. In our configuration the end of heating is a power below 150 W for 3 minutes, and the "water heater is idle" check is below 50 W. These numbers are for our water heater. Take yours from your own history.

 В същата история се вижда и кога бойлерът реално нагрява: участъкът с висока мощност е нагряване, а спадът до близо нула е термостатът в покой. Сложи сензора Power на таблото с карта History graph и виждаш с един поглед колко често работи и за колко време загрява.

 ## 3. Добави сензора за тарифата

 Интеграцията не е в стандартния каталог. Добавяш [avataar/bg_electricity_regulated_pricing](https://github.com/avataar/bg_electricity_regulated_pricing) as a custom repository in HACS, restart Home Assistant and add it from Settings → Devices & services → Add integration.

 Въведи име, избери доставчика и остави останалите опции по подразбиране. Получаваш два сензора: `..._tariff` със състояния `day` и `night` и `..._price` with a price in EUR/kWh. According to the integration's description the prices are final, with VAT.

 У нас устройството се казва Home electricity, затова сензорите са `sensor.home_electricity_tariff` и `sensor.home_electricity_price`.

 Open Developer tools → States and see what tariff shows right now. If it doesn't match your meter, go back to the previous section and check the supplier.

 ## 4. Автоматизацията по тарифа

 Този раздел показва метода. Примерът е опростена версия на тарифната автоматизация, която имахме, без допълнителното загряване в 20:00.

 ```
alias: Water heater on night tariff
mode: restart
triggers:
  - trigger: state
    entity_id: sensor.home_electricity_tariff
    to: night
    id: night_start
  - trigger: time
    at: "05:00:00"
    id: top_up
  - trigger: state
    entity_id: sensor.home_electricity_tariff
    to: day
    id: day_start
actions:
  - choose:
      - conditions:
          - condition: trigger
            id: day_start
        sequence:
          - action: switch.turn_off
            target:
              entity_id: switch.bathroom_main_water_heater
      - conditions:
          - condition: or
            conditions:
              - condition: trigger
                id: night_start
              - condition: and
                conditions:
                  - condition: trigger
                    id: top_up
                  - condition: state
                    entity_id: sensor.home_electricity_tariff
                    state: night
                  - condition: numeric_state
                    entity_id: sensor.bathroom_main_water_heater_power
                    below: 50
        sequence:
          - action: switch.turn_on
            target:
              entity_id: switch.bathroom_main_water_heater
          - wait_for_trigger:
              - trigger: numeric_state
                entity_id: sensor.bathroom_main_water_heater_power
                below: 150
                for:
                  minutes: 3
            timeout: "02:30:00"
            continue_on_timeout: true
          - action: switch.turn_off
            target:
              entity_id: switch.bathroom_main_water_heater
```

 Paste it from Settings → Automations & scenes → Create automation → Create new automation → three dots → Edit in YAML. Replace the entities with your own. The 05:00 time is an example. The night ends at 06:00 or 07:00 depending on the season and the supplier.

 `night_start` включва релето и чака мощността да падне под 150 W за 3 минути. `top_up` допълва загряването към края на нощта, ако още е нощ и бойлерът е в покой. `day_start` изключва релето. Режимът `restart` прекъсва чакащото изпълнение при нов старт, затова `day_start` спира и недовършено нощно изпълнение.

 Тригерът `numeric_state` сработва при пресичане на прага. Ако бойлерът е топъл и мощността остава под 150 W, пресичане няма и релето остава включено до края на таймаута от 2 часа и 30 минути. Таймаутът е твоят таван за излишно включено реле.

 ## 5. Бутон за ръчно включване

 The night schedule doesn't help when you've run out of hot water in the evening. Ours has a wall button in the bathroom. One automation switches on the same switch on a single press. It is enabled and doesn't depend on the tariff one.

 ```
alias: Bathroom button turns on water heater
triggers:
  - trigger: event
    event_type: shelly.click
    event_data:
      device_id: REPLACE_WITH_BUTTON_DEVICE_ID
      click_type: single
actions:
  - action: switch.turn_on
    target:
      entity_id: switch.bathroom_main_water_heater
```

 В нея няма действие за изключване. Бойлерът се спира от собствения си термостат, а релето остава включено, докато нещо друго го изключи. Ако копираш примера, добави изключване по мощността, както в предишната стъпка.

 Най-лесният начин да вземеш `device_id` е да създадеш автоматизацията през интерфейса с тригер Device.

 Manual control stays whatever the automations do: the relay's switch in Home Assistant, the button, and the water heater's own switch or fuse on the panel. The thermostat is never bypassed. To go back to the usual control, switch the automation off from Settings → Automations.

 ## 6. Колко струва токът

 For a bill you need power, price and accumulation over time. Add the relay's energy sensor in Settings → Dashboards → Energy → Individual devices. That shows how many kWh go to the water heater. For euros you build a chain of helpers:

- Template helper с мощността в kW, умножена по `sensor.home_electricity_price`. Единицата е EUR/h.
- Integral sensor helper върху него, с единица време час. Получаваш натрупани евро.
- Utility meter helper с цикъл Daily върху натрупаните евро. Получаваш разход за днес.

 Така имаш дневния разход само на бойлера. За целия дом ти трябва измерване на общата мощност. Такова описваме в [следващия проект](/bg/projects/tesla-i-boyler-svali-tovara-predi-da-padne-glavniyat-predpazitel/).

 The report at the end of the day is a second automation. Ours works like this: at 23:59 it sends a notification with the day's cost, the kWh used and the change compared with the previous day. A simplified version:

 ```
alias: Daily energy and price report
triggers:
  - trigger: time
    at: "23:59:00"
actions:
  - variables:
      cost: "{{ states('sensor.home_cost_daily') | float(0) }}"
      kwh: "{{ states('sensor.home_energy_daily') | float(0) }}"
      cost_yesterday: "{{ state_attr('sensor.home_cost_daily', 'last_period') | float(0) }}"
      change: >-
        {{ ((cost - cost_yesterday) / cost_yesterday * 100) | round(0) | int if cost_yesterday > 0 else 0 }}
  - action: notify.mobile_app_telefon
    data:
      title: Electricity for the day
      message: "{{ cost | round(2) }} EUR, {{ kwh | round(1) }} kWh, {{ change }}% compared to yesterday"
```

 Замени `sensor.home_cost_daily` и `sensor.home_energy_daily` със своите дневни сензори от предишната верига, а `notify.mobile_app_telefon` with your phone's service (Developer tools → Actions → search for notify).

 ## 7. Известие, когато водата е загряла

 Освен разхода искаш да знаеш и кога водата е готова. Знакът е същият като в другите автоматизации: мощност, която се вдига над праг и после пада за няколко минути.

 At Marto's, the bathroom water heater's power sensor starts an automation when the power goes above 1000 W. It waits for the power to fall below 100 W for 3 minutes, checks that the water heater had been heating for a minimum time, and then sends a notification to two people's phones. The logic is simple: if the water heater ran for a while and then stopped, the water is hot. Choose the minimum heating time from your own power history: short top-ups of a few minutes shouldn't send a notification. If another automation switches the relay off, there is no notification, because the water hasn't finished heating.

 ```
alias: Water heater - the water is hot
mode: single
triggers:
  - trigger: numeric_state
    entity_id: sensor.bathroom_main_water_heater_power
    above: 1000
actions:
  - variables:
      started: "{{ now() }}"
  - wait_for_trigger:
      - trigger: numeric_state
        entity_id: sensor.bathroom_main_water_heater_power
        below: 100
        for: "00:03:00"
    timeout: "06:00:00"
    continue_on_timeout: false
  - condition: template
    # example value: 40 minutes (2400 s); take yours from your own history
    value_template: "{{ (now() - started).total_seconds() >= 2400 }}"
  - action: notify.mobile_app_telefon
    data:
      message: The water is hot.
```

 Постави го по същия начин като тарифната автоматизация и замени обектите и услугата за известие със своите. Праговете вземи от историята на мощността: 1000 W е нивото, над което бойлерът със сигурност нагрява, а 100 W е под нивото, когато термостатът го е изключил.

 ## Провери

- **Нормален случай.** След първата нощ с `night` отвори Settings → Automations → автоматизацията → Traces. Релето трябва да се е включило при смяната на тарифата. Виж и дали `wait_for_trigger` е излязъл по мощността, а не по таймаут.
- **Граничен случай.** Погледни историята на Power. Ако релето е стояло включено до таймаута, прагът ти е твърде нисък или бойлерът вече е бил топъл. Коригирай прага по историята.
- **Известие „водата е загряла“.** Включи бойлера ръчно и гледай мощността. След като нагряването спре и мощността остане под 100 W за 3 минути, идва съобщението. Кратко догряване не трябва да праща такова.
- **Рестарт.** Optionally restart Home Assistant while the relay is switched on by the automation. The run doesn't continue after the restart. The relay stays on until the next tariff change to `day`. The water heater's thermostat still limits the temperature.

 ## If it doesn't work

- **The relay doesn't switch on at the start of the night.** Tariff сензорът е `unavailable` или `unknown`, or it hasn't gone through `night`. Look at it in Developer tools → States and in the integration's settings.
- **The relay doesn't switch off.** The power doesn't cross the threshold from above to below. Look at the Power history and compare with the threshold. The sensor may be `unavailable` , ако релето е изгубило Wi-Fi.
- **Релето се изключва твърде рано.** Прагът е над мощността, която бойлерът тегли в края на загряването. Вдигни времето на `for` или свали прага.
- **The relay doesn't appear in Home Assistant.** Провери дали е в същата мрежа като Home Assistant и дали е добавено в интеграцията Shelly.
- **Известие „водата е загряла“ няма никога.** The 1000 W or 100 W threshold doesn't match the real power. Look at the Power chart and correct the values.
- **Известие идва след всяко догряване.** Добави или вдигни минималното време на нагряване, както в примера.
- **Мощността е 0 при топла вода.** Термостатът е изключил нагревателя. Това е нормално; провери само дали самото реле е включено.
- **The amount doesn't match the invoice.** Сензорът за цена покрива регулирания пазар. Свободен пазар, договор с други компоненти или друг доставчик дават друга сметка.

 ## Следващ проект

 Когато в къщата работят едновременно бойлер, фурна и зарядно за кола, проблемът вече не е тарифата, а предпазителят. Виж как ограничаваме товара по стъпки: [Tesla и бойлер: свали товара, преди да падне главният предпазител](/bg/projects/tesla-i-boyler-svali-tovara-predi-da-padne-glavniyat-predpazitel/).

 ## Източници

 Works at Marto's: the button in the bathroom (the automation is enabled), the daily report at 23:59 (last triggered on 18 October 2026) and the hot-water notification.

- [ЕНЕРГО-ПРО: цени и тарифи, часове на дневната и нощната тарифа](https://www.energo-pro.bg/en/bitovi-klienti/ceni-tarifi)
- [avataar/bg_electricity_regulated_pricing: интеграция за тарифата и цената](https://github.com/avataar/bg_electricity_regulated_pricing)
- [Shelly: Ogemray smart relay 25A, данни и схема](https://kb.shelly.cloud/knowledge-base/ogemray-smart-relay-25a)
- [Home Assistant: интеграция Shelly](https://www.home-assistant.io/integrations/shelly/)
- [Home Assistant: тригери, включително numeric_state](https://www.home-assistant.io/docs/automation/trigger/#numeric-state-trigger)
- [Home Assistant: wait_for_trigger](https://www.home-assistant.io/docs/scripts/#wait-for-trigger)
- [Home Assistant: режими на автоматизациите](https://www.home-assistant.io/docs/automation/modes/)
- [Home Assistant: Energy и отделни устройства](https://www.home-assistant.io/docs/energy/individual-devices/)
- [Home Assistant: Integral sensor](https://www.home-assistant.io/integrations/integration/)
- [Home Assistant: Utility meter](https://www.home-assistant.io/integrations/utility_meter/)
- [HACS: добавяне на custom repository](https://www.hacs.xyz/docs/faq/custom_repositories/)