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

question. regarding the below utility meters do i need them considering i only have 1 demand tariff

utility_meter:
  electricity_imported_power_daily:
    source: sensor.electricity_imported_power_kwh
    name: Electricity Imported Power Daily
    cycle: daily
    tariffs:
      - peak
      - shoulder
      - off-peak

  electricity_imported_demand:
    source: sensor.electricity_imported_power_kwh
    name: Electricity Imported Demand
    cron: 0,30 * * * *
    tariffs:
      - high-demand
      - low-demand
      - no-demand

  electricity_exported_power_daily:
    source: sensor.electricity_exported_power_kwh
    name: Electricity Exported Power Daily
    cycle: daily

hey again, i also dont think i need this automation as i only have the 1 rate tariff

alias: Set Electricity Tariff
description: ''
trigger:
  - platform: time
    at: '07:00:00'
  - platform: time
    at: '14:00:00'
  - platform: time
    at: '20:00:00'
  - platform: time
    at: '22:00:00'
  - platform: homeassistant
    event: start
condition: []
action:
  - service: select.select_option
    data:
      option: >-
        {% set t = now() %}  {%- if t.hour >=14 and t.hour <20 and
        is_state('binary_sensor.workday_sensor', 'on') %}
          peak
        {%- elif t.hour >= 22 or t.hour < 7 -%}
          off-peak
        {%- else -%}
          shoulder
        {%- endif -%}
    target:
      entity_id:
        - select.electricity_imported_power_daily
mode: single

it’s just a matter of making a new yaml file in the packages folder called anything.yaml and pasting the text.

In short, Yes, you need the utility meters.

You could remove the tarrifs of the usage one and just have a single rate. You need at least two tarrifs for the demand one, being demand and no-demand periods.

You’ll have to edit the cost sensors to accommodate the changed entity names

Depending on what you find more challenging though, you don’t need to remove anything, as long as you set the peak shoulder and off peaks rates at the top to the same number and the high demand and low demand to the same number it will effectively be a single rate and minimal changes required to my package.

You won’t need that particular automation you quoted no. I have the same rate for peak off-peak and shoulder myself but agl still defines time windows so I decided to future proof the package in case I stop having a flat usage rate

yeah i realised i needed them after going through

i might restart again based on your comments,

1 Like

hey man

this is what i was saying when i add the .yaml file to my existing packages folder

I get this error

Integration error: energy_costs - Integration 'energy_costs' not found.

This is my .yaml config

Ahh yeah I see. Those aren’t really packages. They are just included files of each particular integration which happen to be located in a folder named packages.

You need this to make pakages the way I have

packages: !include_dir_named packages

But that would conflict with your existing setup.

So maybe make a new folder called package and put energy costs in there.

And this instead

packages: !include_dir_named package

Edit: fixed typo with packages

yeah tried that, not working either. Sorry it was a struggle to understand this concept at the beginning

homeassistant:
  package: !include_dir_named package

Really sorry mate, seems my guide had a typo. Just checked my own config and the first one needs to be plural packages, the second is whatever folder you make.

packages: !include_dir_named package

Dont apologise for helping me out mate!
I think we are good!

are you allowed more of the same sensor type integration?

I have time_date setup under sensor yaml.

- platform: time_date
  display_options:
    - "time"
    - "date"
    - "date_time"
    - "date_time_utc"
    - "date_time_iso"
    - "time_date"
    - "time_utc"
    - "beat"

Spoke too soon, cant find any of the entities. Is this ok??

Then you should delete it from the energy_costs.yaml.

Not sure about the / actually. But your folder is called packages not package so try packages/ instead

If that doesnt work you almost certainly can use packages/agl_rates
Maybe rename agl_rates to packages and use packages/packages for the cleanest solution without requiring you to change the location of all your integration yaml files, and allow subsequent packages files to all be in that folder.

ok the only things thats not working is the template sensors that have numerical state??

Try removing the comments.

nah did nothing lol
i could just do this??

state: >
          {{ states('input_number.electricity_import_rate_high_demand') |float(0) }}

Yes should work fine.

The error is because they need quotes around the number. I rewrote the whole package for this post and tried to clean it up also, guess those were mistaken by accident. I’ll correct it now in the OP too.

i have no idea about yaml code, yet i have got this far!

Looks like you have got plenty going on, well done.

haha yeah i have heaps of crap added, not a lot of automations to be honest

SgtBatten. have you considered to putting your code up on GitHub? It would make it much easier to see it all in one place, read it and also allow you to edit, with change tracking and ability to allow others to suggest changes and reject/approve them)?

For example, here’s the repository I recently setup to allow me to start putting up some integrations and ESPHome code (I still have to get time to edit those btw to allow friends to just add a single line in their esphome config for their gas/water meter and have it pull the latest code down and compile ready to flash).

See: Home-Assistant/energy_tariff_TOU_solar_analytics.yaml at b117f80b018530ffae6f10b23221e797c1e6632c · Roving-Ronin/Home-Assistant · GitHub

hey again, do i need this automation as its only 1 tariff?

- alias: Set Electricity Tariff
    description: ''
    trigger:
      - platform: time
        at: '07:00:00'
      - platform: time
        at: '14:00:00'
      - platform: time
        at: '20:00:00'
      - platform: time
        at: '22:00:00'
      - platform: homeassistant
        event: start
    condition: []
    action:
      - service: select.select_option
        data:
          option: >-
            {% set t = now() %}  {%- if t.hour >=14 and t.hour <20 and
            is_state('binary_sensor.workday_sensor', 'on') %}
              peak
            {%- elif t.hour >= 22 or t.hour < 7 -%}
              off-peak
            {%- else -%}
              shoulder
            {%- endif -%}
        target:
          entity_id:
            - select.electricity_imported_power_daily
    mode: single

No, just make sure that one of them is actually set for select.electricity_imported_power_daily
in developer tools