EMHASS: An Energy Management for Home Assistant

Thanks for the explanation everyone!

2 Likes

Unfortunately the Tesla API only reports power for vehicles as whole numbers.

I find I get better accuracy by computing on the fly:

    ev_power:
      friendly_name: "EV Power"
      value_template: "{{ (states('sensor.ev_phases')|int(0)
                          *state_attr('sensor.duka_charger_power','charger_volts')|int(0)
                          *state_attr('sensor.duka_charger_power','charger_amps_actual')|int(0))}}"
      unit_of_measurement: W
      device_class: power

Yes Iā€™ve done the same.

FYI: Iā€™ve submitted a feature request to HA to implement in the Forecast.solar integration the possibility to have access to the forecast datapoints, which has the great benefit to rely on your lat&long for more accurate predictions.
To those using this integrationā€¦ feel free to vote it :slight_smile:
https://community.home-assistant.io/t/forecast-solar-integration-make-the-pv-power-and-energy-forecast-production-datapoints-accessible/621680

Hi all,
I try to get this to work and like to add my water heating as a deferrable load. As its not a on/off switch I need to set a temperature to start heating the water. That can be easily done by an automation. I set operating_hours_of_each_deferrable_load time of 2 hours. But EMHASS schedules this load sometimes in two different timeframes (each 1h, eg. one in the night and one at day). I have a solar system without battery and flexible grid prices. Iā€™m passing the grid prices and the solar forecasts for 24h (1h timeframe) to the dayahead-optim. As the heating may contains a large amount of watts i set the nominal_power_of_deferrable_loads to 11000 (the maximum watts). Most of the time it needs way less.

Is it possible to force EMHASS to schedule the time frame in a row?

Oh then thats totally different and extreamly variable on the answer

Has anyone managed to use the cost fun prediction for the current 24 hour only?

Im looking at mine and its $20, it seriously couldnt be so it must be calculating tomorrow in this variable.

Anyone made a temple or calc to stop at current day midnight only?

Have a look at the web UI and it will show you exactly what is included in the calculation.

There is no current way to only calculate a partial cost function.

A potential change to EMHASS could provide the cost function for each period as an attribute.

Have you taken a look at the set_def_constant parameter. It is a list containing true/false for each deferrable load. From the docs ā€œDefine if we should set each deferrable load as a constant fixed value variable with just one startup for each optimization taskā€. I am using this to control how often my pool pump is turned on an off. I must admit I donā€™t quite understand the behaviour I am seeing.

@davidusb what does ā€œfor each optimization taskā€ mean if for example I am running the MPC optimizer every 5 mins?

Hi, my solar often gets curtailed due to limits on the amount I an export to the grid (5kW). This means that EMHASS sees a lower actual value for PV production than it should (I am adding the latest actual/now value from PV production as the first element of my PV production forecast).

Is the solution here to adjust alpha and beta to reduce the weighting of the ā€œcurrent/nowā€ value in the PV forecast?

That would be a good way to manage it which I hadnā€™t thought of. Will give it a go.

Iā€™m currently using the solcast now solar forecast to keep my pv higher than the curtailed limit.

But dynamic alpha/ beta might be a better way to do this.

Im lost as to what you mean look at the web UI, its all numbers, that obviously relate to something, i dont know how i would limit that calc.

The web UI shows you how the total cost function is calculated, it is the sum of the column cost_profit.

What about also not adding the current value as first element of the forecast array?

Hello guys, does any one of you had succuss running the day ahead strategy in parallel with the machine learning one? I mean multiple instances of EMHASS via automatizations using curl command.

This is not how you should use it.
ML (machine learning) is intended as a way to create an internal model for EMHASS to better predict future consumption.
So you are expected to run it once in a while (weekly maybe).
Once you are satisfied with the ML model you can just run your optimization(s) having EMHASS using mlforacster instead of naive as load forecast method

Thanks for your swift answer, I meant using the machine learning algorithm for other purposes. For instance I want to run a machine learning algorithm to predict a roomā€™s temperature without losing my daily day-ahead automatization.

1 Like

Yes this is totally possible.
You just need to have one running instance of EMHASS.
However you can save as many machine learning models as you want. Just provide a custom name for each model to differentiate them.

For example to fit two different ML model using the forecast-model-fit endpoint then call that endpoint twice with different payloads like this:

The first payload for the first model:

runtimeparams = {
    "days_to_retrieve": 30,
    "model_type": "my_first_fancy_ML_model",
    "var_model": "sensor.home_power_consumption",
    "sklearn_model": "KNeighborsRegressor",
    "num_lags": 48,
    "split_date_delta": '48h',
    "perform_backtest": False
}

The second payload for the second ML model:

runtimeparams = {
    "days_to_retrieve": 30,
    "model_type": "my_second_fancy_ML_model",
    "var_model": "sensor.room_temperature",
    "sklearn_model": "KNeighborsRegressor",
    "num_lags": 48,
    "split_date_delta": '48h',
    "perform_backtest": False
}

Follow the same approach to use the predict and tune endpoints.

4 Likes

Thank you @davidusb, your EMHASS project is astonishing by the way. Keep it up!

2 Likes

Thanks. Missed it because its not in the HA addon settings. But even if I pass this with true to the dayahead-optim the first time it schedules the water heating in the afternoon when sun is present. I played with the settings (e.g. nom wattsā€¦) and restarted the dayahead-optim and now it always schedules it at the end of day when nearly no sun is available. Maybe thats whats ment with ā€œfor each optimization taskā€. I do not understand the behavior and how to ā€œresetā€ it.

1 Like