Energy dashboard: solar energy not flowing the right way?

I recently started configuring the energy dashboard.

I have a toon thermostat (rooted) which is connected to the P1 port of my smart meter and wich is linked to HA. The toon can report the energy usage to HA.

I have solar panels and a solarEdge converter, which is linked to HA with the solarEdge integration.

When I now look at the energy dashboard, it looks like all solor energy is returned to the grid and I’m using nothing myself.


This does not seem to be right. Any idea what I would need to change in the configuration?

My configuration currently looks like this:

For the “Return to grid” you have the “Lifetime Energy” sensor defined, which is also defined as “Solar Production”.
I do not know what readings the Toon meter provides you… Is it the netto grid, so it can have both negative (for consumption) and positive (for return to grid) values?
If so you will have to build some template sensors to divide that into 2 separate sensors. That way you can make there right configuration for your energy dashboard.

Thanks for pointing me in the right direction. It seems like the toon thermostat also measured the production (which is if i’m not mistaken what is returned to the grid).

So I changed my configuration to:

and now I see energy flowing both ways:

image

I’m struggling with a similar problem - it’s probably just that I don’t understand what sources we have to define exactly for the energy management.

I have 1 sensor which measures “house-to-grid” - which is my energy use from the grid (when positive) or my over-production from solar when negative. Currently I use this sensor for “Grid consumption”.

My “return to grid” configuration is empty.

My solar generation sensor is always positive, and of course I configured that as “solar production”.

This configuration works whenever I produce less solar than what I use at the house:

But when my solar production is higher then my use, the energy distribution bubbles show a wrong value for “Home”. In the example below solar production is 23.4 Kwh, return to grid is -6.7 Kwh, and the Home use should be 16.7 Kwh - but the system shows 23.4.

As somebody mentioned above I probably need to split these sensors up - but I don’t know how. What exactly should go into “grid consumption”, and what is “return to grid”. Are these 2 values just the positive and negative portions of my “house to grid” sensor?

After doing some more research I found several posts explaining that I had to split my “house-to-grid” measurement into 2: the positive part and the negative one. While the examples I found didn’t work directly for me, this is how the sensor split works for me:


template:
  - sensor:
      - name: "house to grid pos1"
        unit_of_measurement: Wh
        state_class: measurement
        device_class: energy
        state: >
          {% if states('sensor.house_to_grid_wh_accumulated') | int > 0 %}
            {{ (states('sensor.house_to_grid_wh_accumulated') | int) | abs }} 
          {% else -%}
            0
          {% endif %}      
        attributes:
          last_reset: '2021-10-17T01:45:00+00:00'
      - name: "house to grid neg1"
        unit_of_measurement: Wh
        state_class: measurement
        device_class: energy
        state: >
          {% if states('sensor.house_to_grid_wh_accumulated') | int < 0 %}
            {{ (states('sensor.house_to_grid_wh_accumulated') | int) | abs }} 
          {% else -%}
            0
          {% endif %}      
        attributes:
          last_reset: '2021-10-17T01:45:00+00:00'

Now I use these 2 sensor values for my Grid Consumption and Return to Grid in the Energy configuration. After waiting a few days I now seem to get accurate graphs.

2 Likes

This is how works for me on Wibeee Mono, thanks everyone
(sensors.yaml)

  - platform: template
    sensors:    
      grid_import_power:
        friendly_name: Grid import(+) power
        device_class: power
        unit_of_measurement: 'W'
        value_template: >-
          {% if states('sensor.wibeee_001ec02c0df0_power_factor_l1')|float > 0 %}  
            {{ states('sensor.wibeee_001ec02c0df0_active_power_l1')|float * 1 }}
          {% else %}
            {{ 0 }}
          {% endif %}
      grid_import_p:
        friendly_name: "Grid import power"
        device_class: power
        unit_of_measurement: 'W'
        value_template: >- 
          {{ states('sensor.grid_import_power')|float }}
            
  - platform: template
    sensors:  
      grid_export_power:
        friendly_name: Grid export(-) power
        device_class: power
        unit_of_measurement: 'W'
        value_template: >-
          {% if states('sensor.wibeee_001ec02c0df0_power_factor_l1')|float < 0 %}  
            {{ states('sensor.wibeee_001ec02c0df0_active_power_l1')|float * 1 }}
          {% else %}
            {{ 0 }}
          {% endif %}
      grid_export_p:
        friendly_name: "Grid export power"
        device_class: power
        unit_of_measurement: 'W'
        value_template: >- 
          {{ states('sensor.grid_export_power')|float }}

  - platform: integration
    source: sensor.grid_import_p
    name: grid_import_energy
    unit_prefix: k
    round: 2
    unit: kWh

  - platform: integration
    source: sensor.grid_export_p
    name: grid_export_energy
    unit_prefix: k
    round: 2
    unit: kWh

thx for your setup.
I have a Ferraris analog kWh counter which turns forward (Grid to house) and backwards (House/solar to grid).
Because it is still an analog kWh counter (Belgium) I have digitized the total counter with the help of a ESP32-CAM which pushed the actual analog counter to HA thanks to this nice project : GitHub - jomjol/AI-on-the-edge-device.
I was searching for a way to show correct data to and from Grid and did not find any similar setup with a analog Ferraris kWh counter here on the forum.

Now I made with the Utility integration a daily kWh counter out of the total analog kWh counter.
So each midnight it starts at 0 kWh and goes positive (if grid use) or negative (if return to grid).
I added this daily Utility kWh counter as source in your ex template sensors and added both pos & neg extra kWh sensors to the energy dashboard.
I also added my day kWh counter of solar production to the solar part of the HA energy dashboard.
I still have 1 small question: does the date last_reset matter if I use a source counter which is reset every day around 0u00) ? I now entered: last_reset: ‘1970-01-01T00:00:00+00:00’ as dummy data.

I’ll have to wait also a few days to see if it works now.

state_class: measurement
did not do anything to the energy graph so I changed this to 
state_class: total
and removed the last_reset attribute.
After some time I now get yellow positive blocks (equal to my solar production) and purple negative blocks if my solar puts more in the grid than I consume of it.
I will have to wait and see on long term if this does what i want. 
The total counter in the bubbles are right this time. 
for ex. my solar produced 40.3 kWh until now where 15.3 kWh was used by my house and 25 kWh was returned to the grid. 
My grid to house counter is still at 0 kwh because I started this template when my total day counter was negative (because of high solar production). 
So at night 0u00, the day counter will be set to zero, 
if my house use from grid goes up this grid to Home counter should increment.