Photovoltaics (PV) + battery + hass = maximize auto-consumption

OK, makes sense, but you leave this value at 7K for longer? I have tested today and I could use the power this way for heating up until the PV system did not deliver enough power anymore. Thank you for your support.

yes, I would keep the 7K hysterese in my regular setup…

@mastermarkush
Hi, this all looks great.
I’ve just got Solar and a powerwall and was looking for something like this.
The one bit that seems to be missing for me is the seasonality.
Where I am (UK), the solar production varies hugely throughout the year.

Do you consider this in your calculations ?
I’d need to take in the weather forecast and the date / season / solar angle or something similar to do the calculation.

Does this make sense?

Thanks,
Bruce.

Hi Bruce!
I might not fully understand what you mean by “seasonality” other than the fact that there’s more solar energy available in the summer than during the winter period. Please have a look a my most recent package that I uploaded to github and let me know if there’s any other question: https://github.com/mastermarkush/homeassistant/blob/db9e9e5eb066986c9e34e0f3891bcc2ae150d095/energy_distribution.yaml

In fact, the entire concept (in the latest version) is based on the idea of optimizing energy consumption based on real needs, available kW coming from solar and weather forecast data, at least in a light version based on openweathermap.

Best regards,
Markus

hi @mastermarkush,
wich integration have you used for BYD battery? Or can you get all batery information from inverter?

Hello Lion! This information is typically provided by the inverter that is managing the battery (in my case the Symo Hybrid), please see sensor section for the rest call used.

 - platform: rest
   resource: http://192.168.1.32/solar_api/v1/GetPowerFlowRealtimeData.fcgi
   name: Battery SOC
   unit_of_measurement: "%"
   value_template: "{{value_json.Body.Data.Inverters['1']['SOC'] | int }}"
   scan_interval: 30

The fronius integration provided in homeassistant would provide even more information regarding the battery.

1 Like

OK folks, there’s a major update to the initial version because I finally understood how to make effective use of a heat pump in a well isolated building (lol). I’m currently undergoing a hydraulic balancing of my underfloor heating system and this drastically changes the way my heat pump operates. On top of that I finally and thoroughly understood the criteria for the heat pump to run within it’s hysteresis. Leading 2 variables from @Bouni’s code for Luxtronik heat pumps on github are:

      - group: calculations
        id: ID_WEB_Temperatur_TRL_ext

which provides the temperature in the lower section of the hot water tank, where it measures the temperature of the water coming back from the consumer circuit (e.g. underfloor heating)

as well as

      - group: calculations
        id: ID_WEB_Sollwert_TRL_HZ

which derives directly from the settings in the heat pump as an indicator of the progressive heat curve, whereas it describes the “must” value of water within the heating circuit (for the boiler), flowing back into the heat pump.

Luckily I found this information in one of the helpful forums which you can find on the internet, regarding residential technical installations (e.g. https://www.haustechnikdialog.de/ in the German-speaking regions).

Here’s a diagram that I created and which now gives me all relevant information about my heat pump and attached systems:

image

The most relevant configuration files (including the diagram + code for picture element) can be found in my github repository.

  • energy_distribution.yaml -> to be deployed as a package
  • luxtronik_binary -> a collection of used binary sensors for the luxtronik heat pump
  • luxtronik_sensor -> a collection of used sensors for the luxtronik heat pump

Enjoy,
Markus

1 Like

Hi everyone, can you please help me to decide what HW I would need in order to get the relevant data into HA?
We bought a house recently with 5kW Fronius based system. It was build in 2010 so the HW is getting quite old now. The inverter is Fronisu IG 40 and the data goes into a separate box called Fronius Datalogger Box. I can’t replace anything that would change the production outcome (because of the subsidies). But the meters can be updated. As Markus said at the beginning - none of the local “experts” I asked really knew for sure but I was told I would need to add Fronius Smart Meter and replace the old Datalogger with Fronius Data Manager 2.0 Box. As you all know these parts aren’t exactly cheap so I would like to have a confirmation from anyone knowing the stuff. The goal is to see the current production and consumption in HA. Many thanks.

Hello Jay! I have myself have the Fronius Smart Meter installed. And I guess that I also have Fronius Data Manager installed in the inverters. It looks like the box is only required for systems that can not have the data manager card installed inside the inverters (maybe the older models, like yours). Have you already studied the possibility of a smart meter with clamps, based on z-wave (example Aeotech z-wave plus clamp power meter for 3 phases)? Likewise you could measure power consumption/production directly on the power cables…

Thanks Markus for your quick response. I wasn’t aware of the Aeon clamp meter. Looking at it right now - it is available over here for about €100 so I’ll give it a try. I just called a local Aeotec dealer and the guy I spoke with thinks it should be able to measure the power flow in both directions - it should show +W or -W. If so this 100 EUR piece of HW could do all I need. Many thanks, will report back in couple of days :slight_smile:

perfect. Please report back if and how it works. I believe that many of our peers would be interested in this “light-weight” method to measure bi-directional power flows!

I think that even a Shelly EM should be enough (and cheaper) to measure the energy flow. I use it myself in my home with two clamps, one for the PV and one for the appliances. Needless to say that it’s well integrated in Home Assistant. :wink:

BTW great ideas and great implementation, @mastermarkush! :star_struck:

Hey Markus, I used your picture and entities to visualize my Heatpump as well, but I’m missing the Hysteesis value, I cannot find it in your yaml code. Can you help me how to get the value?

1 Like

Damn, you’re right! I updated the file energy_distribution.yaml in my github repository, which now includes updates to the logic of the code as well as the missing heating_hysteresis sensor.
Thanks for the heads-up!
Markus

1 Like

@mastermarkush as I still have no battery and it may not even happen this year, I was in progress to get Heat pump and other consumer to run via automation. But this is limited and I would be interested in your solution you described as excess energy concept. Would you be able to share these config parts as well on your github? Thank you very much and so far a really inspiring project!

Hi Chris, you can basically find all information on my github repository already. Have a look at the energy_distribution package in particular, where you should be able to find all relevant sensor values (e.g. current household consumption, PV production in kWh, excess energy production in kWh, energy injected to grid, etc.). If you have any other question, you can send me a private message and we can take it from there.
Markus

Hi, I have just published a new topic on this subject. Is a project that I created using an optimization technique to maximize auto-consumption with PV+battery+hass. The topic can be found here:

With the github of the project here:

This is brilliant. I’ve been looking for a way to optimize my wash cycles and never occurred me this feature. Checked manual and bingo.

Cheers mate!!

i have also Fronius Hybrid and BYD Battery.

when the Battery is charging i have " - " xxxWatt
when discharge than xxxWatt

how can i change the Code in the entitie that it is more clear if charge or discharge and not the only difference the minus “-”

for example by color charging in green
discharging in red.

or any other ideas?
thanks for help. i have zero know-how in that

Here is how I differentiate between charging and discharging:

  - platform: template
    sensors:
      power_to_battery:
        value_template: >
          {% if states('sensor.solarnet_power_battery') != "unknown" and states('sensor.solarnet_power_battery') | int < 0 %}
            {{states('sensor.solarnet_power_battery') | int|abs }}
          {% else %} 0
          {%endif%}
        unit_of_measurement: "W"

  - platform: template
    sensors:
      power_from_battery:
        value_template: >
          {% if states('sensor.solarnet_power_battery') != "unknown" and states('sensor.solarnet_power_battery')  | int > 0 %}
            {{states('sensor.solarnet_power_battery') | int|abs }}
          {% else %} 0
          {%endif%}
        unit_of_measurement: "W"