-
Notifications
You must be signed in to change notification settings - Fork 0
Home Automation and HydroQC
This page is intended specifically for users of Home Automation with the HydroQC add-on.
TL;DR Automatic calculation of the optimal energy target to be attained, but not exceeded, during the critical anchor period in order to maximise credit dollars.
It is possible to maximise winter credit dollars offered by Hydro Quebec by automating energy consumption before and during winter peak demand events. This can be done without wasteful energy techniques that some clever, but dubious customers have resorted to.
The goal of the Winter Credit Option was to encourage energy consumers to reduce their energy consumption during times of high demand, typically due to very cold winter conditions across the province.
Energy reduction is a matter of personal preference. Hydro Quebec recommends reducing the thermostat setting by 1-2 degrees during the high demand period and preheating the home by 1-2 degrees just prior to the peak demand event. This conservative method keeps home temperatures comfortable, but results in only a few dollars of credit.
More aggressive energy reduction, such as shutting down all energy consumption during the peak event, can easily result in a single credit of $20 to $40, depending on what you average energy usage is. Of course this means your home might be 16C instead of the usual 20C when you get up.
By moderately modifying one's energy consumption over the longer term, such as reducing consumption during normal anchor periods and increasing consumption during critical anchor periods, it is possible to maximise the credit dollars for a peak demand event.
The critical anchor period becomes a key variable in attaining maximum credit dollars. Setting a specific target, in kWh, for this period, and not exceeding that target, can make a huge difference on the credit dollars calculated.
Here is where home automation comes in. The following SQL sensors and ESPHome automation configuration can automatically calculate the specific kWh target for the critical anchor period and enable or disable various energy devices in the home to meet the target. Additionally, the same automation can be used to reduce energy consumption during the peak demand event.
Wasting energy consumption during a critical anchor (overheating while leaving the windows open) solely for purpose to increase credit dollars is strongly discouraged. It is entirely against the principal of energy conservation, and it may lead to other unexpected issues (fire, water damage, freezing) or the loss of the credit dollars if Hydro Quebec considers your actions abusive.
One of the best methods to adjusting the critical anchor target is a home EV charger. An EV charger typically draws 7.5 kW/h, or more. Over a 3 hour period, like an AM critical anchor period, it would consume easily 23 kWh. Each kWh during the critical anchor can achieve a net savings of $0.457. So, simply charging an EV, at night, during the critical anchor, returns a net credit of over $10.53. Most EV chargers can be controlled by Home Assistant. Furthermore, charging your EV at night is actually recommended by Hydro Quebec.
The hydro-qc add-on and its automation scripts for Home Assistant already lay the groundwork for the above method. What it lacks however, is calculating the optimal energy target to be used in the critical anchor period. The following SQL sensors, ESPHome sensors and Home Assistant automations do just that.
-
It is assumed your Home Assistant is using SQLite. If you have another database, these queries may work but have not been tested on any other database except SQLite. SQLite is the default database that is installed from the Home Assistant image available via Raspberry Pi Imager.
-
Install the SQLite Web app (formerly known as add-on) into Home Assistant. More info here. Ensure you add it to your sidebar.
-
Install the SQL Integration into Home Assistant. Instructions can be found here.
-
Before using these queries, you will need to modify Home Assistant configuration.yaml to extend sensor history to 60 days. Without this modification, the queries may not identify previous critical events days when calculating averages. Add this code block to your HA configuration.yaml
recorder:
purge_keep_days: 60This query is not part of the automation, but a useful tool to fetch HQ hourly consumption directly from the HA database.
- The query is called Get HQ hours.
- Download and save, or copy/paste, the query.
- Select SQLite Web from your sidebar.
- Find the query box.
- Copy the downloaded query into the box and click Execute.
- Your hourly consumption should be neatly formatted in rows for dates, and columns for 24 hours.
- Click on Export CSV in SQLite to download the formatted data for Excel.
- Ensure you have installed the official SQL integration into Home Assistant.
- Three queries have been prepared to create the following:
- Create each SQL sensor using the SQL integration and copy the query text to each.
- Ensure the output column is set to "avg"
- In advanced options, set the unit of measurement to "kWh"
- Save your SQL Sensor.
- Test to see that your SQL sensor returns valid data.
- For the purposes of the ESPHome example below, you should name your sensors thusly:
- WCO Anchor Avg (SQL query showing the current anchor average for today.)
- WCO Peak Avg (SQL query showing the current peak average for today.)
- WCO Critical Avg (SQL query showing the critical peak average for the season, to date.)
Here is an example of the WCO Anchor Avg installed as a SQL sensor in Home Assistant, including the sensors displayed on a card in the dashboard.
This section explains the wco.yaml custom package that can be added into any ESPHome configuration that monitors partial or whole house energy consumption.
- To install, simply copy the wco.yaml to your /config/esphome directory or subdirectory.
- Modify your main ESPHome yaml configuration that contains your whole house energy monitor, by including the wco.yaml as a package. Here is an example of my Power Panel ESPhome configuration, running on a custom PCB with an ESP32C3.
substitutions:
devicename: epanel
friendly_name: "Power Panel"
yaml_version: "4.5.0"
my_version: "Y-${yaml_version} B-${base_version} D-${device_version} P-${pkg_version}"
packages:
base: !include common/base.yaml
device_base: !include common/device_esp32s3_n8r8.yaml
other: !include common/wco.yaml #<---------------------- include this
- This package relies on a total_daily_sensor called "total_Wh". This should represent your whole house consumption. Here is an example of mine in the same Power Panel yaml.
sensor:
# Create a sum kW for both phases (two CTs on 120-0-120 mains)
- platform: template
id: totalwatts
name: "Total Power"
accuracy_decimals: 1
unit_of_measurement: 'W'
update_interval: 10s
lambda: !lambda 'return id(phase1watts).state + id(phase2watts).state;'
# Calculate cumulative usage per day
- platform: total_daily_energy
name: "Total Daily Energy"
power_id: totalwatts
id: total_Wh # <-------------------------------this ID is used in wco.yaml
If the id for your sensor total_daily_energy is different, then simply replace the id "total_Wh" with your id in the wco.yaml.
What if you don't have a whole house energy sensor, but you do have energy sensors for main heating, EV charging, and/or other high energy consumption devices? You can still use this custom automation, simply create one total_daily_energy sensor that sums all your various energy sensors and refer to it in the wco.yaml by replacing your id with the total_Wh in the package yaml. Further down are instructions on how to estimate your untracked energy consumption and still use this custom automation to automatically set and attain your critical anchor target for maximum savings and credit dollars.
- Once you ESPHome device is recompiled, you will have additional entities available to you in Home Assistant. These include:
- A slider, called Critical Peak Estimate
- This slider allows you to set what you think you will use as kWh during the upcoming critical demand event. If you leave this slider at zero, then the SQL query "WCO Critical Peak Average" will be used instead.
The SQL query "WCO Critical Peak Average" finds your average whole house energy consumption during previous critical demand events. It does this from HQ historical data that is downloaded automatically by the hydro-qc add-on. At the beginning of the winter season, this sensor may not return any data, so you may need to use the slider to set an estimate prior to the first season peak demand event.
- A slider, called Untracked kWh
- This slider, normally left at zero, is only used if you do not have whole house energy monitoring. If you only have partial energy monitoring, then use the slider to estimate your untracked consumption during a critical anchor period.
- A value sensor, in kWh, called HQ Critical Anchor Target
- This sensor is automatically calculated for the next upcoming anchor (critical or not). The value represents the best target to achieve, but not surpass, if the anchor precedes a critical demand event.
- A value sensor, in kWh, called HQ Critical Anchor Energy
- This sensor is activated at the start of the critical anchor period and increments your total home energy consumption.
- A button, called TEST - Start Critical Anchor Energy Monitoring
- To use the new sensors in automation, create an HA automation that triggers when HQ Critical Anchor Energy hits HQ Critical Anchor Target. At this point one wants to shutdown all monitored energy consumption. This will deliver the maximum WCO credit dollars. It is just that simple.
Here is an example of the automation monitoring the critical anchor energy consumption. The script called "CLIMATE - Turn off heating" could also include turning off any other major energy consumers, like an EV charger, auxiliary room heating (garage, solarium, spa).
The target sensor uses the SQL sensors for anchor average consumption and peak average consumption to determine two critical anchor targets. The first target is based on the assumption you will not exceed a curtailed energy of 40 kWh, without being severely penalised. The second target is based on exceeding 40 kWh of curtailed energy and calculating your maximum savings before any futher energy consumption during the critical anchor has no effect on the credit dollars. It compares the actual credit dollars of both methods and automatically chooses the most advantageous method based on your energy consumption history as well as your estimates, if applicable, for peak demand consumption and untracked energy consumption.