Czech energy cost rate sensor

Grinco, Bojkas,

I’m still struggling with this, I can’t even set up currency conversion according to previous posts. The sensor still shows 0.00 CZK/kW. Please help me…

Here is my code:

  - platform: openexchangerates
    api_key: YOUR_API_KEY
    quote: EUR
    
  - platform: ote_rate
    
  - platform: template
    sensors:
      czk_price_per_kwh:
        friendly_name: "Current Electricity Price"
        value_template: >-
          {% set CURRENT_PRICE = states("sensor.current_ote_energy_cost") | float(0) %}
          {% set EUR_CZK = states("sensor.exchange_rate_sensor") | float(0) %}
          {{- (CURRENT_PRICE * EUR_CZK / 1000) | round(3) -}}
        unit_of_measurement: "CZK/kWh"

Here is the result:

Here is my code:

  - platform: openexchangerates
    api_key: YOUR_API_KEY
    quote: CZK
    
  - platform: ote_rate
    
  - platform: template
    sensors:
      czk_price_per_kwh:
        friendly_name: "Current Electricity Price"
        value_template: >-
          {% set CURRENT_PRICE = states("sensor.current_ote_energy_cost") | float(0) %}
          {% set EUR_CZK = states("sensor.exchange_rate_sensor") | float(0) %}
          {{- (CURRENT_PRICE * EUR_CZK / 1000) | round(3) -}}
        unit_of_measurement: "CZK/kWh"

Here is the result:

Screenshot_7

Hello, i have small problem. I have automation charging/discharging battery. Update of cost rate sensor sometimes not work. And battery stop charging/discharging. After few minutes/seconds its ok. Its possible to change update interval?

2022-09-01 01:41:06 WARNING (MainThread) [homeassistant.components.sensor] Updating ote_rate sensor took longer than the scheduled update interval 0:00:30

2022-09-01 03:01:16 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.current_ote_energy_cost is taking over 10 seconds

Thanks for answer.

Any idea how to get NT and VT rates please:?

OTE throttles or times out some times. I’ll see if I can override the “unavailable” with previous value if it times out. In the meantime, try using the “For” parameter in the trigger configuration for your automation.

The tarif is specific to your distribution network and “distribuční sazba”. It’s not based on the data from OTE. Check your contract pricelist and configure an utility meter with two tariffs: peak and off peak. I have a template sensor that calculates the current price including the cost of energy transport.

Here’s the integration: Utility Meter - Home Assistant

My config snippet:

  - platform: template
      adjusted_electricity_price:
        friendly_name: "Adjusted Electricity Price"
        value_template: >-
          {% set CURRENT_PRICE = states("sensor.current_electricity_price") | float(default=none) %}
          {% set PEAK_PRICE = 1.81413 %}
          {% set OFFPEAK_PRICE = 0.17961 %}
          {% set TARIFF = states("utility_meter.grid_energy") %}
          {% if TARIFF == "peak" %}
             {% set ADJUSTED_PRICE = CURRENT_PRICE + PEAK_PRICE %}
          {% else %}
             {% set ADJUSTED_PRICE = CURRENT_PRICE + OFFPEAK_PRICE %}
          {% endif %}
          {{- ADJUSTED_PRICE | round(3) -}}
        unit_of_measurement: "CZK/kWh"

PEAK_PRICE and OFFPEAK_PRICE are based on the contract with my energy provider. Generally, if you’re not having a smart meter that reports your usage in realtime the current price doesn’t matter - you could just create a template sensor setting the peak/offpeak price based on your cost and the state of the utility meter (called “select” now).

Hello everyone,
Maybe a stupid question, but where do I get YOUR_API_KEY?

See open exchange rate integration docs: Open Exchange Rates - Home Assistant

1 Like

I got the API KEY but it still doesn’t work.

Error loading /config/configuration.yaml: mapping values are not allowed here
in “/config/configuration.yaml”, line 48, column 12

#OTE rate
platform: openexchangerates
api_key: 3ef899c74------------------bb22f04ce
quote: CZK

  • platform: ote_rate

  • platform: template
    sensors:
    czk_price_per_kwh:
    friendly_name: “Current Electricity Price”
    value_template: >-
    {% set CURRENT_PRICE = states(“sensor.current_ote_energy_cost”) | float(0) %}
    {% set EUR_CZK = states(“sensor.exchange_rate_sensor”) | float(0) %}
    {{- (CURRENT_PRICE * EUR_CZK / 1000) | round(3) -}}
    unit_of_measurement: “CZK/kWh”

I have made changes to use Spot prices (vnitrodenni trh), are you able to integrate it? To have both options or set either of those values?

          ........
          cost_history = dict()
          history_index = 0
          cost_string = "Cena (EUR/MWh)"
          value_name = "V\u00e1\u017een\u00fd pr\u016fm\u011br cen (EUR/MWh)"
          hour_string = "Hodina"
          cost_data = "https://www.ote-cr.cz/cs/kratkodobe-trhy/elektrina/vnitrodenni-trh/@@chart-data"

          date = datetime.datetime.now()
         ........


         ........
          for values in json['data']['dataLine']:
              if values['title'] == value_name:
                  for data in values['point']:
                     history_index = int(data[hour_axis])-1
                     cost_history[history_index] = float(data.get(cost_axis, '0'))
                  current_cost = cost_history[date.hour]
         ........

Have a nice day