Load balancing
I have had a simple monitoring of energy use for some time now (several years infact) using the smappee integration but I was garnered in to action to come up with a better solution due to an unusually cold winter. January saw many of us with very high bills for electricity, usually a cheap commodity here where I live in Norway. Mine was at least double what it normally is and friends had double that again! In addition, due to a fault with our main fuse combined with low temperatures (ours was down to -10C) and high usage, our main fuse was tripping regularly and at its worst was tripping 3 times a day - quite hard to live with in lockdown and home office!
To mitigate the problems with the fuse tripping all the time while we waited for an electrician to come and replace the faulty part, I implemented a simple load balancing using the real time current measurements - first from smappee and later replacing this with the tibber integration.
The first thing I did was to go around turning everything electrical off and then using smappee to map out which appliances were using the most current. Smappee tries to do this using some artificial intelligence solution but I have never got that to work very well. I did a survey of most of the big energy users (eg heating, cooking, car charging, and hot water) and wrote down in a spread sheet which circuit they were on and which 2 phases (like most Norwegian houses we have a 3 phase supply) were being loaded. This helped to prioritize what to turn off if the power use crept up too high.
Our heating is all electricity, with the addition of a wood burning stove, so when the electricity use is high and the fuse is in danger of tripping, the only solution is to start turning things off.
To control the heating in our house I have a combination of:
- 433.92Mhz receivers, either wired in or plug in, for electric panel heaters
- zwave thermostats for floor heating
- Additional temperature measurement from Netatmo (Netatmo integration for HA)
I have a number of the Heatit thermostats such as this one (and some of their older models):
https://products.z-wavealliance.org/products/3802?selectedFrequencyId=1
The receivers can be switched from Home Assistant (I am using the Telldus Live integration for that), and the thermostats can be adjusted from Home Assistant automations (I am using the Samsung SmartThings integration for that). I could also use Telldus Live to adjust the thermostats but the integration doesn’t have support for climate entities so the whole thing is a faff to get it working nicely as I needed a whole bunch of event triggers in Telldus Live to to the switching.
To do the load balancing I have set up a few scenes in Home Assistant. Note these are heating scenes, not lighting scenes. These scenes reflect what I want to set in high and low energy consumption scenarios:
Extract from my scenes.yml (note I have shortened the file, this is just for illustration)
- id: '1610369717606'
name: Cozy comfort
entities:
climate.xx1_kitchen_thermostat:
...
temperature: 19
friendly_name: XX1 kitchen thermostat
climate.xx1_livingroom:
...
temperature: 21
friendly_name: XX1 livingroom
switch.xx1_downstairs_hall_heater:
friendly_name: XX1 Downstairs Hall Heater
assumed_state: true
state: 'on'
- id: '1610369802789'
name: Comfort
entities:
climate.xx1_kitchen_thermostat:
...
temperature: 17
climate.xx1_livingroom:
...
temperature: 20
- id: '1610369867367'
name: Background
entities:
climate.xx1_kitchen_thermostat:
...
temperature: 17
climate.xx1_livingroom:
...
temperature: 17
switch.xx1_downstairs_hall_heater:
assumed_state: true
state: 'off'
- id: '1610370588171'
name: Bathroom comfort
entities:
climate.xx1_downstairs_bathroom:
...
temperature: 21
.
climate.xx1_upstairs_bathroom:
...
temperature: 21
.
- id: '1610370643067'
name: Bathroom background
entities:
climate.xx1_upstairs_bathroom:
...
temperature: 19
climate.xx1_downstairs_bathroom:
...
temperature: 19
- id: '1610370680604'
name: Middle bathroom background
entities:
climate.xx1_middle_bathroom:
...
temperature: 19
As you see we now have some scenes for “Comfort” and “background” for different rooms. The main principle of the load balancing (primarily aimed at reducing the energy use peaks) is to switch from Comfort to background when the energy use is too high.
In addition there are a number of automations that control this. First of all some automations to set an energy use state. For example in automations.yml I set 2 different high usage levels and 2 different low usage levels:
- id: '1612438851388'
alias: Load balance activate power_high_1
description: Emergency off
trigger:
- platform: numeric_state
entity_id: sensor.real_time_consumption_xx1
above: '5000'
condition: []
action:
- service: input_boolean.turn_on
data: {}
entity_id: input_boolean.power_high_1
- service: input_boolean.turn_off
data: {}
entity_id: input_boolean.power_low_1
- service: input_boolean.turn_off
data: {}
entity_id: input_boolean.power_low_2
mode: single
- id: '1612438911499'
alias: Load balance activate power_high_2
description: Emergency off
trigger:
- platform: numeric_state
entity_id: sensor.real_time_consumption_xx1
above: '8000'
condition: []
action:
- service: input_boolean.turn_on
data: {}
entity_id: input_boolean.power_high_2
- service: input_boolean.turn_off
data: {}
entity_id: input_boolean.power_low_1
- service: input_boolean.turn_off
data: {}
entity_id: input_boolean.power_low_2
mode: single
- id: '1612439134922'
alias: 'Load balance activate power_low_1 '
description: Power levels low
trigger:
- platform: numeric_state
entity_id: sensor.real_time_consumption_xx1
below: '5000'
for: 00:01:00
condition: []
action:
- service: input_boolean.turn_off
data: {}
entity_id: input_boolean.power_high_1
- service: input_boolean.turn_off
data: {}
entity_id: input_boolean.power_high_2
- service: input_boolean.turn_on
data: {}
entity_id: input_boolean.power_low_1
mode: single
- id: '1612439181945'
alias: Load balance activate power_low_2
description: Power levels low
trigger:
- platform: numeric_state
entity_id: sensor.real_time_consumption_xx1
below: '2000'
for: 00:05:00
condition: []
action:
- service: input_boolean.turn_off
data: {}
entity_id: input_boolean.power_high_1
- service: input_boolean.turn_off
data: {}
entity_id: input_boolean.power_high_2
- service: input_boolean.turn_on
data: {}
entity_id: input_boolean.power_low_2
There are also some input_booleans that you can see above, but I wont show you how to configure those (just read the documentation).
So for a really low energy consumption to count it has to have been in that state for 5 minutes - then we can risk turning things back on again. My main fuse was rated at 13KW but we couldn’t let the energy use get that high and risk another blackout so there are 2 thresholds at 5KW and 8KW where we start turning things off. We had seen the fuse trip at a use level as low as 7KW if it stayed at that level for a few minutes. These automations don’t do any actual switching, they just set some states that are used below:
In this load balance automation, I never let 2 panel heaters at 2KW each be on at the same time. The 2KW living room heater is on a zwave room thermostat and we just let that run, but if the heater comes on, we turn off another in a different part of the house (yes it did get a bit cold for a while!).
- id: '1612179757384'
alias: 'Load balance #1 livingroom - downstairs'
description: ''
trigger:
- platform: device
type: turned_on
entity_id: switch.xx1_downstairs_hall_heater
domain: switch
for:
hours: 0
minutes: 10
seconds: 0
milliseconds: 0
- platform: device
type: turned_on
entity_id: switch.xx1_livingroom_heater
domain: switch
condition: []
action:
- type: turn_off
entity_id: switch.xx1_downstairs_hall_heater
domain: switch
mode: single
In this example we switch off as much as we can when the power use hits a peak:
- id: '1612182803892'
alias: 'Load balance #3 Emergency off'
description: Emergency off
trigger:
- platform: state
entity_id: input_boolean.power_high_2
from: 'off'
to: 'on'
condition: []
action:
- type: turn_off
entity_id: switch.xx1_hot_water
domain: switch
- type: turn_off
entity_id: switch.xx1_downstairs_hall_heater
domain: switch
- service: climate.set_temperature
data:
entity_id: climate.xx1_kitchen_thermostat
temperature: 10
- service: input_boolean.turn_off
data: {}
entity_id: input_boolean.kitchen_state
mode: single
There are also some automations to turn stuff back on again when the high use period is over.
For example the automation that was already in place based on time triggers can also be conditionally triggered when the energy use drops to acceptable levels:
- id: '1610370458895'
alias: Activate comfort
description: moderate comfort level starts
trigger:
- platform: time
at: 06:01:00
- platform: time
at: '17:00:00'
- platform: state
entity_id: input_boolean.power_high_2
to: 'off'
from: 'on'
condition:
- condition: time
after: 06:00:00
before: '23:55:00'
action:
- scene: scene.comfort
mode: single
A typical case might be that the living room is set to be warm and cosy, but then it’s time to make dinner and the oven and cooker come on. The automations instantly register this and turn down the thermostat in the living room and turn off anything that can be switched directly.
Whilst this was a situation I never want to be in again, the automations did work and we never had another blackout in the few very cold days we had to wait for some maintenance to be carried out. The house was in general a little colder than normal and more unevenly heated. However I liked the load balance idea so much that we still have it running, this helps us save a little bit of energy, but it also reduces peaks so that there is less load on the system and less load on the grid!
This is a list of some of the documentation for the configurations in this post: