These recipes will help in collecting and reporting power usage in Home Assistant.
When you’re running multiple devices that monitor power you may want to add them together. This would give you the ability to read the total power for a room, or group of similar devices. To accomplish this you’ll need to add some template sensors to your configuration.yaml
file. In the sensors:
group you’ll add a template entry for the math. In the example below we add the states of sensor.lab_mains_control_printer_bay_smartenergy_metering
which is provided by the Sengeld Smart Plug I use. These provide power metering at a great price. Their bulbs also provide power usage as well. If you’re using a different device for your home automation and it has power monitoring you should be able to alter this recipe for your device. Adding the values together as you see in the example below allows you to have a “Total Lab Power” or any other group you desire. Be sure you specify the sensor name total_lab_power
is then used as sensor.total_lab_power
in your other automation and dashboards.
- platform: template
sensors:
total_lab_power:
friendly_name: "Total Lab Power"
unit_of_measurement: "W"
value_template: "{{(states('sensor.lab_mains_control_printer_bay_smartenergy_metering')|float) +(states('sensor.lab_mains_control_lighting_smartenergy_metering')|float) +(states('sensor.lab_mains_control_1_smartenergy_metering')|float) + (states('sensor.lab_mains_control_2_smartenergy_metering')|float) }}"
total_lab_power_cumulative:
friendly_name: "Total Lab Power Cumulative"
unit_of_measurement: "kWh"
value_template: "{{(states('sensor.lab_mains_control_printer_bay_smartenergy_metering_summation_delivered')|float) + (states('sensor.lab_mains_control_1_smartenergy_metering_summation_delivered')|float) + (states('sensor.lab_mains_control_2_smartenergy_metering_summation_delivered')|float) }}"
Once you have your power monitoring in place you may want to set an alert when you’re approaching the power maximum for your circuit. Good examples of this are a home shop or lab where you’re using high powered equipment, power tools, 3D Printers and Lasers. Most residential circuits in the US will supply 10-15 amps of power per circut. The Sengeld Smart Plug can handle up to 15A of power. In the US that equates to 1800 total watts per circuit. In the recipe below you can see an example of triggering an audio message to google home in the Lab and altering to a potential breaker trip. This example shows when the sensor reaches 1500W of power an audible alert is sent via TTS and the media_player.play_media
service
- id: '1653144268306'
alias: 'LAB: Printer Power Warning'
description: ''
trigger:
- type: power
platform: device
device_id: fe9d191b2cb5cb79db61913997199e48
entity_id: sensor.lab_mains_control_printer_bay_smartenergy_metering
domain: sensor
above: 1500
for:
hours: 0
minutes: 0
seconds: 10
condition: []
action:
- service: media_player.play_media
target:
entity_id: media_player.maker_space_speaker
data:
media_content_id: media-source://tts/cloud?message=WARNING%21+Printer+bay+power+exceeding+sixteen-hundred+watts.+Shutdown+will+occur+at+eighteen-hundred+watts.++Lower+your+power+consumption+to+prevent+power+shutdown.++&language=en-US&gender=female
media_content_type: provider
metadata:
title: 'WARNING! Printer bay power exceeding sixteen-hundred watts. Shutdown
will occur at eighteen-hundred watts. Lower your power consumption to prevent
power shutdown. '
thumbnail: https://brands.home-assistant.io/_/cloud/logo.png
media_class: app
children_media_class:
navigateIds:
- {}
- media_content_type: app
media_content_id: media-source://tts
- media_content_type: provider
media_content_id: media-source://tts/cloud?message=WARNING%21+Printer+bay+power+exceeding+sixteen-hundred+watts.+Shutdown+will+occur+at+eighteen-hundred+watts.++Lower+your+power+consumption+to+prevent+power+shutdown.++&language=en-US&gender=female
mode: single
To modify your summation totals on a monthly or weekly basis you can adjust it in the developer tools under statistics.
Just go to the Home Assistant Developer Tools Statitics Page and search for the appropriate device. Then you’ll simply click the “Adjust Sum” icon on the far left.