Energy sensor template

Hi There

I’ve finished the installation of my fronius solar inverter and integartion in HA .I’m trying to built some template sensors to manage the information but I can’t find them as entities`

template:
  - sensor:
      - name: grid_energy_fronius
        unit_of_measurement: 'kWh'
        value_template: "{{  (states('sensor.energy_real_consumed_fronius_meter_0_192_168_30_210') | float ) / 1000 }}"
        icon_template: mdi:grid-power    
        state_class: total_increasing
   
      - name: produced_energy_fronius
        unit_of_measurement: 'kWh'
        value_template: "{{ (states('sensor.energy_real_produced_fronius_meter_0_192_168_30_210') | float ) / 1000 }}"
        icon_template: mdi:solar-power    
        state_class: total_increasing
     

      - name: dif_prod_consumo_fronius
        unit_of_measurement: "W"
        state: >
          {% set prod = states('sensor.power_photovoltaics_fronius_power_flow_0_192_168_30_210') | float %}
          {% set consumo = states('sensor.power_load_fronius_power_flow_0_192_168_30_210') | float %}

          {{ ((prod + consumo) ) | round(1) }}        
        state_class: total_increasing

Rgds

What exact entity can’t you find? Have a look here Open your Home Assistant instance and show your state developer tools.

Do you have a Fronius Smartmeter installed?

Hi thanks for your reply

I was looking for the sensor that I’m was trying to create .
Yes I’ve a smart meter installed but till now I didn’t found the sensor that shows the energy returned to the grid

Regards

Is the smartmeter installed in grid connection path or consumption path?

Sorry can you please explain what is the difference

Regards

See here on page 3: https://www.fronius.com/~/downloads/Solar%20Energy/Quick%20Guides/SE_QG_How_To_Install_A_Fronius_Smart_Meter_EN.pdf

And maybe take a screenshot from the meters device page in HA Open your Home Assistant instance and show your devices.

Thanks

smartmeter installed in grid connection path

I may have misunderstood you. Are you looking for this entity:

or for an entity coming from the Fronius integration?

Once i didn’t found from Fronius a sensor that gives the energy returned to grid ,I was trying to create a sensor with the difference of power produced and consumed .

So returned energy is sensor.energy_real_produced_fronius_meter_0_http_<your_ip> (the _http part may not be in your actual entity_id).
The difference of power produced and consumed (this is power, not energy - so not total_increasing) is found in the SolarNet device at sensor.power_grid_fronius_power_flow_0_http_<your_ip> or the inverse sensor.power_load_fronius_power_flow_0_http_<your_ip>. This is positive on net import and negative on net export (the grid one).

Sure power is not energy but the idea is to use platform integration Rieman to transform power into energy .
How can I use sensor.power_load_fronius_power_flow_0_http_<your_ip> in HA energy dashboard for the energy returned only when it’s positive?
Regards

If you want to know how much power your house is currently using you will have to calculate:

{{ max(
(states('sensor.power_photovoltaics_fronius_power_flow_0_http_10_1_2_5') | float) +
(states('sensor.power_grid_fronius_power_flow_0_http_10_1_2_5') | float),
0) }}

You can’t because its power. I was just pointing this out because of your example in the first post.
As you already said: you would have to use Riemann integration. Or just use sensor.energy_real_produced_fronius_meter_... and sensor.energy_real_consumed_fronius_meter_... for the energy panel. See the documentation Fronius - Home Assistant
If you want to split the energy entity in a positive and negative part use something like this:

# positive values are from grid
from_grid: {{ max(states('sensor.power_grid_fronius_power_flow_0_http_192_168_68_10') | float, 0) }}
# negative values are to grid
to_grid: {{ max((0 - states('sensor.power_grid_fronius_power_flow_0_http_192_168_68_10') | float), 0) }}

Clear

Thank you very much for your support

Have a nice weekend

2 Likes