[GUIDE] Australian Electricity Demand tariffs (e.g AGL)

Yep, good thinking. it’ll work for either.

I’m not going to post it but instead link you to where i sourced it from which I think is better, as it’s been updated and improved since i did mine. Solaredge Modbus Configuration for Single Inverter and Battery - Share your Projects! - Home Assistant Community (home-assistant.io)
My cost sensors and everything started with the work from the previous version of that post, i then split out my cost file as making it work with demand tariffs added a fair few lines and I just liked organising costs into it’s own package.

Yes, kinda.

Water is easy, although i have not figured out my personal daily supply charge yet so it’s only showing me usage on my dashboard for now. the cost is there tough.

template:
  - sensor:
      - name: Water Consumption
        unique_id: water_consumption
        state: "{{ states('counter.water_counter') | float(0) * 0.5 }}"
        unit_of_measurement: "L"
        icon: mdi:water-pump
        device_class: water
        state_class: total_increasing

      - name: Water Import Rate
        unique_id: water_import_rate
        icon: mdi:cash-minus
        unit_of_measurement: "AUD/L"
        state: "0.00239"
      - name: Water Supply Charge
        unique_id: water_supply_charge
        icon: mdi:cash-minus
        unit_of_measurement: "AUD/L"
        state: "0"

      - name: "Water Total Cost Daily"
        unique_id: water_total_cost_daily
        icon: mdi:currency-usd
        unit_of_measurement: $
        state_class: total
        device_class: monetary
        state: >
          {% set supply = states('sensor.water_supply_charge') | float(0) %}
          {% set usage = states('sensor.water_consumption_daily') | float(0) * states('sensor.water_import_rate') | float(0) %}
          {{ (supply + usage) | round(2) }}
      - name: "Water Total Cost Monthly"
        unique_id: water_total_cost_monthly
        icon: mdi:currency-usd
        unit_of_measurement: $
        state_class: total
        device_class: monetary
        state: >
          {% set supply = states('sensor.water_supply_charge') | float(0) * now().day %}
          {% set usage = states('sensor.water_consumption_monthly') | float(0) * states('sensor.water_import_rate') | float(0) %}
          {{ (supply + usage) | round(2) }}
      - name: "Water Total Cost Yearly"
        unique_id: water_total_cost_yearly
        icon: mdi:currency-usd
        unit_of_measurement: $
        state_class: total
        device_class: monetary
        state: >
          {% set supply = states('sensor.water_supply_charge') | float(0) * ( states('sensor.days_passed_in_year') | int(0) + 1 ) %}
          {% set usage = states('sensor.water_consumption_yearly') | float(0) * states('sensor.water_import_rate') | float(0) %}
          {{ (supply + usage) | round(2) }}

utility_meter:
  water_consumption_daily:
    source: sensor.water_consumption
    name: Water Consumption Daily
    cycle: daily
  water_consumption_monthly:
    source: sensor.water_consumption
    name: Water Consumption Monthly
    cycle: monthly
  water_consumption_yearly:
    source: sensor.water_consumption
    name: Water Consumption Yearly
    cycle: yearly

Currently my gas.yaml is identical to that. Gas for me is billed at 3 rates, first xxxxMJ, next yyyyMJ and the rest zzzzMJ, but the bill doesnt make sense because my total usage last bill was less than xxxx yet i was charged some gas at all three rates. Once i work that out i’ll implement the tiers. For now i just use the same as above with one extra conversion for converting between m3 and MJ.

template:
  - sensor:
      - name: Gas Consumption M3
        unique_id: gas_consumption_m3
        state: "{{ states('counter.gas_counter') | float(0) * 0.01 }}"
        unit_of_measurement: "m³"
        icon: mdi:fire
        device_class: gas
        state_class: total_increasing
      - name: Gas Consumption MJ
        unique_id: gas_consumption_mj
        state: "{{ states('sensor.gas_consumption_m3') | float(0) * 37 }}"
        unit_of_measurement: "MJ"
        icon: mdi:fire
        device_class: gas
        state_class: total_increasing

      - name: Gas Import Rate MJ
        unique_id: gas_import_rate_mj
        icon: mdi:cash-minus
        unit_of_measurement: "AUD/MJ"
        state: "0.031218"
      - name: Gas Import Rate M3
        unique_id: gas_import_rate_m3
        icon: mdi:cash-minus
        unit_of_measurement: "AUD/m³"
        state: "{{ states('sensor.gas_import_rate_mj') | float(0) * 37 }}"
      - name: Gas Supply Charge
        unique_id: gas_supply_charge
        icon: mdi:cash-minus
        unit_of_measurement: "AUD"
        state: "0.65142"

      - name: "Gas Total Cost Daily"
        unique_id: gas_total_cost_daily
        icon: mdi:currency-usd
        unit_of_measurement: $
        state_class: total
        device_class: monetary
        state: >
          {% set supply = states('sensor.gas_supply_charge') | float(0) %}
          {% set usage = states('sensor.gas_consumption_daily') | float(0) * states('sensor.gas_import_rate_m3') | float(0) %}
          {{ (supply + usage) | round(2) }}
      - name: "Gas Total Cost Monthly"
        unique_id: gas_total_cost_monthly
        icon: mdi:currency-usd
        unit_of_measurement: $
        state_class: total
        device_class: monetary
        state: >
          {% set supply = states('sensor.gas_supply_charge') | float(0) * now().day %}
          {% set usage = states('sensor.gas_consumption_monthly') | float(0) * states('sensor.gas_import_rate_m3') | float(0) %}
          {{ (supply + usage) | round(2) }}
      - name: "Gas Total Cost Yearly"
        unique_id: gas_total_cost_yearly
        icon: mdi:currency-usd
        unit_of_measurement: $
        state_class: total
        device_class: monetary
        state: >
          {% set supply = states('sensor.gas_supply_charge') | float(0) * ( states('sensor.days_passed_in_year') | int(0) + 1 ) %}
          {% set usage = states('sensor.gas_consumption_yearly') | float(0) * states('sensor.gas_import_rate_m3') | float(0) %}
          {{ (supply + usage) | round(2) }}

utility_meter:
  gas_consumption_daily:
    source: sensor.gas_consumption_m3
    name: Gas Consumption Daily
    cycle: daily
  gas_consumption_monthly:
    source: sensor.gas_consumption_m3
    name: Gas Consumption Monthly
    cycle: monthly
  gas_consumption_yearly:
    source: sensor.gas_consumption_m3
    name: Gas Consumption Yearly
    cycle: yearly