Electrical absorption under control via home automation Home Assistant

6 minutes of reading
  • use the profirst home automation based on Home Assistant to monitor electricity consumption, instantaneous absorption and eventually be alerted (and / or act automatically) to avoid overloading
  • Difficulty level: bass
  • Cost: variable based on sensors and actuators used
  • The device in which it is running Home Assistant
  • An electric absorption sensor (explained below)
  • Possible switches and absorption sensors upstream of some "key" appliances in particular electricity users

All environments

Notes and disclaimer
  • qualsiasi eventuale modifica agli impianti domestici dev'essere progettata ed realizzata SOLO da personale qualificato;
  • any changes implemented in probefore is a propersonal responsibility as well as a profirst risk and danger (the contents of the present page are purely educational);
  • any changes implemented in proprior to a device it voids the guarantee, quality approvals and certifications.
revision projet: 1.0


counterYou don't mess around with electrical absorption. Each domestic electric user is usually connected to an electric meter which is able not only to account for the absorption over time - the data from which the consumption bills derive - but also to supply a specific maximum power users.

The power of the meter is one of the fundamental characteristics of the supply: this power is measured in thousands of Watt, or kilowatt (kW) and is indicated in the bill in the section "type of contract"Or in the"supply data". It is usually indicated is the committed contractual power is that available, equal to 10% more than the one engaged. For a classic domestic use, the power used is 3000 Watt (although there are other types of contracts: 4,5 kW, 6kW etc.) while the available one is equal to 3 kW + the 10% tolerance (ie 3,3 kW). Sometimes the detachment thresholds are higher or lower: however, it is sufficient to refer to the profirst contract.

What happen when this limit is exceeded (the high one, of tolerance)? Simple: the counter "trips", that is it interrupts the electrical supply abruptly. This is a widespread phenomenon until a few years ago, when the attention to energy saving was reduced and appliances absorbed enormous amounts of energy: even just turning on a hair dryer and an electric water heater could trigger the detachment for threshold exceeded. This phenomenon however it is not completely exceeded: certain appliances - for purely reasons linked to their technology - continue to absorb a lot of energy, and their indiscriminate use can cause proproblems mentioned above.

Moreover, the possibility to check the accounting of the occurred absorption is certainly a priority, not so much because of a lack of trust in those who provide us with the service and invoice us, but to realize theconsumption trend over time with a view to saving. The adoption of energy saving policies must necessarily have a return on the consumption trend, and this trend must be available directly at our personal domotics.

In this prowe will see:

  • how to equip ourselves with a absorption meter;
  • how to create gods allocators;
  • how to create notifications at the threshold;
  • How prosee at automatic disconnection of specific appliances against the possible achievement of specific thresholds.

Nb Il procast should be read in fullIn fact, some passages take things defined in the previous ones for granted.

It starts

The sensor

First of all - and it is almost banal to say - it is necessary to have an element, a sensor, able to instantly measure the absorption level of the entire system and is able to send it to our home automation personal based on Home Assistant.

Sensorthere are plenty of them. Very highly rated, especially among the most skilled with electronics, are those Family pzem, or i Shelly EM, which in the face of very limited disbursements make it possible to achieve the goal, above all se programmed with firmware Sonoff-Tasmota. A simpler way is to use components that are both more reliable and easier to implement (but also, of course, more expensive), like the tried and tested Aeotec Home Energy Meter.

No one forbids the use of "pass-through" sensors, that is to say, those by frappbears on the circuit between the supply and the rest of the plant (type Sonoff POW, or Shelly 1 PM), but we consider it preferable to use sensors a current clamp as the aforementioned, as passive and therefore more secure. Do it anyway always referring to profirst electrician-installer of trust to carry out the profirst choice, also and above all based on the nature of the profirst plant.

We will assume from here onwards to be equipped with one of these sensors (whatever) integrating with Home Assistant: we will imagine that theentity deriving is called “sensor.home_power"(With"Friendly Name"Valued at"HOUSE consumption“), Which immediately reports the absorption of the entire electrical system expressed in Watt.

Nb Often this type of integration causes a huge influx of data to the profirst home automation Home Assistant: to prevent such data from being written to a database (causing loss of performance and even possible storage breakages where a Raspberry Pi with microSD for the execution of theHUB), it is advisable to follow la guide dedicated to filtering sensors.

This sensor can therefore be consulted in real time via the web frontend Lovelace UI in the form of a common sensor, or of pointer indicator ("GAUGE" or "INDICATOR"), perhaps configuring color thresholds based on instant absorption (green / yellow / red).

Home Assistant - Gauge

Usually these sensors, always through their integration a Home Assistant, are accompanied by an absorption indicator "on a time basis": we will assume that this sensor is called sensor.home_energy and that expresses its reading in the obvious kWh, or "kilowatt / hour".


The accountants (or "Utility Meter") I'm of the entity details: given an input value, I am able to calculate the value upright on a time basis: in this case we will add one in configuration that, drawing from the sensor sensor.home_energy, evaluate absorption on a monthly basis:

    source: sensor.home_energy
    cycle: monthly

This entity (utility_meter.home_monthly_energy) will be reset every month, every first of the month, keeping in the attributes (field "last_period") the value of the previous month, enabling us to further configurations useful to compare the value of the current month with the past, and more.

Home Assistant - CASA monthly absorption metering system

A focus on realization and configuration of the meters is available here.


What we are surely interested in receiving, as notifications, are the any exceeding of specific thresholds. Remaining in the wake of the example of a plant from 3kW (with tolerance 3.3kW), an interesting notification could be the one that, on exceeding the 2,5kW send an alert.

One possible configuration it could be:

  alias: "Notifica superamento soglia"
    platform: numeric_state
    entity_id: sensor.home_power
    above: 2500
  condition: []
     service: notify.mio_device
       title: "Domotica"
       message: "Attenzione: impianto in sovraccarico!"

Obviously in the block action no one forbids you to configure other specific notification blocks, for example one let Alexa talk in order to communicate the report, rather than one persistent notification.


What's happening if, after passing the 2,5kW of the example, one even arrives at the critical threshold of 3, perhaps surpassing it?
At this point it would be good and right detach automatically one or more appliances with high absorption, so as to avoid the detachment impronotice, if any, by the electricity meter.

To do this, of course, it is necessary that the appliances in question are controlled, upstream, by intelligent plugs, better if able to measure the electric absorption (eg. the FIBARO Wall Plug), Or via native home automation functions. the fact that any intelligent actuators in question (or the native home automation functions of the appliance) exhibit the absorption measurement function it is crucial for the approconcerning self-disconnection in case of overload:

  • knowing the absorption of strongly "energy-consuming" appliances, it is possible to know what selectively switch off;
  • not knowing him, he will choose to shut down, arbitrarily, some appliances rather than others.

Knowing the absorption of the household appliances (deducted through an intelligent plug and / or through integration of the home automation functionalities of the same) is possible, in the face of reaching the threshold, choose to switch off one rather than another. Unfortunately in this type of approcci Home Assistant it doesn't help much: it's not possible to make aautomation that "evaluate what to do" based on the scenario. The solution is - currently - that of writing and implementing a real e profirstPython Script”Which, based on the sensors that rappresist the absorption of household appliances, when evoked decide which appliance to switch off using the switches that rappthey can be turned on / off.

It is an approcertainly more difficult to achieve, but also more elegant and punctual.


This scenario, on the other hand, is clearly easier to implement. Let's say we have:

So let's assume that entity resulting from these additions are:

  • switch.scaldabagno
  • climate.condizionatore

Let us assume that the simultaneous lighting of these two appliances leads when the 3 kW threshold is exceeded: we could assume that the least important both the air conditioner, followed by the water heater.

We could define an automation as follows:

  alias: "Notifica superamento soglia"
    platform: numeric_state
    entity_id: sensor.home_power
    above: 3000
  condition: []
    - service: climate.set_hvac_mode
        entity_id: climate.condizionatore
        hvac_mode: 'off'
    - service: notify.mio_device
        title: "Domotica"
        message: "Sovraccarico! Spento il condizionatore!"
    - delay:
        minutes: 1
    - condition: template
      template_value: '{{ states.sensor.home_power.state|int > 2500 }}'
    - service: switch.turn_off
      entity_id: switch.scaldabagno
    - service: notify.mio_device
        title: "Domotica"
        message: "Il sovraccarico permane! Spento anche lo scaldabagno!"

Automation is easily explained: the trigger it is the overcoming of the 3000 Watts detected by the domestic sensor, which, as before action, flows when switching off the unit "Climate" (using the appropriate services); secondly, after a minute of waiting, it is verified that consumption has actually dropped at least under the 2500 Watts; if this is not the case, the water heater is also switched off (this time a type entity)Switch“).


Obviously this projet has no ambition to cover all the possible cases that, of course, are virtually endless. The purpose, if anything, is that to activate the raisernamento on the part of the reader regarding the steps to be taken in order to have an element that provides the reading of instantaneous consumption and trend over time (for the purpose of timely verification and notification at threshold) as well as useful elements for the disconnection of specific appliances in case of dangerous overloads.

Review: Broadlink RM Mini 4

Home Assistant Official LogoATTENZIONE: remember that there is on our FORUM community an ad hoc section dedicated to Home Assistant, for any doubt, question, information on the specific merit of these components.


Stay up to date through ours Telegram channel!