How to reduce peak consumption (hems)

Hi folks,

Since electricity peak consumption is getting very important for our energy bills, I would like to collect some ideas about how to reduce such energy peaks.

I'm new to this area, but it seems they talk about "home energy management systems (hems)":

'A home energy management system is a technology platform comprised of both hardware and software that allows the user to monitor energy usage and production and to manually control and/or automate the use of energy within a household.'

Such a hems does all kind of stuff:

  1. Turn devices on and off remotely
  2. Set devices to operate on schedules
  3. Set up conditional rules for device operation
  4. Manage the flow of energy from solar panels (and other generators) through the home or in and out of batteries
  5. Allow machine learning to take over and run the system semi-automatically

I'm for example very interested in point 2: how can I easily setup a scheduler to make sure that not all my devices (washing machine, washing dryer, ...) don't run all the same time. However I also don't want my wife to come home, and find out that the washing dryer has been running 8 hours ago and that her laundry is crumpled. And of course most of our devices are not smart devices, and I'm not going to replace all of those.

And I'm not sure if there is an easy way to define all my electrical devices in Node-RED. Should I store them in a JSON array in context memory, because that is "quite" non-user friendly. Unless we only want to invite technical skilled users to use Node-RED for this kind of stuff...

Have been searching how other software systems do the job, but cannot find something useful. So all kind of information is useful (screenshots, algorithms, ...).

Please don't go too much off topic. Because before you know we are talking again in depth about one or another microcontroller, and then the entire discussion is lost for everybody...


1 Like

Haha, you had me for a second there Bart. To me, HEMS means "Helicopter Emergency Medical Service". I have a friend who is a paramedic and did some tours on the London Air Ambulance. Now spends is working hours wizzing round London on a BMW paramedic motorbike.

Not sure about the full control/scheduling issue. That is a hard problem indeed. One easily dealt with by a human but not by a machine.

In regard to the data though, I have a similar issue for my new generation home automation system. So I've been building and documenting some standard data schema's to help me.

I have a known_devices global that is highly technical but contains the metadata required to relate the device to the real world. For me, this is a human readable location and a description. So when I want to control a device, I only really need to expose the location (mostly there is only 1 relevant device in each location but there doesn't have to be). Then a web-page style controller or dashboard only needs to use the location and the system translates that to the actual device ID via the known_devices variable.

I also build out a locations variable where each location contains a property listing its devices split into 2, a switches property listing the ID's of any switches (controllable plugs) in the location and a sensors property listing the ID's of any sensor devices. This is just for convenience. The locations variable also maps the ID's of the smart heating systems locations as well.

I think that this is the type of data you would want in order to map human-friendly devices to system ID's.

Whether you can do this is going to depend on each device. For example, we have a dehumidifier, a simple one that plugs in and turns itself off when it reaches the required humidity. BUT you can't simply turn it off at the mains because that will damage it. You can turn it on remotely but not off. Same would be true for washing machines, dishwashers and driers. So whatever you come up with, you will need to have that logic built in and will need a property in your device data to say whether it can be prematurely turned off.

For the washer/drier rumpled cloths problem, you would likely need to know when SWMBO is out and when she will return. A very hard problem indeed!

Possibly another approach would be to have a dashboard that lets a human control things but with indicators provided by your system showing when the ideal time is likely to be. That way you can work on your ML and other controls without crashing the entire house and once (if ever) you get to a point when the system matches your experienced reality, you can then hand control over.

That one is probably more achievable though probably still has a lot of variables including expected weather conditions as well as expected power consumption.

ML requires vast amounts of training data to be useful. Especially so when dealing with chaotic systems (e.g. you and other household members coming and going). You will need to find ways to record people coming and going as a starting point. Not so bad if people have a fairly fixed schedule. However, COVID has completely destroyed any scheduled comings and goings in our house and even before then, our schedules varied quite a bit from week to week. Maybe your experience will be different.

In case it is of interest, here is the current known_devices schema - it may yet change slightly but I think I have most things set now:

/** Table of physical & logical IoT devices 
     * Used to track operational data for known devices.
     * Used to map logical device names to physical ID's 
     *   e.g. when setting `switch01`, mapping to physical ID and output channel to turn the relay on/off.
    known_devices:  {
        /* Object Key */
        name: '{String} Unique',
        /* Required Properties */
        location: '{ENUM} Short description - see `locations` global',
        id: '{String} <source>/<unique id>[-<Optional channel #>]  Technical ID including leading protocol to ensure uniqueness',
        input: '{Boolean} Does this device take input? e.g. a switch/relay/bell sounder',
        output: '{Boolean} Does this device produce output? e.g. a sensor or a controller',
        in_use: '{Boolean} Is this device actively being used?',
        /* Optional Properties */
        controls: '{Integer} Number of controls (buttons or sensors) that produce control output (e.g. to turn things on/off)',
        sensors: '{String Array} Codes for all the sensors on board. See the `sensors` schema',
        info: {
            description: '{String} Description of device',
            type: '{String} Description of device type',
            source: '{ENUM} LAN, 433',
            // For RFX devices (To send to RFX, `protocol/physical_id/id_channel`)
            src_channel: '{ENUM} Input/Output channel from/to source. e.g. `RFX/lights`',
            protocol: '{ENUM} EasyESP, LIGHTWAVERF, ...',
            physical_id: '{String} Optional. e.g. hex id for 433mhz devices',
            id_channel: '{Integer} Channel number for those devices that use settable channels (e.g. switches)',
            // For networked devices
            //protocol: '{String} description of protocol, e.g. `Tasmota`, `EasyESP`, `Custom`',
            mac: '{String} Network MAC address of devices network interface. Only for LAN sources.',
            ip: '{IP Address} IP Address of devices network interface. Only for Net or LAN sources.',
            url: '{url} URL of web interface for the device. Only if it has one.',
            // optional
            AKA: '{String} If I/O from device also appears on a different ID',
            geo: '{Array[lat,lon]} Geolocation of device'
        /* Operational Data - added at runtime */
        status: {
            rssi: '{Integer} Measure of radio strength',
            battery: '{Integer %} Measure of battery',
            online: '{Boolean} Is the device considered to be online?',
            updated: '{Timestamp}',
            updated_by: '{String} What process/service updated the operational data?',
            uptime: '',
            memory: '',
            last_restart: '',
            last_restart_reason: '',
        outputs: {
            /* Sensor outputs - matches the sensor_types list */
            '<sensor_name>': '{Number|Boolean|String} The value output from the sensor.'
        inputs: {
            /** Allows data/commands to be sent to IoT devices 
             *  TODO: Need a way to define allowed input commands
            '<input_id>': {
                state: '{On|Off} State of switch',
                updated: '{Date} Last update of any kind',
                last_on: '{Date} Last time of On status',
                last_off: '{Date} Last time of Off status',
                on_duration: '{Integer} ms elapsed between last on and last off',
                off_duration: '{Integer} ms elapsed between last off and last on',
        switches: {
            /* Input Switch status & last on/off timestamps - 1 entry for each # controls */
            '<switch_number>': {
                state: '{On|Off} State of switch',
                updated: '{Date} Last update of any kind',
                last_on: '{Date} Last time of On status',
                last_off: '{Date} Last time of Off status',
                on_duration: '{Integer} ms elapsed between last on and last off',
                off_duration: '{Integer} ms elapsed between last off and last on',

Hi Bart,

Recently I started developing in the field of HEMS. I can tell that you summarized brilliantly the challenges in this domain. Because not many devices are smart we are working on a ZigBee enabled device that monitors energy consumption for individual appliances or for the an electrical circuit. Data will be processed in Node-RED. We are almost done with the ZigBee software and hardware and should start soon doing some simulations with fake data from the sensor (since the prototype board is not available yet. I find difficult to control energy when you do not have actual measurements of power consumption.

Yes you are correct Julian, I should have checked the LOCUA first...
Ah perhaps I should explain that also to you: LOCUA = List Of Commonly Used Abbreviations :rofl:

I indeed would also do it like that at the moment. But that is of course a very technical manually build solution. There should be a way to simplify something like that...

Damn it hurts to admit that you are right. Haven't thought about that until now ...
I was thinking about a non-smart refrigerator: turn it on/off via Node-RED to stabilize the power consumption.
However for e.g. a washing machine it indeed becomes more complicated: you cannot simply turn it on, and expect that it starts running some selected scenario of washing steps.
That is a real bummer :frowning:

To be honest, I got this summary from carbontrack. But indeed I also found it a good summary.

Hey Andrei,
That was also my thought last week. But how do you solve my washing machine example from above?
And then there is still the scheduling problem. Suppose we are able to (de)activate a device. How can we schedule all those devices so they run nicely sequential instead of parallel? Suppose my wife goes to work and suddenly realises that she needs to put some dirty laundry in the washing machine. She does that very quickly because she has to hurry to go to work. Then she quickly should put this somewhere into the planning of the day, to avoid that multiple machines start running in parallel (and resulting in high energy peaks and thus high invoices).
So I assume she needs to be able to put something in the daily timeline, for the (washing machine) device for a specific time interval. Not sure how something like that can be made user friendly ....

When the algorithm decides it is time to turn the machine on then it could send an instruction to the Washing Machine Operative to turn it on. I am sure that would be very acceptable to other members of the household.

I have family that work in commercial and residential solar augmentation industry. This topic comes up often. Your average yield of panels, direct power, even today is not that great. You have to spend considerable funds and have extensive space to setup a solar grid that can deliver concurrent (no pun) significant power for direct consumption. Just a frig and a few lights, can consume everything a typical home grid can generating in real time.

The key of almost all solar designs is to qualify and smooth or level the peaks and valleys of power demand, even for a single home installation. It is the sum total of power use offset by solar that impacts your bill for most users of solar. Moreover, if you are consistently peaking you power use above your total solar budget, your installation is likely under sized, and/or your demand use projection was wrong.

Use of a power-wall or battery arrays was disqualified early in the history of solar use here in US/CA, as well as prohibiting complete removal from the utility grid regulated, for various reasons, some stupid some reasonable. I will not qualify these here, but in short, just recently at leas in US, and more of note CA, the use of stored capacity has finally been approved with some acknowledged limits and requirements. This recent approval, as well as newer generation of capacity efficiency and scale has significantly improved the total saving potential of using solar. Thus, installations that have stored-capacity reserve are at a clear and substantial advantage over non-stored-capacity based installations.

Don't even get me started on power buy back issues, what the utilities pay for your cheap power from your grid is a joke, it is better to upgrade your capacity and sell nothing back to the utility in almost all cases, unless that goal was principle to your implementation.

1 Like

To the problem stated, is this an opportunity to use a 'learning' machine model? If schedule changes are random and dynamic, ok, but typically you want to discourage exceptions and encourage consistency right? This suggests taking the human decision element down to the less significance possible. Where human decision is only needed under extreme circumstance. Thus, the wife tosses in the dirties, and forgets about them, because the learning machine model will know when to schedule without override or input typically. The wife will not care when or how the dirties are cleaned, as long as most of the time, they are clean by the time, you get home, to fold same, right?


Just going through this myself at the moment and the results are interesting to say the least.

  1. Most devices are pretty dumb so the ability to turn them on remotely and interact with them is minimal - those that are smart enabled with an app etc usually do not allow any interaction except the app so this is a problem.

  2. The way we started on this is that we started measuring all the electricity useage in the house - firstly at the whole house level - to give me a feel for base loads and loads from specific devices, and then started drilling down into the circuit and device level.

I did this by purchasing an IOTAwatt - this provides me the ability to have upto 13 channels that monitor individual circuits in our house - so i have one on the main kitchen circuit, one on the laundry, one of the 3 phases into the switchboard etc. (I have another IOTAwatt on order so i can monitor every circuit longer term).

I have then placed discrete energy monitoring devices on individual devices (like the fridge, dryer, washng machine, pool pump etc etc)

By doing this i have built up a mental picture of the energy profile of each device and started recording measurements into influxdb for either individual devices or circuits.

Some of our devices are semi smart - i can set a cycle on the clothes dryer and tell it i want extra dry, start the cycle and then use the smart plug it is plugged into to drop power to the dryer, when i reapply power it will start up with the same cycle, same for our dishwasher and washing machine.

Others are just dumb off and on devices (such as pool pumps etc).

Using the IOTAwatt i have a full picture on the whole house power draw and the solar that we are getting - we also have an api from our our energy provider that provides 1/2 hour visibility into the expected electricity prices throughout the day.

I use the Solcast API to get estimates from them as to how much power i will produce from my solar array during the day - and the longer you use their API the more accurate it gets.

For much of our stuff i use simple emails to my wife and I (we both work from home) - such as

Looks like good solar output today from 10 to 3PM - the pool pump is scheduled to run then, so the dishwasher could be started at 10AM and a load of washing also if needed.

I send these emails through at 7AM and then update throughout the day as various devices run etc.

When the washing machine finishes the power monitor alerts us within 10 minutes and then advises if there is enough excess solar to enable the dryer to be put on.

If something does get turned on and looks like we are going to exceed our solar throughput, i will do things like turn off the pool pump, turn off some secodary devices like 2nd fridges and freezers and then notify by email.

It is all very bespoke and ugly at the moment - with no real interface per se, so i will watch this thread closely to see how you guys come up with some ideas of standards etc.



I learned something from NASA... indirectly... so I will ask it here... If any one recalls the issue with the power up of Apollo 13, after all systems were offline for an extended period, the order and sequence of power up was complicated by the number of AMPs they could draw during the actual power up. In short, power up 1,2,3, over AMP, power up 2,3,1 over AMP, but power up 3,2,1 no over AMP, if you will.

Thus, is the power up spike behavior going to be a factor in your design goals? This is something I have in my notes, that if or when I get solar... likely some time in 2021, and I want to avoid the enhanced cost model, of jumping from 2nd tier to 3rd tier, a big jump in cost where I live, I not only need the baseline, typical load metrics for as many scenarios as I believe I need to qualify, but also an understanding of how I might violate the 2nd to 3rd tier boundary without intending to do so.

Of course, this may not be an issue if you know you can consistently stay within the given tier you desire (using my situation as a reference), but I would think any design should have some type of warning or safe guard to avoid incurring a rate boundary violation, if I can coin such here. I maybe going down a tangent here, but still, maybe thinking about it now, is worth the effort, rather than a nasty surprise in the future?


Are you invert driven or do you have capacity store? Just curious. I am just starting to discuss the various options with my family that work in the US/CA solar market, and I have access to the engineering team of one of the firms local to my area. Really is interesting the options on the table now, direct DC, inverted, serial inline vs. parallel array wiring. Panel quality versus life span, panel efficiency differences, just to mention a few of the factors.

Hmm that is a very nice quote! I was thinking that the machine learning was a fancy gadget, but when reading your sentence it indeed becomes logic again.
However I think that there are a lot of exceptions that you have to take into account: by an event of the kids you suddenly have an extra machine of laundry to do, or you need to cook earlier because you forgot that you had to go somewhere, ...
Moreover the human factor is very big for a washing machine. If you don't put any cloths or products in it, there is not much sense to schedule anything. Seems to me that she should be able to add the washing cycle easily somewhere into the daily schedule (ad hoc)!!!

If you want completely avoid all exceptions, then a fixed schedule in Node-RED might be also sufficient. Is that correct, or do I see it wrong?
I explicitely mentioned 'all exceptions' instead of *"most exceptions" because a single short peak - due to a single exception - will result in a heavy electricity invoice.
That results perhaps in a new question: suppose Node-RED detects that the power consumption starts peaking, should it then:

  1. Shut down automatically the device with the lowest priority (e.g. a freeze can be shut down for 'some' time).
  2. Or should Node-RED avoid that some devices can be started, when other devices are already running. Although this needs to be decided based on a schedule, instead of based on the current measured power consumption. Indeed my washing machine cycle contains some breaks, when the device is not using much power.
  3. Others?

However it feels like going back 50 years in time, or moving to a country with an underscaled power grid network :frowning_face:

Colin, Julian reminded me above that this is not possible. When Node-RED starts my washing machine, there is no way for me to start the cycle. It will wait until I enter the time interval and hit the 'start' button...

Hi Craig, Yes that is indeed how we should get started. Determine the entire usage and the use per device (for each of its usage 'modes'). Good that you mention it!

If you would have some time left, it would be nice if you could write a 'share your project' discussion about it!

That is an extra problem for me, since (without Covid) we don't work from home...

I think my rather feeble attempt at a humorous comment was too subtle, or perhaps lost something in the translation. The term Operative was intended to mean a person.

As far as I can see there are only two solutions to the washing machine problem. One is get a machine that has an API of some sort to allow it to be done via s/w (and has already been noted this may not be possible at the moment other than via a closed source app of some sort), the other is to do it manually.

1 Like

Self-aware washing machines? Dogs and Cats living together... What is this world coming too? (Please excuse the vague reference to Ghost Busters). Now I have to find a toaster that is internet capable? When will the insanity stop? LOL.

Was thinking about this over breakfast this morning... I have several smart plugs that can track power consumption, thinking these could give me approximate per device power consumption, just as an experiment to give NR some initial data. Also, was thinking there maybe an opportunity to web page scrape my power use statistics, from my power vendor, since I can login to my account/bill and see it online.

I would think that any running analysis would need comparative data from the power vendor versus any internal local measurement of total use. Their numbers are what qualifies the actually billing.

Don’t forget the coffee maker...

1 Like

LOL! oops!

Yes Colin, I'm dutch speaking and try to type english here, so you guys can sit back and relax in your lazy english chair :joy: Sorry for demolishing your 'subtle' joke :wink:

That is so pitty. When we bought a new washing machine a few years ago, and that brand had (at the time being) one model with wifi. But it was ridiculous expensive. So we bought an affordable one, but now it seems to have become my private party-stopper...

Was thinking the same this morning...
In this article a guy is using Node-RED and Sonoff to determine whether his 'dumb' washing machine is washing, in standby or off.

I know some of the German brands like Miele used the power led for comms by pulsing it at high speed. Not sure if that was one way only for diagnostics or if they had a return path also.

Then again ours has a dial to set program and a separate push button to start. So that could be hacked with an esp and a relay.

1 Like

Couple of years ago I started to monitor day-ahead electricity price and to control some high consuming devices based on price but preserving the comfort.
The dumb washing machine was in the list of such devices but the comfort part (lead by my wife) overruled all schedule intentions so it turned out just notifier about "started" and "done" events. And as Sonoff pow can give some additional data about history of power consuming, the numbers can rise a little talk in the boring evening if you will.


If you were just dealing with your own devices, you could build all of the data into the device via a configuration and make that discoverable. Similarly, if you were using all Homie based devices, you could also configure them to be self-discoverable assuming they let to configure all of the required parts in a consistent way (actually, my experiments with homie have never ended well, it is far too complex to be useful in most cases).

But since you are unlikely to be in either of those positions, I think that you will inevitably end up with lots of typing. Though you can help yourself by at least discovering many of the devices. I do that already, both on the network and on my RFX (it is amazing how many devices that picks up that aren't mine!). Feed those into a variable that you can add metadata to as and when you like.

No, I don't think even that would work to be honest, and you would be potentially putting a lot of stress on the pump. In fact, I would hazard a guess that a decent fridge made in the last few years will always do a better job at stabilising its power usage better than you ever could. Same with newish washing machines and driers. Our new washing machine is rated at A+++ -30% (that is 30% better than A+++).

And you've lost her already because she certainly isn't going to mess with the washer and then mess with your web page. Not going to happen unless she is a lot more patient than my wife. No matter how easy you make it.