I’ve been making some use of Energy Management in Home Assistant. I have several Samsung smart plugs reporting energy information.

My electricity tariff breaks down to four time windows:

Day rate   08:00 - 17:00 : 33c/KWh
Peak rate  17:00 – 19:00 : 35c/KWh
Day rate   19:00 - 23:00 : 33c/KWh
Night rate 23:00 - 08:00 : 25c/KWh

Tracking price using an entity is supported. I chose to write an automation which makes use of MQTT Discovery to present the price. It updates hourly:

alias: Electricity Price
description: ''
trigger:
  - platform: time_pattern
    minutes: '1'
condition: []
action:
  - service: mqtt.publish
    data:
      topic: homeassistant/sensor/electricityPrice/config
      payload: >-
        { "name":"electricityPrice",  "unique_id":"electricityPrice", 
        "state_topic":"custom/electricityPrice", 
        "unit_of_measurement":"EUR/kWh",  "value_template": "" }}"}
      retain: true
  - service: mqtt.publish
    data:
      topic: homeassistant/sensor/electricityTariff/config
      payload: >-
        { "name":"electricityTariff",  "unique_id":"electricityTariff", 
        "state_topic":"custom/electricityPrice",  "value_template": "" }}"}
      retain: true
  - choose:
      - conditions:
          - condition: time
            after: '08:00:00'
            before: '17:00:00'
        sequence:
          - service: mqtt.publish
            data:
              topic: custom/electricityPrice
              payload: '{"tariff":"day","rate":0.33}'
      - conditions:
          - condition: time
            after: '17:00:00'
            before: '19:00:00'
        sequence:
          - service: mqtt.publish
            data:
              topic: custom/electricityPrice
              payload: '{"tariff":"peak","rate":0.35}'
      - conditions:
          - condition: time
            after: '19:00:00'
            before: '23:00:00'
        sequence:
          - service: mqtt.publish
            data:
              topic: custom/electricityPrice
              payload: '{"tariff":"day","rate":0.33}'
      - conditions:
          - condition: time
            after: '23:00:00'
            before: '08:00:00'
        sequence:
          - service: mqtt.publish
            data:
              topic: custom/electricityPrice
              payload: '{"tariff":"night","rate":0.25}'
    default: []
mode: single