Skip to content

Instantly share code, notes, and snippets.

@Tugzrida
Created February 18, 2024 04:16
Show Gist options
  • Save Tugzrida/cfa66c2d3500e9cf827d2a3d4d981a9c to your computer and use it in GitHub Desktop.
Save Tugzrida/cfa66c2d3500e9cf827d2a3d4d981a9c to your computer and use it in GitHub Desktop.
Ausgrid tariff definitions for Home Assistant
template:
- sensor:
- name: "Current power tariff"
unique_id: sensor.current_power_tariff
state: >
{% if now().weekday() not in (5, 6) and (
(now().month in (11, 12, 1, 2, 3) and 14 <= now().hour <= 19)
or
(now().month in (6, 7, 8) and 17 <= now().hour <= 20)
)-%}
Peak
{%- elif 7 <= now().hour <= 21 -%}
Shoulder
{%- else -%}
Off-peak
{%- endif %}
template:
- sensor:
- name: "Current power tariff"
unique_id: sensor.current_power_tariff
state: >
{% if now().weekday() not in (5, 6) and (
(now().month in (9, 10, 11, 12, 1, 2, 3, 4, 5) and 14 <= now().hour <= 19)
or
(now().month in (6, 7, 8) and 17 <= now().hour <= 20)
)-%}
Peak
{%- else -%}
Off-peak
{%- endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment