Home Energy Management in 2021.8

Which images are wrong?

I’ve done all sensors using power and converted it in energy like these:

Cattura

Show me all entities available for that shelly EM device, you need to pick the energy >entities, not the power entities. Shelly EM provides both power and energy values, also >energy returned.

About Fronius:

Thanks, thanks thanks!

You don’t need to use platform: integration, because Shelly EM and Fronius already provide the appropriate energy sensors. You use integration when you have only power sensors, and you need to convert power to energy.

In your case, you need to use these for Shelly EM:

And this for Fronius:

But the Shelly EM total sensors have a wrong device_class: it says power and unit is in Wh/kWh, when it’s energy. What integration are you using for Shelly EM? Not the official Shelly one, because I’m using the official shelly integration and device_class and units are correct. My total energy sensors in Shelly EM are both in kWh, not Wh, are you using customize: to modify the attributes? Don’t do it. You need to fix all these things first.

If you use Shelly2MQTT I strongly advise to consider the official Shelly integration, the team that develops it is working very well and closely to HA dev team. Unless you have a specific reason to use the other one, obviously.

What integration are you using for Shelly EM? Not the official Shelly one, because I’m using >the official shelly integration and device_class and units are correct. You need to fix that first.

I’m using custom components called “shellyforhass”:

Anyway, i think i’ve undertand what should i do :upside_down_face:
The only thing more difficult it’s to edit shelly device_class.
I’ll post the result here if you would.
Thank you so much for your kind support!
Cheers,

Alessandro

If that’s the integration you’re using, tell them there are bugs. Device_class is wrong, and also the units. :slight_smile:

Use the official one, trust me. And pick the TOTAL sensors, in kWh, to feed the Energy Integration. I don’t use any template, nor customize, nor anything else, I simply pick the right sensors and make sure they have the correct attributes.

Ciao.

Hi Alessandro,
just a question.

Does HA recorder the consumption energy calculated through import and export grid sensors?
Or only those generated from individual devices?
My actual situation is like this (i’m using shelly official :slight_smile: )

I don’t know but it seems somethingn wrong.
Thank you so much.
Regards,

Alessandro

It tracks the sensors you are feeding it with (production, import, export) but you can also add “individual devices” (shelly plugs, EMs, or whatever you have) so you can determine which devices contribute to consumption and how. Check my Energy screenshot:

From what I see, you still have your sensors wrong: production is 2.41kwh and export is 3.71kwh, while import is 3.07kwh. The chaos is still there. :slight_smile:

How are you measuring your gas meter? It’s something I wanted to do, but the meters of the distributor are very far away and it would be a hard project, but I like to know how people are doing it. Thanks.

Hi Alessandro,
I’ve found the error.
I used a template to build import end export to grid sensors but these values had already included the photovoltaic Energy produced so, I’ve removed it twice.

About gas.
I’ve installed a custom component of my boiler Viesmann.
This custom component created a lot of sensors Like gas heating/water consumption in kwh.
I’ve created template sensors to convert kwh in mc.
That’s it.

Thank you so much.
Regards,

Alessandro

If you use Shellies, and the native integration, you don’t need any template sensor. Just pick the correct entities and you’ll be fine.

The only thing I’ve done other than configuring correctly the Energy Integration with my meter’s sensors is creating several utility meter sensors:

  total_energy_consumption:
    name: Total Energy Consumption
    source: sensor.e4u_energy_consumption
  hourly_energy_consumption:
    name: Hourly Energy Consumption
    source: sensor.e4u_energy_consumption
    cycle: hourly
  daily_energy_consumption:
    name: Daily Energy Consumption
    source: sensor.e4u_energy_consumption
    cycle: daily
  weekly_energy_consumption:
    name: Weekly Energy Consumption
    source: sensor.e4u_energy_consumption
    cycle: weekly
  monthly_energy_consumption:
    name: Monthly Energy Consumption
    source: sensor.e4u_energy_consumption
    cycle: monthly
  yearly_energy_consumption:
    name: Yearly Energy Consumption
    source: sensor.e4u_energy_consumption
    cycle: yearly

  total_energy_production:
    name: Total Energy Production
    source: sensor.e4u_energy_production
  hourly_energy_production:
    name: Hourly Energy Production
    source: sensor.e4u_energy_production
    cycle: hourly
  daily_energy_production:
    name: Daily Energy Production
    source: sensor.e4u_energy_production
    cycle: daily
  weekly_energy_production:
    name: Weekly Energy Production
    source: sensor.e4u_energy_production
    cycle: weekly
  monthly_energy_production:
    name: Monthly Energy Production
    source: sensor.e4u_energy_production
    cycle: monthly
  yearly_energy_production:
    name: Yearly Energy Production
    source: sensor.e4u_energy_production
    cycle: yearly

  total_energy_export:
    name: Total Energy Export
    source: sensor.e4u_energy_export
  hourly_energy_export:
    name: Hourly Energy Export
    source: sensor.e4u_energy_export
    cycle: hourly
  daily_energy_export:
    name: Daily Energy Export
    source: sensor.e4u_energy_export
    cycle: daily
  weekly_energy_export:
    name: Weekly Energy Export
    source: sensor.e4u_energy_export
    cycle: weekly
  monthly_energy_export:
    name: Monthly Energy Export
    source: sensor.e4u_energy_export
    cycle: monthly
  yearly_energy_export:
    name: Yearly Energy Export
    source: sensor.e4u_energy_export
    cycle: yearly

  total_energy_import:
    name: Total Energy Import
    source: sensor.e4u_energy_import
  hourly_energy_import:
    name: Hourly Energy Import
    source: sensor.e4u_energy_import
    cycle: hourly
  daily_energy_import:
    name: Daily Energy Import
    source: sensor.e4u_energy_import
    cycle: daily
  weekly_energy_import:
    name: Weekly Energy Import
    source: sensor.e4u_energy_import
    cycle: weekly
  monthly_energy_import:
    name: Monthly Energy Import
    source: sensor.e4u_energy_import
    cycle: monthly
  yearly_energy_import:
    name: Yearly Energy Import
    source: sensor.e4u_energy_import
    cycle: yearly

That is nice, unfortunately there’s nothing for my boiler. Thanks for the explanation.

Ciao,

Alessandro

Good morning,
I need help to configure 2 new sensors to be availables in the Energy Panel in addition to the original Shelly 3EM’s.

Measurements are done with Shelly 3EM in single phase, so I can measure 3 device in the same circuit and clamps are mounted as follow:
CT_A: Roof
CT_B: House
CT_C: Basement

The problem is that Basement measures includes Roof measures because the Roof circuit derivate from the Basement circuit.

Using the official Shelly integration “as is” is not an option to obtain real consuption from that areas, I need to create 2 new sensors based on total energy of available channels:

Sensor 1 (sensor.roof): same as Shelly 3EM (emeter/0/total)
Sensor 2 (sensor.house): same as Shelly 3EM (emeter/1/total)
Sensor 3 (sensor.basement): same as Shelly 3EM (emeter/2/total)
>> Sensor 4 (sensor.new_basement): to be made as (sensor.basement - sensor.roof)
>> Sensor 5 (sensor.total_home): to be made as (sensor.roof + sensor.house + sensor.new_basement)

How can I do for create Sensor 4 & Sensor 5 inside Home Assistant and for make available in Energy Panel?

I’ve tried with Node-Red and publish values in MQTT (I don’t want to create sensors directly in it) but in Energy Panel they not supply any value (are right configurated in yaml)

You need to create two template sensors: Template - Home Assistant

Gentlemen,
i am close to get this up and running.

My e3DC shows their values in W not in kWh which would be needed.
Can you tell how i can copy/clone the entities to calculate them to kWh?

i tried to import them twice on my modbus yaml.

    - name:                E3DC solar power
      unit_of_measurement: W
      address:             40067
      device_class:        power

    - name:                E3DC solar power
      unit_of_measurement: kWh
      address:             40067
      device_class:        energy
     scale: 0.001
     round: 2

but this did not work as the address was doubled and so skipped.
I have a heat pump which i could use as consumer and it shows up on the energy config.

Any tip for me?
thank you very much.
cheers A

You didn’t read the thread…

Integration - Riemann sum integral - Home Assistant (home-assistant.io)

Alex, thanks!
I did manage to create a template which re-calcuates watt into kwH.
But i will try your tip.

Have also to figure out how i can use the negative grid power and create a new sensor for splitting as well. My Grid sensor delivers -/+ values depending on direction. Battery as well.

so stay tuned :slight_smile:

Alex,
how do you understand this?
If you have a sensor that provides you with power readings in Watts (uses W as unit_of_measurement ), then you can use the integration sensor to track how much energy is being spent.

Should this reflect the live spending/producing of Watt on Kilowatt?
I configured the action but the sensor gives me some weird details. Looks nearly like a summary of kWh since its running.

- platform: integration
  name:  e3dc_solar_power_kwh
  source: sensor.e3dc_solar_power
  unit_prefix: k
  round: 2
  method: left

So my live data shows 400 Watt (now) and the riemann presents 8.x kWh.

thanks
A.

A template that does what? It’s difficult to calculate that conversion without the integral. Probably your template will never produce accurate results, or maybe it produces wrong results.

For the negative values: if negative means exported for the meter you are using, then you can easily create a template sensor that calculates the abs() of the value, then you use this to feed the integral for the exported energy. Check this post as an example.

First you have to understand the difference between power and energy:

You are comparing apples with oranges. Look at the drawing above: power is the water flow rate, energy is the amount of water in the bucket. Power is an instantaneous measured value, Energy is calculated taking into account how much power in time. Time is the key variable to understand the difference among the two. Is it clear now? :slight_smile:

Alex,
you are awesome. Thanks for your help and explanation.
So my live power calculates with the hours and kW/h is the result.
I am a absolut noob when it comes to electricity. So your help is much appreaciated!

About the template… I think we better not talk about it. But as a conclusion i used your proposal and implemented the sensor creation. Which then brought me to kWh question.

Negative values i got. These are from the grid as we give back W into the grid and if the battery is at his end we consume. As we had a sunny day while i created the sensor and we uploaded into the grid i assume this produced the total of the sensor to become negative. Same for the battery. We discharged more than we loaded. This is how i explain it… OR… i just made something badly wrong :slight_smile:
thanks Alex!
armin
PS here are some screenshots.
grid
house_consumption
solar
battery

Got it up and running.
Had to split the values negative/positve into different sensors.
But now it does not look so bad.
But how can i adjust the “self consumed solar energy” for today its foggy and cloudy with a bit of rain the solar energy produced went into the house but the picture shows into the grid.

obviously, like I suggested previously, if you have a sensor that gives you in one value export+import based on the sign, you need to first split it in 2 sensors and use abs() to make the negative absolute value the exported energy sensor. glad you understood how it worked. :slight_smile:

self-consumed is calculated based on production/import/export sensors, if those 3 values are correct, autoconsumption (or self-consumption) is calculated correctly. So please check those 3 sensors.

Generally, take this into account:

Autoconsumption = Production - Export
Total Consumption = Import + Autoconsumption

This is how I get data (both power and energy) from my three-phase meter (Elios4You), as you can see, the Autoconsumption value is derived from other values.

You noticed that I don’t want to give you quick solutions or workarounds, I want you to understand, so you can fix it yourself and maybe do things in a better way, and in the end being able to help others. I learned and still learning a lot reading other people here on the forum, and after more than 1y I try to help as I can.

If I’m not clear enough, please tell me…:slight_smile:

Ciao,

Alessandro

buonasera Alessandro, ancora grazie mille per l’aiuto!
alora, back to the drawing board for me. :slight_smile:

i will go through and see how i fiddle this out. your chart helps a lot.
I might draw it down and look what i can map against it.
Especially this:
Autoconsumption = Production - Export
Total Consumption = Import + Autoconsumption

Stay tuned… Enjoy your evening!
best regards armin

but still something on the flow chart bothers me
Solar to House - line is there but i don’t see a “dot” moving from solar to house while from solar to grid is one.
Battery to Grid - this should not be there at all as we do not load the battery through the grid nor we discharge it into it,

.2021-11-13_21-26-40

Solar to Grid is the summary out of : Solar production - battery charging - own consumption (house)
Solar to House: there is no option to configure on the Gui
Same for Solar to battery.
At least i could not find one.