Skip to main content
Smarthome 6 mins

Measuring power consumption with the Shelly 3EM and Home Assistant

Electricity prices are exploding. With the Shelly 3EM you can measure the entire power consumption of an apartment or house and optimize your usage.

Measuring power consumption with the Shelly 3EM and Home Assistant
Table of Contents

In October, our electricity provider sent us a notice about a price adjustment. From the current 28.6 ct/kWh, it was supposed to go up to a whopping 42.52 ct/kWh from December 1, 2021. The electricity markets are going crazy right now and some providers seem to have miscalculated. The first step is, of course, to exercise your right to cancel and find a cheaper provider.

The second step is to find savings potential. With a conventional Ferraris meter, it’s tedious to impossible to track down specific consumers - who wants to watch the spinning disc and time 2-3 revolutions? DIY solutions like the one I presented here are also not accurate enough, as they only observe the meter disc. Smart meters are becoming more common, but accessing them to read exact consumption data is often not possible.

⚠ [affiliate] Keine Produkte mit Cache für home-assistant. Bitte affiliate-sync --lang en ausführen.

The Shelly 3EM , on the other hand, offers a fairly inexpensive solution that provides very precise insights into consumption with little effort. The Shelly ShellyBulgarian manufacturer of Wi-Fi-based smart home relays, sensors and actuators. Popular due to local control without cloud dependency 3EM consists of a small module that is plugged onto the DIN rail in the distribution cabinet and only takes up one module width. The 3EM can measure the current of 3 phases and uses contactless current transformers that are clamped around the 3 main supply lines. The connection cables are simply plugged into the 3EM, but at around 40 cm they aren’t particularly long, so you should test beforehand where you can mount the 3EM module.

IMPORTANT NOTE: Working with mains voltage is life-threatening and may only be carried out by qualified electricians, which is why there are no instructions, help or guidance for installation here. You not only endanger your life, but possibly also your insurance coverage. Contact a professional and have the device professionally commissioned!

To measure the voltage of the 3 phases, these are connected to the Shelly 3EM along with the neutral conductor, which also powers the device. Installation is done in less than 15 minutes. A green LED indicates readiness and the 3EM opens a WiFi access point. Using the free Shelly app, you can set up the 3EM and connect it to your home WiFi network.

Once that’s done, the app already shows the 3EM and current consumption data. Each phase is displayed with voltage, current and power factor. From this, the current power in watts and the total power consumption of all 3 phases is also displayed. If you create a Shelly account, the consumption data is also recorded in the Shelly Cloud and can be displayed and analyzed over long periods. You can also access the data and settings of the Shelly 3EM via a web browser using the 3EM’s IP address.

The Shelly 3EM also has a built-in relay that can switch loads up to 10 A or a contactor. The app also provides programmable switching times for this. If you operate a photovoltaic system or similar power generator, the 3EM can also measure and display the generated power.

Using the Shelly 3EM with Home Assistant

If you’re already using Home Assistant, you can conveniently display and analyze the consumption there. No Shelly Cloud is needed for this. Home Assistant already has an integration for Shelly devices. Once activated, the 3EM is automatically discovered and can be enabled.

Since version 2021.8, Home Assistant has an energy dashboard that provides information on both consumed and generated energy. The necessary entities are automatically created by the Shelly integration and you just need to select the energy entities of the Shelly’s 3 phases.

If you have a power generator such as a PV system (or a simple balcony power plant) in use, you can use the energy return entities and thus also get the generated energy displayed and analyzed.

Of course, voltage, current, power factor and current power per phase are also available as entities and can be displayed and analyzed. This makes it easy to see when consumers switch on and off. In the example, you can clearly see the short heating cycles of our Quooker boiling water tap - and how it is switched off overnight.

In Home Assistant’s history view, you can also display longer periods in detail. In the screenshot, for example, you can see the small steps caused by the fridge-freezer combination connected to phase 2.

The Shelly integration doesn’t provide an entity for the total current consumption. However, you can easily create a sensor for this yourself. To do this, create a new sensor entity that sums the current power of all 3 phases:

yaml
1
2
3
4
5
6
7
  - platform: template
    sensors:
      verbrauch_total:
        friendly_name: 'Total consumption'
        unit_of_measurement: "W"
        value_template: >-
          {{ (states('sensor.shellyem3_xyz_channel_a_power')|float + states('sensor.shellyem3_xyz_channel_b_power')|float + states('sensor.shellyem3_xyz_channel_c_power')|float)|round(0) }}

The new entity verbrauch_total is output in watts without decimal places using round(0).

Strategies for optimizing power consumption

The Shelly 3EM measures consumption in great detail and even very short events and changes in consumption are captured. However, to find out which change corresponds to which consumer, you first need to know which consumers are running on which phase. If the distribution is well documented, you can see which circuit breakers are responsible for what and which phase they are on. This allows you to narrow down the possible consumers per phase.

Many consumers such as televisions, refrigerators, ovens, dishwashers, washing machines, etc. are very easy to locate because they have very characteristic patterns and high currents, and thus peaks in consumption. However, savings can primarily be made by reducing the base load, i.e. all the consumers that each use very little power, but do so over long periods. Standby consumers such as AV receivers, satellite receivers, PCs, but also smart home devices like Alexa or Philips Hue lights can, in large numbers, cause significant consumption.

At a suitable time (early morning or at night), you should gradually disconnect all devices from the mains, reactivate them one by one, and observe the consumption. You’ll quickly discover that the TV, satellite and AV receiver together with an Apple TV device consume 40 watts in standby mode and draw power from the socket around the clock. The laptop on its charger constantly draws 10 watts because it keeps the battery topped up, and the network-connected laser printer in the study also likes 10 watts even when switched off. These 60 watts alone, at 32 ct electricity cost per kilowatt hour, cost a good 168 euros per year. With home automation or smart plugs , you can disconnect these devices from the mains when not in use, and the cost of these plugs pays for itself within just a few months.


Hi! I'm Markus – the Fricklr. ⚡ Electrical engineer, 🎵 musician (bass, guitar, keys) and professionally 'something with the internet' 🌐 for over 30 years – nowadays with AI too 🤖 – a 55-year-old generalist from Bavaria, Germany.

Your feedback helps me write even more interesting posts. After "Yes" there's also a small option to support my work.

Explore related topics

Content Map →
Show related content as a list
💡 Drag, hover & click to explore
Bigger dots are more relevant

What do you think? Leave a comment!

Share your thoughts, questions or experiences with the community.

Links marked with this symbol are affiliate links. As an Amazon Associate I earn from qualifying purchases. There are no additional costs for you.