Skip to content

Instantly share code, notes, and snippets.

@swilson
swilson / tou.yaml
Created June 4, 2018 20:33
Home Assistant Ontario Hydro Time-Of-Use sensor
- platform: template
sensors:
hydro_rate:
# TODO account for holidays
value_template: >-
{% if now().weekday() > 4 or now().hour < 7 or now().hour >= 19 %}
off_peak
{% elif now().hour >= 7 and now().hour < 11 %}
{% if now().month >= 5 and now().month <= 10 %}
mid_peak