Hi, I wanted to reflect on this comment. I will be adding the possibility to provide an initial SOC soon. But still this let me thinking, if the SOC at the beginning and at the end of a one day optimization cycle are different, then how can you prepare your battery for the next day? This contraint is there for this reason, to prepare the battery for the next day. If you set your initial SOC to high value and the target SOC at a low value, then the next day will be starting with an almost empty battery. It will be hard to optimize the battery usage if you are not thinking on a complete one day optimization period.
Iām planning to implement a real Model Predictive Control (MPC) strategy, which is based on frequent optimizations say every 10min. But with a receding horizon for your daily objectives. In that case at each optimization the battery initial SOC will be different and providing the initial SOC will make sense. Otherwise with the current state of this add-on it is better to think on a one time day ahead optimization and thus equal initial and final SOCs.
Thank you for your consideration.
As my price and costs forecasts are updating often and sometime quite changeable, I find I have to run the dayahead optimisation very often, sometime every five minutes. Which be is why I need to update initial SOC.
If I only run optimisation once a day the model will be less relevant as the day progresses.
I agree scheduling over the next 24 hrs, even if running the optimisation often is sensible and in many cases it makes a lot of sense to look ahead and schedule for a cheaper window at the start of the following day rather than an expensive window in the afternoon.
For example yesterday started with 6x thirty minutes windows after sunset with a sell price of over $13/ kWh and the model correctly forecast max battery discharge for each window, taking SOC from max to min. As it actually happened there was only one thirty minute window with a price of $10. Running dayahead optimisation regularly though those period, with manual SOC updates, resulted in an superior solution for battery charge/ discharge cycles.
The Model Predictive Control maybe better suited to my circumstances where my model inputs are charging more often than others.
Ok thanks for the answer.
In a sense youāre already applying a sort of MPC by calling the optimization routine at high frequency. Itās just that the optimization operates on a continuous sliding 24h window and you lose the one day objective approach. But I understand that this works for you and you are showing that the MPC is necessary when dealing with all that variability (load and selling costs changing). You definitely need to provide variable and different initial and final SOCs. I will be adding these soon.
It is interesting to see a different use to this. In my case here in France I only run the optimization once a day to schedule my loads. This is sufficient because load cost and PV sell prices are constant.
There are a few thing that I like by being exposed to the wholesale market price for my domestic electricity consumption. But you do need a strong will as it is a rollercoaster ride of highs and lows.
The first is I now have a much better appreciation of the time cost of energy during the day and the effect on the planet. When I was on a fixed cost energy plan I would come home at 5pm and plug in the EV drawing 12kW from the grid, because it cost me the same no matter what time of day. Now I pay the wholesale rates I am financially incentivised to charge my car at different times which minimises the financial and environmental cost.
The wholesale market also is now reflecting the amount of renewable energy in the market. Low over the midday solar soak and high demand/ high cost peaks of sunrise and sunset.
Finally as I am now exposed to these price signals it motivates me to take action I wouldnāt of otherwise done. The financial return on investment for a battery makes little sense when exposed to fixed or even TOU pricing. However when exposed to the wholesale pricing where there cost per kW can vary from negative (-2Ā¢ / kWh is the best I have seen) to massive spikes ($15/ kWh) the return for a battery investment and even tools like EMHASS become very important to minimise stress (financial & environmental) for both the household but also the grid as a whole.
I see some energy providers in France are doing a similar thing and it would be interesting to have an āenvironmental costā optimisation in EMHASS using the spot pricing from the French energy market, which could then schedule deferrable loads based on the environmental impact, even if it doesnāt match the retail pricing model.
There are not many energy providers that propose variable market pricing here in France. Barry Energy is a good example of a small energy provider that does.
I understand your analysis and it is very interesting. The variable pricing is indeed an incentive to push you to optimize your energy. Hence the motivation for me to come up with a tool like EMHASS which were otherwise inexistant or overly priced as an industrial solution. This tool should be easy to implement with the great help of HA, alleviating the stress of exposing the user to variable pricing.
It could be interesting to add this cost and compare it to the profit cost for example. What is more interesting in my opinion, is that with your variable pricing youāre matching the profit and the environmental cost at the same time.
We should think of the energy management as a complete national or even continental system. The energy that you optimize in your household at peak hours for example is the energy that is saved and avoided to be fired on a gas turbine elsewhere. As more and more users apply this, the positive impact on the whole system and the environment increases.
A final word for the MPC part. You should be careful that when launching the day ahead optimization at higher frequencies, the constraint on total energy by deferrable load may not be completely respected on a daily window analysis. Because of the sliding window optimization approach, the deferrable energy goal is also sliding, so you will need to recheck those parameters and maybe adapt them (deferrable load durations). So for example if you fixed your water heater to consume 10 kWh daily (ex: 2500 W * 4 hours) this will be completely respected by the LP optimization if you launch the optimization once a day. But it will not be completely respected if the optimization is launched on a sliding window say every 5min.
Hi!
The latest stable version of this add-on is out. A new Model Predictive Control functionality was introduced and is stable after many testing.
Update to v0.2.11: Release EMHASS add-on v0.2.11 Ā· davidusb-geek/emhass-add-on Ā· GitHub
A new release with some improvements for this add-on.
>>
v0.2.14: Release EMHASS add-on v0.2.14 Ā· davidusb-geek/emhass-add-on Ā· GitHub
Hi, Iāve just installed EMHASS in HA 2022.9.2 running on an RPi4 64bit. Took a while to even get this far!
I need to help to get started, and then most likely will need help to progress from there. Iāve looked through the documentation but I donāt really follow much of it.
Right now Iām staring at the EMHASS configuration page and having trouble understanding what all these settings are. Is there any plain English documentation which explains what each of these settings are?
I canāt find any section in the documentation about āConfigurationā, other than an obscure reference saying you need to do it.
In particular I note this statement:
You most notably will need to define the main data entering EMHASS. This will be the
sensor_power_photovoltaics
for the name of the your hass variable containing the PV produced power and the variablesensor_power_load_no_var_loads
for the load power of your household excluding the power of the deferrable loads that you want to optimize.
Iāve no idea what I am supposed to enter here. What is a āhass variableā?
I have two PV systems, a grid-tied PV system (Fronius) and an off-grid PV system (with data via HA Solar Assistant integration).
My Grid-tied PV has an export power limit (although rarely do I reach it) and the smaller off-grid array is a typical āuse it or loseā production. The home (mostly) runs via the off-grid system, which has a grid assist/pass though feature, such that during the day it passes through grid power which is mostly supplied by the grid-tied PV and at night it swaps over to running from the battery.
The small off-grid PV array mostly recharges the battery, and sometimes it gets a bit of supplemental charge from the grid-tied PV array.
Both PV systems are populating the HA Energy Dashboard with relevant inputs for grid import and export, PV production and battery charge/discharge (as well as Solcast PV forecasts and CO2 signal data). Also a handful of individual appliance power monitoring.
In the configuration settings, for sensor_power_photovoltaics
I tried to enter my Fronius PV power sensor (same as is used in the HA Energy Dashboard) and saved/restarted the EMHASS add-on but it just reverts to the default configuration settings.
So Iām stuck and not much clue where to from here.
Any pointers gratefully accepted, thanks.
Ok thatās because you only read the add-on documentation which is limited since everything is in just one page.
That is why there is a COMPLETE documentation here: EMHASS: Energy Management for Home Assistant ā emhass 0.3.20 documentation
Please go through it and if youāre still struggling post back here or as a github issue.
The configuration parameters are well explained here: Configuration file ā emhass 0.3.20 documentation
A hass variable is a Home Assistant sensor
Thanks but thatās the one I read.
It says this:
You must follow these steps to make EMHASS work properly:
- Define all the parameters in the configuration file according to your installation. See the description for each parameter in the configuration section.
OK, and I have the configuration page open, but after that Iām unsure.
- You most notably will need to define the main data entering EMHASS. This will be the
sensor_power_photovoltaics
for the name of the your hass variable containing the PV produced power and the variablesensor_power_load_no_var_loads
for the load power of your household excluding the power of the deferrable loads that you want to optimize.
I try to enter the HA entities for my grid-tied solar PV production (power) and household loads but I canāt get the configuration to stick. It just reverts to the defaults values and I donāt know what I am doing wrong.
As for the āloads excluding the deferrable loadsā, I donāt understand what HA sensor I am supposed to use for that?
Because you need to read ALL the documentation, there are also example templates for your sensors and automations.
For your question there is this in the docs
The sensor containing the load data should be specified in parameter
var_load
in the configuration file. As we want to optimize the household energies, when need to forecast the load power conumption. The default method for this is a naive approach using 1-day persistence. The load data variable should not contain the data from the deferrable loads themselves. For example, lets say that you set your deferrable load to be the washing machine. The variable that you should enter in EMHASS will be:var_load: 'sensor.power_load_no_var_loads'
andsensor_power_load_no_var_loads = sensor_power_load - sensor_power_washing_machine
. This is supposing that the overall load of your house is contained in variable:sensor_power_load
. The sensorsensor_power_load_no_var_loads
can be easily created with a new template sensor in Home Assistant.
As for this, this is the first time that I have heard of this problem. Check that you saved abd the add-on restarted correctly. Check the add-on logs
Thanks, but please understand thereās a big difference between reading documentation and understanding what it means. Iāve read it but much of it I donāt understand.
OK, thanks. It seems to have taken this time. When I scroll down, I notice there is more than one save button. Perhaps I chose the wrong one before as I donāt recall seeing two save buttons previously.
Am I not in the configuration file when attempting to fill out this page?
This is an example of me reading but not understanding.
I googled Home Assistant template sensor
but that didnāt really shed any light for me. I donāt really follow what I am suppose to do. Is this done via Helpers? I donāt see anything called a template sensor
there.
I have my system setup like this:
Have you setup template entities in Home Assistant before? Generally in the configuration.yaml or sensors.yaml files.
My sensor definition are as follows:
# sensor must always be 0 or positive (i think they always are)
- name: APF Generation Entity
device_class: power
state_class: measurement
unit_of_measurement: W
state: "{{ (states('sensor.powerwall_solar_now')|float(0)*1000)|int(0) }}"
power_load_no_var_loads:
unit_of_measurement: W
device_class: "power"
value_template: >-
{{states('sensor.powerwall_load_now')|float(0)*1000
- states('sensor.pool_heatpump_power')|int(0)
- states('sensor.pool_pumps_power')|int(0)
- states('sensor.hvac_power')|int(0)
- states('sensor.hws_power_2')|int(0)
- states('sensor.hpwc_power')|int(0)}}
No. At least not that Iām aware of.
As far as I know everything is created by whatever integration, add-on or device I add to Home Assistant.
A bit too much assumed knowledge in that Iām afraid. Lost me at about a minute in.
I see your challenge.
yaml configuration files add quite a bit of complexity to home assistant, but also a lot of power.
In 2022 the home assistant team are working hard to simplify the configuration and operation to make it accessible to more users. The helpers tab is one result where you can now setup some quite complex calculations using the GUI.
Unfortunately template sensors are not yet in this category of simple setup.
Iāll have to think of there is an alternative way to get your system operational.
If itās a matter of adding something to a yaml file, I can do that, but it needs to be clear as I donāt know how to program in yaml.
I donāt know if it helps or not but Iāll list what I think are the relevant entities (may be others in future, we have two homes + large outbuilding):
Total household loads (grid system):
sensor.power_load_fronius_power_flow_0_http_192_168_0_201
Pool Pump:
sensor.athom_smart_plug_v2_power
Dishwasher:
sensor.athom_smart_plug_v2_power_2
Clothes Washing Machine:
sensor.athom_smart_plug_v2_power_4
Clothes Dryer:
sensor.athom_smart_plug_v2_power_3
Other discretionary loads include two aircon systems which have controls integrated within Home Assistant (1 x Daikin, 1 x Sensibo) but there is no individual power measurement available for either of these loads.
PV power entities:
Grid system:
sensor.power_ac_fronius_inverter_1_http_192_168_0_201
Off-grid system:
sensor.pv_power
Battery (off-grid system):
sensor.battery_power
Battery power can be positive (charging) or negative (discharging).
I also have Solcast PV forecasts (for both the grid and off-grid PV arrays).
.
Objective is to minimise grid imports, especially peak tariff period grid imports and overnight fossil heavy grid imports.
We have a four import tariff structure (peak, shoulder, off-peak, and a controlled load off-peak), plus a single flat rate export tariff.
I have no private metering of the utility controlled load consumption as it is a separate circuit not supplied power by the PV system. It is not used much as I have a smart variable power PV diverter which powers the resistive element hot water storage system. It can also draw on the controlled load supply if necessary. The CL off-peak import tariff is higher than our PV export tariff so it is advantageous to heat our water with solar PV.
I would very much like to have independent metering of the hot water and aircon circuits (amongst others) in future, but for now that is not available. An Iotawatt would be good but I donāt have the circuit board space at the moment (3-phase supply adds complexity).