Handling electricity dynamic pricing - Flex D

Here in the Quebec province of Canada, the government started emphasising on energy conservation. Our national electricity provider Hydro-Quebec created incentives to better consume energy. One is a flexible rate "Flex D" that promote shifting nonessential electricity consumption to outside winter's peak periods. In few words, the rate Flex D is lower than the base rate outside winter peak events and higher during peaks. Another winter credit program exists. Both programs have this thing in common: if you reduce your consumption during the peak events, you save money.

I'm pretty sure this kind of program exists elsewhere in the world. In fact you may all be more advanced than us in power saving. Since our nationalized service produces almost exclusively from hydropower and gives us low rates, we tend to waste...

I thought of creating this topic so that we can share on how Hubitat help us handle this dynamic pricing.

@Canada #Energy #Heating

Here are few of my tweaks to move my consumption (mostly heating and water heating) out of peak events.

Control variable
First thing, I created a global boolean variable PeriodePointe to indicate if a peak event is currently active. I could have use a virtual switch as well. I currently flip that variable ON/OFF manually when I receive a peak notification. Note that to simplify things I always handle things like there's two events in the day: 6:00 to 9:00 and 16:00 to 20:00.

My variable is displayed and can be edited in a dashboard:
Variable dash

Schedulers
I drive all my thermostats with thermostat schedulers, following on my hub modes. During peak hours, I simply turn the schedulers Eco mode ON. This allows me to easily define different peak offsets in some parts of the house and edit these settings without changing my rules.

Rules
I have 3 rules:

  • One that runs before the peak events to pre-heat the house;
  • At period begin, set all schedulers in Eco Mode and turn OFF water heater;
  • At period end, set back every thing to normal mode,

Rule 1:
Rule1

Rule 2:
Rule2

Rule 3:
Rule3

VoilĂ !

A word on my devices
All my thermostats are Sinopé Zigbee. Work very well and help create a strong mesh in the house since I have one in every room.
For the water heater, I currently use a Sinopé RM3250ZB Zigbee Load controller but I plan to install their new RM3500ZB Calypso Water heater controller as soon as a driver is ready from Hubitat. This one will include a temperature probe to monitor the water temp and a leak detection cable.

Future enhancement

  • I want to place a lamp in a common area that will turn ON during periods to notify the family that a peak event is on the way.
  • I'd like to automate the peak detection but currently Hydro-Quebec doesn't have a webservice or something. I have seen few posts from people scanning their mailbox for HQ notifications with NodeRed or Javascript...

Leave your comments or ideas!

2 Likes

Ask people in Texas that were on Griddy in February 2021 how this worked out for them. Some people were getting $17k power bills for a week of service. Generally this can be a good idea, but all of takes is one snowmaggedon to show the really ugly part of this idea.

Texas has an unregulated energy market place. Griddy was one provider that did a monthly fee of i belive it was $20 gave consumers acces to energy at whole sale rates, sometimes as low as $0.02/kwh. But when the grid was over taxed, that quickly rose to over $9000.00/kwh (yes, you read that correctly).

Ps. Griddy filed bankruptcy and went out of business about 3 months later.

2 Likes

Interesting! $9000/kwh OMG! The rates here are like this...

Base rate (Rate D):

  • a daily base consumption at 6,319 ¢/kWh
  • remainder daily 9,749 ¢/kWh

When subscribed to rate Flex D:
From December 1st to march 31s you pay all your electricity to a lower price than rate D
Except during peak events (max 100h during the winter) the rate is 51,967 ¢/kWh

I've seen in some forum people saving 100$ to 200$ by controlling all their stuff manually. As for me, it's my first time. I hope my automations will help a bit. :crossed_fingers:t2:

$9,000 per megawatt-hour, which is $9/kWh. Still a lot, but not the same thing.

And Quebec’s energy market is regulated more tightly than Texas’, even if there is a program that encourages customers to sign up for lower off-peak rates in exchange for higher peak rates.

4 Likes

that's amazing! thank you so much!
I ended up creating 2 virtual switches and using both rule machine and Webcore

what are you using to shut off the water heater?

1 Like

Look at A word on my devices at the buttom of my post.

Not Installed yet but I already have this in hand:
Calypso - Smart Electric Water Heater Controller - Zigbee (sinopetech.com)

I'm waiting for a driver to be ready

This is one of 2 rules I use (other one is identical but with a different trigger time and for a longer period):

They are quite similar to yours. As for the water heater, I calculated that the saving would be negligeable and did not worth the investment. I only not use it prior and during a peek hour.

With this I got close to 500$ credit last year.

Also, I had set a preheating period the previous year and found it did not make a difference confort wize so I got rid of it.

1 Like

Thanks @ymerj, that's another simple solution. I prefer not using delays and rather use different trigger to make it simpler to debug. I also expect that the logic would better turn back to normal in case of hub reboot. But I must admit that I never ran into scheduling problem at bootup and my hub is on UPS.

I see you go down by 5°C, what's you normal temperature. I keep the house to 20° I feel going down to 15° would cause some complaints from the family :confused:

My hub is on UPS also and can last 5 days without power so no worries on that side. Normal temp is 20°C but I cheet a bit because I leave 2 rooms on the second floor at normal temperature (with doors close) to relax, watch TV or whatever when I feel the temp goes too low for confort.

@Cramezul I patched together a Gmail apps script from sample code to automate enabling a peak event state on the HE when I get an email from Hydro. Uses MakerAPI to turn a virtual switch on. If there's any interest I can share it.

2 Likes

Yes it would be interesting. This is the missing part of the puzzle! :+1:t2:

Here's the script in question. It's pretty dumb as it doesn't check the event date (in RM I assume the event occurs the next day) and doesn't parse the contents e.g. to figure out if it's a morning peak event, afternoon peak event or both (my RM rules assume both).

/*
  This is a Google Apps Script to detect any specified Gmail and turn on an HE virtual switch via a call to MakerAPI

  Inspired from : https://www.reddit.com/r/GMail/comments/i727l6/ive_made_a_tool_to_filter_gmails_and_trigger_any/

 */
  function Gmail_Trigger() {

  var cloudAPIurl = 'https://cloud.hubitat.com/api/'

  var hubId = 'abcde'                  // get this from "Settings", "Hub Details"
  var makerAPIKey = 'fghij'            // from the MakerAPI instance you plan to use for this automation
  var makerAPIAppId = '100'            // the app ID of the MakerAPI instance
  var virtualSwitchDeviceId = '200'    // the device ID of the virtual switch to be turned on

  var triggerLabel = 'HydroEvenementPointe'   // name of Gmail Label (optional to change)

  //-----------------------------------------------------------//

  console.log('Script Gmail_Trigger() start');

  var label = GmailApp.getUserLabelByName(triggerLabel);

  if (label == null){
    //GmailApp.createLabel(triggerLabel);  // better to go to gmail and create a filter.
    console.error('Label does not exist : %s', triggerLabel);
  } else{
    var threads = label.getThreads();
    if(threads.length > 0){
      console.log('Label found %d emails with label %s',threads.length, triggerLabel);
      console.log('executing commands');
      var response = UrlFetchApp.fetch(cloudAPIurl + hubId + '/apps/' + makerAPIAppId + '/devices/' + virtualSwitchDeviceId + '/on?access_token=' + makerAPIKey);
      console.log('command to hub got response code %d', response.getResponseCode());
    } else {
      console.log('No threads labeled %s',triggerLabel);
    }
    console.log('Removing label from threads');
    label.removeFromThreads(threads);     // comment out this line if removing trigger label from emails not required
  }

    console.log('Script Gmail_Trigger() end');
}

/*

  Typical Hydro email subject line (language specific)

  ❄️ Avis d’événement de pointe | Jeudi 22 décembre 2022

  Create a gmail filter to tag these with triggerLabel

  Sample command :

  https://cloud.hubitat.com/api/[hubId]/apps/[MakerAPIappID]/devices/[Device ID]/[Command]/[Secondary value]?access_token=[MakerAPIkey]

  Instructions:

  0.  Create a virtual switch to be turned on and set up a MakerAPI instance to make it accessible via external http calls
  1.  Save this Script to your account. (Click 'File', 'Save a Copy', close this window and open the copy. Rename it if you like.)
  2.  Paste in your Hub ID, MakerAPI Key, MakerAPI app ID on your hub, and the device ID of the virtual switch to turn on at the top of the file.  Save again.
  3.  Click the 'Run' arrow button and allow permissions. (Advanced etc) Click it again. (It will create the label automatically)
  (Read the script, it can't do anything risky. It simply checks if any mail for that label and makes an http call)
  4.  Click 'Edit, Current project's triggers' above and Add a Trigger for this script to run once every minute, or whenever.
  5.  Set up a Filter in Gmail settings for the (triggering) emails, and set the filter to add the label name. (Default is 'TriggerMail')
  6.  Set up a Rule Machine instance to trigger on the virtual switch turning on and go wild.

 */

The thing ran yesterday for this morning's event and I didn't have to lift a finger. I did have to manually cancel the afternoon peak period though.

Now I need to figure out code to change the Ecobee's schedule so that it will start heating earlier to a slightly higher setpoint (I have a hydronic system... perfect for this program :wink: ).

Just wanted to drop this in:

@hubitrep your script gave me an idea to add an automated override that can be controlled with a switch like you're doing.

2 Likes

OMG! It is easier than i though! I was thinking of how to run an app in HE to poll my inbox, etc... This solution is really simple. Thanks for sharing.

1 Like

(offtopic) Yeah I find it really elegant that you can essentially map any hub / device / app on the same route. Allows you to think of all your hubs (or all Hubitat units if you're its cloud platform operator :wink:) as one system. MakerAPI provides crude API management (authz) and I could imagine going even further, allowing writing apps that are hub-agnostic, for example by detecting when an endpoint is local and skipping the cloud hop, providing observability / throttling, etc. I've not looked at Hub Mesh/Connect yet but this sort of functionality makes those features obvious.

@Cramezul

Here is how I am able to find automatically a new morning or a new evening peak event.

In Gmail, I apply some labels to Hydro Québec emails :
Capture d’écran, le 2023-01-24 à 21.02.06

I use the app GCal search to find If there are some new Hydro Québec emails :

It will search for a new email with the label Hydro matin (I have a separate rule for hydro soir) :
Capture d’écran, le 2023-01-24 à 21.03.44


Then If there is a new email, It runs the RM rule to turn on a switch :

5 Likes

I don't know why it didn't occur to me to just use two labels instead of one. So simple. Thanks for pointing it out !

Wow!!! :astonished:

I don't know why HQ doesn't publish an API. They have one!

I found this thing: in your Espace Client, when a peak is scheduled, there's a frame with the next events.

To build this frame, the page calls this API
https://rb.solutions.hydroquebec.com/portraitweb/api/v3_0/conso?noContrat=[YourContractNumber]

It returns a json like this
{

"codeEtatPeriodeCourante": "000",
"dateDebutPeriode": "2023-01-04",
"dateFinPeriode": "2023-03-01",
"dateDerniereLecturePeriode": "2023-01-15",
"nbJourLecturePeriode": 12,
"nbJourPrevuPeriode": 57,
"montantFacturePeriode": 111.59,
"montantProjetePeriode": 697.57,
"indContratPuissance": false,
"adresseLieuConsoPartie1": "Adresse ligne1",
"adresseLieuConsoPartie2": "Adresse ligne2",
"codeTarif": "DPC",
"codeOptionTarif": "",
"listePeriodePointeCritiqueAujourdhui": [
    {
        "dateDebut": "2023-01-16T06:00:00-05:00",
        "dateFin": "2023-01-16T09:00:00-05:00"
    }
],
"listePeriodePointeCritiqueDemain": null

}

Problem is it needs authentication. That's where I am...

I also found this project but didn't have the time to look at it. It's not an HE project but there may be interesting things to take from it.

2 Likes