Giter VIP home page Giter VIP logo

goodwe-home-assistant-energy-dashboard's Introduction

goodwe-home-assistant-energy-dashboard

Why?

Because, even though you installed the Goodwe integration into Home Assistant, it is not straightforward to use the values of the Goodwee inverter in the "Energy" dashboard. In this guide, you can configure sensors in Home Assistant to display values in the Energy Dashboard

This is working for a Goodwe GW5048D-ES (castaña) inverter with a Goodwe Lynx home u battery. Probably it will work in yours, but maybe you have to adjust the "sensor.on_grid_export_power" Goodwe sensor and use the one provided by your inverter.

Source: https://github.com/mletenay/home-assistant-goodwe-inverter

Prerequisites:

  • Have the Goodwe Home Assistant integration installed and working, so all the inverter sensors are read correctly by Home Assitant.
  • Edit the configuration/configuration.yaml file and add the content of the file called "add_to_configuration.yaml"

1. Create new Sensors

Energy panel needs:

  • Sepparated sensors for buying and selling energy from the grid, and the same for the energy charged or discharged from the battery. Since Goodwe integration only provides 1 sensor for grid and other of battery with positive and negative values, it is neccesary to split them in two different sensors.
  • Sensors that provide data in kWh and not kW. This means that we have to use Riemann sum to incorporate the "h" to the kWh

1.1. Split grid sensor into buy and sell + Split battery (if you have) into charge and discharge

Just edit your configuration.yaml and add this:

Note: The new energy sensors are based on sensor.on_grid_export_power for my GW5048D-ES inverter, maybe yours has a different sensor. Same for battery.

sensor:
  - platform: template
    sensors:
      # Template sensor for values of energy bought (active_power < 0)
      energy_buy:
        device_class: energy
        friendly_name: "Energy Buy"
        unit_of_measurement: 'W'
          #        state_class: measurement
        value_template: >-
          {% if states('sensor.on_grid_export_power')|float < 0 %}
            {{ states('sensor.on_grid_export_power')|float * -1 }}
          {% else %}
            {{ 0 }}
          {% endif %}
      # Template sensor for values of energy sold (active_power > 0)
      energy_sell:
        device_class: energy
        friendly_name: "Energy Sell"
        unit_of_measurement: 'W'
          #        state_class: measurement
        value_template: >-
          {% if states('sensor.on_grid_export_power')|float > 0 %}
            {{ states('sensor.on_grid_export_power')|float }}
          {% else %}
            {{ 0 }}
          {% endif %}

      energy_battery_charge:
        device_class: energy
        friendly_name: "Energy Battery Charge"
        unit_of_measurement: 'W'
        value_template: >-
          {% if states('sensor.battery_power')|float < 0 %}
            {{ states('sensor.battery_power')|float * -1 }}
          {% else %}
            {{ 0 }}
          {% endif %}
      # Template sensor for values of energy sold (active_power > 0)
      energy_battery_discharge:
        device_class: energy
        friendly_name: "Energy Battery Discharge"
        unit_of_measurement: 'W'
        value_template: >-
          {% if states('sensor.battery_power')|float > 0 %}
            {{ states('sensor.battery_power')|float }}
          {% else %}
            {{ 0 }}
          {% endif %}

Now RESTART Home assistant (Developer Tools -> Restart)

1.2. Create sensors that transforms from kW to kWh

Continue editing configuration.yaml and add this code to the sensor parte:

#Continue from the code block above... Please, keep the indentation

  # Sensor for Riemann sum of energy bought (W -> Wh)
  - platform: integration
    source: sensor.energy_buy
    name: energy_buy_sum
    unit_prefix: k
    round: 1
    method: left
  # Sensor for Riemann sum of energy sold (W -> Wh)
  - platform: integration
    source: sensor.energy_sell
    name: energy_sell_sum
    unit_prefix: k
    round: 1
    method: left
  - platform: integration
    source: sensor.energy_battery_charge
    name: energy_battery_charge_sum
    unit_prefix: k
    round: 1
    method: left
  # Sensor for Riemann sum of energy sold (W -> Wh)
  - platform: integration
    source: sensor.energy_battery_discharge
    name: energy_battery_discharge_sum
    unit_prefix: k
    round: 1
    method: left
  - platform: integration
    source: sensor.pv_power
    name: pv_power_sum
    unit_prefix: k
    round: 1
    method: left

1.3 Add to Utility meters

From the kWh sensors we can create other calculations that can be useful in other Home Assistant places

utility_meter:
  energy_buy_daily:
    source: sensor.energy_buy_sum
    cycle: daily
  energy_buy_monthly:
    source: sensor.energy_buy_sum
    cycle: monthly
  energy_sell_daily:
    source: sensor.energy_sell_sum
    cycle: daily
  energy_sell_monthly:
    source: sensor.energy_sell_sum
    cycle: monthly
  house_consumption_daily:
    source: sensor.house_consumption_sum
    cycle: daily
  house_consumption_monthly:
    source: sensor.house_consumption_sum
    cycle: monthly

  energy_battery_charge_daily:
    source: sensor.energy_battery_charge_sum
    cycle: daily
  energy_battery_charge_monthly:
    source: sensor.energy_battery_charge_sum
    cycle: monthly
  energy_battery_discharge_daily:
    source: sensor.energy_battery_discharge_sum
    cycle: daily
  energy_battery_discharge_monthly:
    source: sensor.energy_battery_discharge_sum
    cycle: monthly

  pv_energy_daily:
    source: sensor.pv_power
    cycle: daily
  pv_energy_monthly:
    source: sensor.pv_power
    cycle: monthly

1.4. Restart Home Assitant.

Yes, you have to RESTART Home Assistant to apply the changes, so the sensors appear in the options.

2. Configure Energy Panel

Just go to Settings > Dashboard > Energy and use the new sensors.

Here is my configuration:

Maybe you want to include the energy price, both for buying and selling from the grid. You have to do it in the specific configuration of each measurement, like this:

This is the final result:

goodwe-home-assistant-energy-dashboard's People

Contributors

4lberto avatar

Stargazers

NewOakley avatar

Watchers

 avatar

goodwe-home-assistant-energy-dashboard's Issues

Missing the definition sensor.house_consumption_sum

First of all all is working great with my GW8K-ET i needed only to change the sensor.on_grid_export_power to sensor.active_power.

I get all things except the sensor.house_consumption_sum. This is not defined in the code. How need this to be done to get also this data?

thx
Alex

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.