JensenNick / huawei_solar_pees

Power, Energy and Economy Sensors in Home Assistant
MIT License
49 stars 5 forks source link

Huawei Solar - PEES Buy Nick a Coffee at ko-fi.com

Power, Energy and Economy Sensors

Project Description

This project will provide you with a set of custom sensors also referred to as the "Huawei Solar PEES package" to be used in Home Assistant. These custom sensors will calculate all the power and energy flows of your Huawei FusionSolar PV installation with Battery (without the corrections we see in FusionSolar). On top of this the provided sensors will calculate expenses with and without solar PV and the Net Return of Investment (NRI) - this will give you a fairly exact idea about the profitability of your investment in several aspects.

This README guides you through a simple installation and setup process. For an overview and a more detailed description of the sensors included in the "Huawei Solar PEES package", please refer to the Wiki Pages. The experienced Home Assistant user may find this guide banal - but this is to include all users, also the ones just starting out.

Economy Sensors

Economy Sensors. Track your solar PV investment, compare it to what your economy would have been without solar PV, and track the net retur of your investment.

The provided custom sensors are based on a setup with two inverters and one battery. This is reflected throughout this README and the Wiki Pages. The custom sensors are available as a package for an easy "installation". See more about this in chapter 3. Installation.

Table of Content

  1. Before You Start
  2. Flow and Definitions
  3. Installation
    3.1 Package "Installation"
    3.2 Power Input
    3.3 Eletricity Price
  4. Specific Input Settings (optional)
    4.1 Efficiency Corrected Power Input
    4.2 Electricity Price
    4.3 Extras
  5. Known "bugs"
  6. Thanks to

1. Before You Start

The custom sensors in the "Huawei Solar PEES package" are all based on only three types of power sensors provided by the "Huawei Solar integration by wlcrs" - this makes these custom sensors robust and the margin for error is minimized. You also need sensors to provide you with current electrical prices. I use the "Energi Data Service integration by MTrab". These two custom integrations needs to be installed in Home Assistant before you start. Both of the integrations can be installed via HACS.

You also need an editor in Home Assistant to be able to edit your configuration.yaml file. I use Studio Code Server (Visual Studio Code) as an Add-on in Home Assistant.

Please note that the "Huawei Solar PEES package" is not an integration, it is a set of custom sensors I share. Please also note the number of custom sensors provided.

:exclamation: It is good practise always to create a full backup before you start. Download / store the backup file outside of Home Assistant :exclamation:

2. Flow and Definitions

The diagram below shows the definitions used for the power- and energy flows between the Solar PV, House, Battery, and Grid. These definitions are used in the naming convention of the custom sensors included in the "Huawei Solar PEES package". The diagram is fairly straightforward but take a moment to study it to get acquainted with the definitions used.

Definitions and Flows

In the Wiki Pages you will find an overview and a more detailed description of all sensors included in the "Huawei Solar PEES package".

3. Installation

The custom sensors included in the "Huawei Solar PEES package" are available for download as two files, intended to be "installed" as "packages". You can read more about packages in the Home Assistant documentation Packages.

3.1 Package "Installation"

Install the package

The "installation" is very straight forward. Each step is described in the bulleted list below. So just for the overview - the process includes configuring your configuration.yaml file, creating a directory/folder for the "Huawei Solar PEES package" files and copy/pasting the package files into the directory/folder you have created. The package files also include similar short instructions.

homeassistant:
  packages: !include_dir_named packages

Install Package

:bulb: That is it! That is all the "installation" you need to do in order to be up and running with all the custom sensors included in the "Huawei Solar PEES package" - provided that you are using the default names for the input sensors.

If you wish, you may download package files including the latest Release Note and supplemental documents like this README from the Releases Page, where you will also find previous releases.

Restart

Since the "Huawei Solar PEES package" includes platform sensors, "Restart Home Assistant" litrally means "Restart Home Assistant" (not "Quick Reload") and refresh your browser (use the browser refresh button or F5 on Windows / Cmd+Shift+R on Mac).

:exclamation: Restart Home Assistant and refresh your browser :exclamation:

The energy and economy sensors require "activity" in order for them to "start". It may take a little while before sensors register any activity/change and therefore will have the status "Unavailable" or "Unknown" initially - don't panic, be patient for the values to show. If you wish to force a sensor to start you may manually set it to "0" (zero). Please refer to the Wiki Pages where you will find a detailed guide on how to do this.

Power and Energy Cards

Once the package has been installed I suggest that you at least create the "Power Sensor Card" and the "Energy Sensor Card" in order to check that everything is working as expected. Please refer to the Wiki Pages where you will find a short guide and the code for these Lovelace cards.

:bulb: If you create the "Yield and Consumption Card" please note that this card requires the "Multi Entity Row integration" available in HACS and that this integration sometimes require that you redownload it after setting up your cards.

Adjust Output

In "Developer tools" > "States" you will find your newly added sensors, click on the "i", then click on the "cogwheel" and adjust "Display precision" and "Icon" to your liking (adjusting the precision of the sensor "here", will not affect the accuracy of the result).

3.2 Power Input

My advice is to use the default names for the power input sensors from the "Huawei Solar integration by wlcrs". If you for some reason do not wish to use the default names for the input sensor you need to make sure that the naming of your input sensors is correct.

The custom sensor in the package rely on the following power input sensors from the "Huawei Solar integration by wlcrs" inverter_input_power / inverter_input_power_2 (if you have two inverters), power_meter_active_power and battery_charge_discharge_power. The names used in "Huawei Solar PEES package" corresponds to the default names used by the "Huawei Solar integration".

If you for some reason do not wish to use the default names you need to edit the package file "huawei_solar_pees.yaml". You will find the following text lines (# = text / not part of the code) which allows for an easy global edit or search/replace.

# - 'sensor.inverter_input_power' (from the Huawei Solar integration)
# - 'sensor.inverter_input_power_2' (from the Huawei Solar integration)
# - 'sensor.power_meter_active_power' (from the Huawei Solar integration)
# - 'sensor.batteries_charge_discharge_power' (from the Huawei Solar integration)

3.3 Electricity Price

My advice is to stick with the defaul names, sensor.energi_data_service (price pr. kWh you pay for purchase/import) and sensor.energi_data_service_sale (price pr. kWh you receive for sale/export) used for the electricity price sensors. If you need help to set up the electricity price sensors in the "Energi Data Service integration by MTrab", please refer to the Wiki Pages.

If you do not wish to use the default electricity price sensors from the "Energi Data Service integration" or if you wish to use a different sensor name, please refer to chapter 4.2 Electricity Price.

3.4 Currency

You may need to correct the currency to your local currency. The currency used in the provided custom sensors is DKK (Danish Krone) and this is the price pr. kWh. This correction also has to be done in the "huawei_solar_pees.yaml" file as a global edit or search/replace.

4. Specific Input Settings (optional)

The "Huawei Solar PEES package" now include the huawei_solar_pees_input.yaml file, and as the name suggests, this file contain sensors to be used for user specific input.

You should not edit file "huawei_solar_pees_input.yaml" file. All user specific inputs are done via Lovelace / the GUI. The "Huawei Solar PEES package" also include the huawei_solar_pees_input_card.md file. This file contain the code an "input card" for Lovelace / the Home Assistant Dashboards. Here is a step by step instruction on how to set up the "input card".

:bulb: You are now set up and able to adjust your user specific input settings!

4.1 Efficiency Corrected Power Input

The default custom power input sensors do not take the inverter efficiency into account, which may result in a too high yield and other inaccuracies (house load is calculated on basis of the yield). The "Huawei Solar integration" does provide the sensor.input_power_with_efficiency_loss which takes the inverter efficiency into account. I have not tested this sensor, but my assessment is that it may cause inaccuracies and/or errors due to the step-by-step adjustment of the efficiency.

:exclamation: The "Huawei Solar PEES package" include efficiency calculations for the Huawei SUN2000 L1 and M1 models. The package will work with other inverter models, but efficiency calculations will be done on basis of the efficiency calculations set up for these two models.

Therefore and as an option I have included custom sensors which prowide you with a efficiency corrected power input. The sensors are basically created as f(x) functions based on the efficiency graphs shown in the data sheets provided by Huawei. You activate the "efficiency corrected power input sensor" in the "input card". The "Huawei Solar PEES package" will identify your inverter automatically and set the rated power accordingly. You need to adjust the voltage and the overall factor of your inverter manually.

Since the "Huawei Solar integration" and / or "Huawei"* does not provide us with the inverter input power pr. mppt it is not possible to use the provided information about string voltages. Therefore the voltage is a manual input.

Efficiency Corrected Power Input Sensors

Efficiency corrected input power graphs - yield from each inverter and the total power yield.

Here is a short description of how to set up and adjust your efficiency corrected power input sensor. It is assumed that you have created an input card from the "huawei_solar_pees_input_card.md" file.

To simplify the differense between the two slides without getting to technical, think of the overall factor as a "parrallel adjustment" (up and down) of the efficiency curve, whereas the operating voltage is "adjusting the "profile of the curve" with some reduction of efficiency".

Efficiency Graphs

Please refer to the Wiki Pages for more information about how the efficiency corrected power input sensors have been created, how they work and how they should be adjusted to your specific use case.

4.2 Electricity Price

By default the "Huawei Solar PEES package" use two electricity price sensors from the "Energi Data Service integration". If you use this and have named the sensors according to this README / the Wiki Pages, you do not need to do anything. The "text box" can be left with unknown, unavailable or (empty).

For those who use alternative electricity price sensors or sensor names, enter your sensor name in the "text box" and the calcolations made in the "HUawei Solar PEES package" will be based on those sensors. Remember to include sensor. in the name and do not include any type of brackets " or '.

Input Card Electricity Price

You need to provide two electricity price sensors as input - one which provides the price you pay pr. kWh for import/consumption and one which provides the price pr. kWh that you receive for export/sale. The two sensors used in the "Huawei Solar PEES package" are from the "Energi Data Service integration" are sensor.energi_data_service and sensor.energi_data_service_sale. These are custom names that you can give the sensors when you add/create them as entities via the integration (as per above preferably before "intalling" the "Huawei Solar PEES package").

Daily Battery Economy

Daily Battery Economy: Track your cost charging the battery from grid, lost revenue due to charging solar PV production and the savings you have discharging the battery.

4.3 Extras

Battery and Solar Panels

The input file "huawei_solar_pees_input.yaml" and the code for the Lovelace Input Card "huawei_solar_pees_input_card.md" does includes other user specific settings used by other packages that I either provide or intend to release soon. Settings for those inputs will be described in the README for those projects. Battery and Solar Panels will be used for my "Huawei Solar STAT package" which will include statistics sensors.

Electricity Price for Energy Dashboard

First of all the the "Huawei Solar - PEES package" will do a much better job tracking your savings than the Energy Dashboard, so I would of course hope you will help with development of an alternative to the Energy Dashboard using the custom sensors provided in this "package".

As of February 2024 the Energy Dashboard in Home Assistant does not support adding price sensors to calculate your savings from the consumption of energy neither directly from the solar PV installation nor from discharging your battery. The "huawei_solar_pees_input.yaml" file include the sensor.energi_data_service_negative which can be used as a price sensor if you wish to set up either sensor.energy_house_load_yield and/or sensor.energy_battery_discharge_house as "Gas consumption" og "Water consumption" to track your savings in the Energy Dashboard.

Tariffs

If you have several tariffs and/or they change from time to time, you might find it beneficial to have a sensor with the calculation of the tariff for sale/export. In the "huawei_solar_pees_input.yaml" you will find the sensor.tariff_export which you can use for this.

5. Known "bugs"

Utility Meters "jumping"

See this report (https://github.com/JensenNick/huawei_solar_pees/issues/66)

6. Thanks to

A huge thanks to;

Again, Thank You to all of You!