Considering the ongoing energy crisis, you may feel the need to limit your energy consumption. With PowerWiz for Home Assistant, I have implemented a basic approach to limiting your peak hourly energy consumption and cutting power during peak price hours. PowerWiz doesn’t have dependencies like Node Red or other addons. The hard requirements are access to your power meter readings and the power readings and on/off switch of the devices you include in your power saving scheme. If you also have access to the hourly accumulated and estimated energy consumption from your power meter, that is a plus, but you can create these two sensors yourself with access to the power meter reading alone.

PowerWiz will not try to speculate on how much money you have saved or how much you have spent; it will simply cut power to devices of your choosing when 1) you consume too much energy 2) the prices are too high.

You can control thresholds for cutting power, for how long the power should be cut, and how long devices must remain on before cutting power again.

powerwiz-config

Power limiting

You can set a energy limit to stagger your hourly energy consumption. When your house is estimated to draw more than the limit, PowerWiz will start cutting power until you are below the threshold (plus a safety). Power will remain cut for the duration you set to limit your devices; for example 30 minutes. If you give PowerWiz control of many devices, PowerWiz will automatically rotate what devices get limited, thus having less impact on a specific device.

Power saving

You can save power during the most expensive hours. You define during how many of the most expensive hours you want to save power. You also define when you consider it worth saving money. For example, PowerWiz lets you define a power saving where you save power the 3 most expensive hours during day, but only when the power is 20% more expensive and the same time at least 5 cents more expensive than "normal" during that day. You define all three parameters. The evaluation of 20% and 5 cents more expensive is by defauly done comparing the current price to the median price of the non-powersaving hours that day. If PowerWiz deems the hour "powersaving worthy", it will shut off all your defined powersavers during that hour.

Note, after this article was originally written, I extended the power saving feature for devices like boilers. This is reflected in the GitHub example. but not in the example on the blog. You can use power saving in a general way (the original way), or you can specify a special power saving scheme for special devices, like boilers. The power saving function is general and turns everything off, which may not be suitable for boilers. When I power boost my boilers, I slice the day in three parts, and make sure the boilers get enough juice to warm the water by we get home in the afternoon, by the time we go to bed at night and by the time we get up in the morning. For instance, Powerwiz will calculate the cheapest hours between 7 am and 15 pm, and make sure we use those hours to heat the water so the heater is warm by people getting home from work. If I were to use the general power saving feature, chances are the boilers will be off all day, because those are the most expensive hours, making sure the water is cold by night when we need a shower after our workout sessions. Slicing the day and using the cheapest hours within a time windows, makes sure the boiler is on (when needed) even during the expensive hours of the day - just making sure it picks the less expensive of the most expensive hours.

Power boosting

This has been added to the GitHub repository after this article was originally written. Power boosting is useful to turn on devices the cheapest hours during the day, as opposed to turning them off the most expensive hours. An example is EV chargers. This way you can use more or less of the cheap hours to boost a device. A power boosted device can also be a power limited device. But a power boosted device can not also be a power saving device.

Power limiting, power boosting, power saving and energy starvation

In order to avoid starving devices from power, PowerWiz won't by itself shut down a device that was recently shut down by PowerWiz. This is called immunity. Immunity is configurable and applies both for power saving and power limiting, interchangeably. If you decide to include a boiler in your powersaving and power limiting configuration, you can safely do this. Say you want to cap your total consumption at 10 kWh and at the same time you want to save power the 5 most expensive hours each day. If in this configuration you choose to cap consumption by powering off devices for 30 minutes at the time, and give devices a 30 minute immunity for both power limiting and power saving, you will still have at least 9,5 hours a day to power your boiler.

Restoring power manually

If PowerWiz cuts power to something at a bad time, you can easily restore power manually. In such a case, PowerWiz won't cut the power again until the device immunity periode has elapsed. This is a neat way to manually turn on a disabled heater for when you are watching your favourite tv-series.

Are you ready for PowerWiz?

Go to the Home Assistant PowerWiz GitHub repository and start hacking with basis in my code. This is not plug and play, you will need to dive into some YAML coding.

To set up PowerWiz you normally need to add custom config to the following files:

  • input_texts.yaml
  • input_booleans.yaml
  • input_numbers.yaml
  • templates.yaml
  • automations.yaml

Additionally, you'll probably want to create a PowerWiz dashboard. You find dashboard code in the repo (dashboard.yaml) that you can easily adapt for your own use case.For examply, if you use Nordpool to get prices, you'll probably get prices in another currency than NOK. PowerWiz doesn't care about currencies, but for clarity, you should change the NOK text in the dashboard to fit the currency you use.

Use the code found in the repo, copy, paste and adapt. For adapting the code, continue reading!

If you'd like to keep code separate, you can use packages or other strategies for splitting up your config files.

Some guidance

As I said earlier, PowerWiz isn't plug-and-play. You need to make some decisions and manually add devices to your power saving scheme.

Let's say you want to add a convector heater. If the heater is used in a climate integration, you must use the climate entity to control power to the device. If you use the heater directly, PowerWiz may be overridden by the climate integration. If you'd like to add a boiler, you typically use the power switch entity of the boiler to control power to the device. For both cases, you also need to know the entity that gives the current power draw for your device, because PowerWiz needs to know if the device is drawing power or not, in order to decide if the device is a candidate for being powered off.

When adding devices to PowerWiz, say a heater and a boiler, you need to add each device in at least three locations.

Adding power limited devices

templates.yaml Add the entity that measures current power draw (w) from the device to the "powerwiz_limiters" sensor. E.g.

  - name: powerwiz_limiters
    unit_of_measurement: W
    device_class: power
    state: >
      {{ states('sensor.boiler_power')|int(default=0)
        + states('sensor.convector_heater_livingroom_power')|int(default=0) }}

automations.yaml Add the relation between the power measuring sensor and the entity to control power in the "power_limiters" variable.

                {% set power_limiters = {
                    'sensor.boiler_power': 'switch.boiler',
                    'sensor.convector_heater_livingroom_power': 'climate.livingroom'} %}

input_booleans.yaml Create an input boolean that will be used to control power to your power limited devices. The name must follow a specific convention, where you take the name of the entity, replace "." with "_", and append "_powerwiz_limiter", e.g.

switch_boiler_powerwiz_limiter:
  name: Boiler
climate_livingroom_powerwiz_limiter:
  name: Convection heater livingroom

This will add to entities: "input_boolean.switch_boiler_powerwiz_limiter" and "input_boolean.climate_livingroom_powerwiz_limiter".

Adding power saving devices

templates.yaml Add the entity that measures current power (w) from the device to the "powerwiz_savers" sensor. E.g.

  - name: powerwiz_savers
    unit_of_measurement: W
    device_class: power
    state: >
      {{ states('sensor.boiler_power')|int(default=0)
        + states('sensor.convector_heater_livingroom_power')|int(default=0) }}

automations.yaml Add the relation between the power measuring sensor and the entity to control power in the "power_savers" variable.

                {% set power_savers = {
                    'sensor.boiler_power': 'switch.boiler',
                    'sensor.convector_heater_livingroom_power': 'climate.livingroom'} %}

input_booleans.yaml Create an input boolean that will be used to control power to your powersaving devices. The name must follow a specific convention, where you take the name of the entity, replace "." with "_", and append "_powerwiz_saver", e.g.

switch_boiler_powerwiz_saver:
  name: Boiler
climate_livingroom_powerwiz_saver:
  name: Convection heater livingroom

This will add to entities: "input_boolean.switch_boiler_powerwiz_saver" and "input_boolean.climate_livingroom_powerwiz_saver".

Getting your energy readings and prices

PowerWiz is designed to get energy prices from Nordpool. It should be fairly easy to feed it other prices if you have a sensor for it. For grid consumption, you just need to point PowerWiz to the correct values for your case.

You have to adapt the following:

templates.yaml Update the 6 references to nordpool, and point the templates to a sensor that gives you prices for your price zone.

Update powerwiz_current_usage, powerwiz_hour_estimate and powerwiz_hour to point to your relevant grid sensors. For Norwegian users, the Tibber integration gives these values out of the box.

  • powerwiz_current_usage is your current power draw
  • powerwiz_hour is your accumulated energy consumption for the current hour (comes with Tibber, but can be created with the utility integration)
  • powerwiz_hour_estimate is powerwiz_hour + an estimate on how much you'd spend the entire hour based upon powerwiz_current_usage (comes with Tibber, but can be created with the utility integration and some calculations)

Start saving

You need to reload your input_booleans, input_numbers, template sensors and automations - and you are ready to save!

But now, you need to configure it all. I suggest using the example dashboard to begin with. Start playing with the parameters and see how your setup behaves. You are now ready to go!

Previous Post Next Post