Thank you @del13r for your amazing guide so far.
I’ve been putting together my dashboard using this guide and also parts of your old guide from 2021 - looking forward to more updates.
I’m a relatively newbie with Home assistant and YAML, but using a combination guides from here, YouTube and ChatGPT, I’ve built a functional dashboard to suit my purposes so far.
I’ve run into a couple of snags and wondering if anyone could shed some light…
-
I’ve been trying to use your old code to generate a sensor for Corrected Solar Power/Energy, as my Envoy generates ~20-25W overnight whilst the sun is down. Using the old Code you’ve provided in your 2021 guide, it results in my solar production numbers being dramatically different compared to the numbers provided by the Envoy integration directly.
-
My energy retailer similarly has a daily supply charge in addition to a stepped tariff (i.e. above/below 30kWh of import per day). It also has a TOU tariff for the solar feed in. Whilst my export tariff works well, I’ve been trying to create a sensor/entity to track the daily import cost as a “total” cost. Whilst the sensor seems to work and track my total daily cost (I can output to a graph and it seems to be tracking appropriately), for the life of me I can’t select it as an option in the energy dashboard to represent the “total cost” of energy import.
Any feedback on the YAML is welcome (it has been generated by ChatGPT).
sensor:
- platform: template
sensors:
export_tariff:
friendly_name: "Export Tariff"
unit_of_measurement: "AUD/kWh"
value_template: >-
{% set current_hour = now().hour %}
{% set peak_start_hour = 16 %}
{% set peak_end_hour = 21 %}
{% set offpeak_start_hour = 10 %}
{% set offpeak_end_hour = 14 %}
{% set shoulder_periods = [(21, 24), (0, 10), (14, 16)] %}
{% set peak_tariff = 0.106 %}
{% set offpeak_tariff = 0.039 %}
{% set shoulder_tariff = 0.055 %}
{% if current_hour < 24 %}
{% if peak_start_hour <= current_hour < peak_end_hour %}
{{ peak_tariff }}
{% elif offpeak_start_hour <= current_hour < offpeak_end_hour %}
{{ offpeak_tariff }}
{% else %}
{% for start_hour, end_hour in shoulder_periods %}
{% if start_hour <= current_hour < end_hour %}
{{ shoulder_tariff }}
{% set shoulder_tariff = 0.0 %}
{% break %}
{% endif %}
{% endfor %}
{% endif %}
{% endif %}
energy_cost:
friendly_name: "Daily Energy Cost"
unit_of_measurement: "AUD"
value_template: >-
{% set daily_import_kWh = states('sensor.daily_energy_import') | float %}
{% set supply_charge = 0.93 %}
{% set tariff_below_30_kWh = 0.198 %}
{% set tariff_above_30_kWh = 0.242 %}
{% if daily_import_kWh < 30 %}
{{ (daily_import_kWh * tariff_below_30_kWh) + supply_charge }}
{% else %}
{{ (30 * tariff_below_30_kWh) + ((daily_import_kWh - 30) * tariff_above_30_kWh) + supply_charge }}
{% endif %}