Shelly Plug S - a very small number of entities informing about power consumption?

Hi.

I have Shelly Plug S sockets - I need to control the power consumption of the connected device. Such as daily, weekly, monthly and annual consumption. Unfortunately, my socket does not have such entities. Actually, I only have two: (2) - Energy - completely useless, it measures the total energy consumed since the socket was restarted. (1) - Power - instantaneous value - is OK.

Question.
How to configure Shelly Plug S to get the valuable data I mentioned above?

Thanks in advance for all ideas.

obraz

1 Like

Hi Robert,

First of all you need to create a Riemann sum out of the power sensor.

This will create a kWh sensor.

And then you can use this sensor as source for utility meter sensors (to create daily, weekly, monthly and annual consumption sensors)

Both integrations can be set up via the Helpers menu
Settings → Devices & Services → Helpers

Thanks for your immediate response :slight_smile: I think I understand the use of: Riemann sum + Utility Meter. I only have two more specific questions (unfortunately I graduated over 20 years ago).

My source entity is: sensor.shelly_plug_aquariums_power

obraz

I made the sum:

sensor:
   - platforms: integration
     source: sensor.shelly_plug_aquariums_power
     name: aquariums_energy_spend
     unit_prefix: k
     round: 2

Questions:
Should I use additionally:

unit_time: h

and

method: 
  • if so, is it trapezoidal, left or right?

I don’t understand these two config variables at all :frowning:

Then I created the meter below (I don’t think I made a mistake).

utility_meter:
   daily_energy:
     source: sensor.shelly_plug_aquarium_energy_spend
     name: aquarium_daily_energy'
     cron: "0 0 * * 1"
   monthy_energy:
     source: sensor.shelly_plug_aquarium_energy_spend
     name: aquarium_monthly_energy
     cron: "0 0 1 * *"

Is it okay like this?

No, this is not necessary, since h is already the default value.

In case you expect that your source sensor will provide several subsequent values that are equal, you should opt for the left method to get accurate readings. Otherwise you can use the default value. Since you want to measure an aquarium, I am pretty sure the values keep changing and the default value is fine for you. Just try and check the results for plausibility.

I never used the cron option. I always just used the cycle option:

    cycle: monthly
1 Like

Thank you again. I will test - but I think that your help solves my problem of measuring electricity consumption.

RGR

You can also use the custom component “powercalc”.

There you can simply add existing power sensors and let powercalc create the energy sensors and utility meters for for different time frames for it:
https://homeassistant-powercalc.readthedocs.io/en/latest/real-power-sensor.html

But the main advantage of this custom component is that you can easy create virtual energy sensors for entities without their own energy measurement and can combine them with real energy sensors into measurement groups. I don’t want to miss “powercalc” anymore :slight_smile: