Energy dashboards in Home Assistant

I spent quite some time configuring the Energy dashboard in . My primary objective was to track how much electricity my home consumes, how much my micro produces and how much I return to the grid.

Finally, this is the result:

Today is a cold and sunny day, so my heat pump consumes a lot. My 800W solar panels and 600W grid-tied microinverter make only a dent in the overall consumption (~5%). The yellow circle and line show how much energy the sun produces and the purple shows how much I send back to the grid.

I want to send back to the grid as little as possible because I get nothing in return.

Now that I can track the exported electricity in Home Assistant, I see the results and I’m quite satisfied. For example, yesterday I consumed 96% of solar energy and returned 4% to the grid:

Home assistant calculates this value automagically, but I had to buy some sensors and create some ‘virtual sensors’. The following picture shows which sensors Home Assistant needs to correctly calculate all energy flows:

  • Grid consumption sensor: I’m using a Tuya 3 phase zigbee clamp meter. I had to create additional ‘virtual’ sensor that adds solar production to the consumption. Reason: Tuya displays already reduced power (grid minus solar), because the inverter is connected to a house grid, which is after the Tuya meter.
  • Solar production: I’m using a smart plug (Aqara EU-SP01 zigbee) which tracks the production of my small photovoltaic system.
  • Return to the grid: This is a virtual sensor. I had to define it in configuration.yaml. It calculates how much is returned to the grid if Tuya sensor reports negative power on phase B (where my PV is connected).
#export to grid - if phase b power is negative, then make it positive else export is 0
  - sensor:
      - name: "Export power to grid"
        unique_id: "export_power_grid"
        state: >
          {% if states('sensor.tuya_power_b_patch') | float(0) < 0 %}
                  {{(states('sensor.tuya_power_b_patch') | float(0))*-1 | round (2) }}
          {% else %}
                  {{'0.0' | float(0) |round(2) }}
          {% endif %}
        availability: >
          {{ states('sensor.tuya_power_b_patch') | is_number }}
        unit_of_measurement: "W"
        device_class: power

How do I prevent exporting electricity to the grid? This is my first attempt: I created a simple automation which turns on water heating if export to the grid is > 150W:

Before I buy a battery system, I’ll have to think about some other ideas on how to prevent exporting to the grid… because what if the water in the boiler is already warm enough?


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *