Energy Price Threshold


I was manage to set fixed price for energy consumption but not able to add threshold as per our tariffs.
Our tariffs are about 0.08USD till 200kWh and 0.09USD over 200kWh based on Monthly usage. How can I setup this logic, there are no documentation for this((

Also I need consumption for Daily and Monthly usage as kWh and USD, do I need Utility Meter Helper for this ?

Regards and thanks beforehand.

Anyone to help?

You can solve this using templates.

You haven’t supplied a lot of information, so I need to use a few assumptions, for example I assume you have an entity which tracks the total energy used for the current month, let me call it “total_energy”

create a template in configuration.yaml. You can test the template using the developer tools. You create a new entity using the template:

    - sensor:
        - name: "current_price"
          unit_of_measurement: "$/kWh"
          state: >
            {% set total_energy_this_month = states('sensor.total_energy') | float %}
            {% if total_energy_this_month < 200  %}
              {{0.08 | float}}
            {% else %}
              {{0.09 | float}}
            {% endif %}

This creates a new sensor named “current_price” which either has a value of 0.08 or 0.09. You can use this in the energy dashboard to calculate the price.