Maybe I can help you.
-
Install Emhass addon if you use hassos: EMHASS add-on: An energy management optimization add-on for Home Assistant OS and supervised
-
In the emhass addon configuration use the default values.
If you use Nordpool price data change “optimization_time_step”: 30, to “optimization_time_step”: 60,
If you have Solar panels change to the correct sensor which output Watt produced:
“sensor_power_photovoltaics”: “sensor.ecu_current_power”,
You must make a template sensor which output total consumed power in Watt without the deferral loads you want to control. My template is like this:
template:
- sensor:
- name: "Power load no var loads"
unique_id: fbfeef21-1aa3-4a54-b781-426f46fef597
unit_of_measurement: W
device_class: power
state: >
{% set powerload = states('sensor.power_toraldasen_32') | float(default=0) %}
{% set vvb = states('sensor.bryter_varmvannsbereder_electric_consumption_w') | float(default=0) %}
{% set varmekabler = states('sensor.power_varmekabler') | float(default=0) %}
{% set varmepumpe = states('sensor.strombryter_varmepumpe_electric_consumption_w') | float(default=0) %}
{% set value = ( powerload - vvb - varmekabler - varmepumpe) | round(1,default=0) %}
{{ value }}
which I use in Emhass config:
“sensor_power_load_no_var_loads”: “sensor.power_load_no_var_loads”,
This should give you a basic emhass config.
If you want to import the price data from Nordpool you must use the HA shell command Shell Command - Home Assistant. It is very easy to have wrong shell command. I use HA File editor to edit my shell command. Visual Studio are trying to fix without fixing the shell command.
Here are my shell commands:
shell_command:
publish_data: "curl -i -H \"Content-Type:application/json\" -X POST -d '{\"custom_deferrable_forecast_id\": [
{\"entity_id\": \"sensor.p_deferrable0\",\"unit_of_measurement\": \"W\", \"friendly_name\": \"Varmtvannsbereder\"},
{\"entity_id\": \"sensor.p_deferrable1\",\"unit_of_measurement\": \"W\", \"friendly_name\": \"VKNystue-Varmepumpe\"},
{\"entity_id\": \"sensor.p_deferrable2\",\"unit_of_measurement\": \"W\", \"friendly_name\": \"VKGmlstue-Bad2etg\"},
{\"entity_id\": \"sensor.p_deferrable3\",\"unit_of_measurement\": \"W\", \"friendly_name\": \"VKBad1etg-Kjøkken-Gang\"}
]}' http://localhost:5000/action/publish-data"
trigger_nordpool_forecast: "curl -i -H \"Content-Type: application/json\" -X POST -d '{
\"load_cost_forecast\":{{((state_attr('sensor.nordpool', 'raw_today') | map(attribute='value') | list + state_attr('sensor.nordpool', 'raw_tomorrow') | map(attribute='value') | list))[now().hour:][:24] }},
\"prod_price_forecast\":{{((state_attr('sensor.nordpool_uten_avgifter', 'raw_today') | map(attribute='value') | list + state_attr('sensor.nordpool_uten_avgifter', 'raw_tomorrow') | map(attribute='value') | list))[now().hour:][:24]}}
}' http://localhost:5000/action/dayahead-optim"
ml_forecast_fit: "curl -i -H \"Content-Type:application/json\" -X POST -d '{\"num_lags\": 24}' http://localhost:5000/action/forecast-model-fit"
ml_forecast_tune: "curl -i -H \"Content-Type:application/json\" -X POST -d '{}' http://localhost:5000/action/forecast-model-tune"
The shell command gives you services which you can use in automations:
service: shell_command.trigger_nordpool_forecast
data: {}
Here is my automation for the heat pump:
alias: "Emhass: Endre temperatur på varmepumpe. Sjekker hvert 5 minutt."
description: ""
trigger:
- platform: time_pattern
minutes: /5
condition:
- condition: time
before: "22:00:00"
after: "05:00:00"
- condition: state
entity_id: binary_sensor.effektbegrenser
state: "off"
action:
- if:
- condition: numeric_state
entity_id: sensor.p_deferrable1
above: 0.1
then:
- service: climate.set_temperature
data:
temperature: 23
hvac_mode: heat
target:
entity_id:
- climate.varmepumpe
else:
- service: climate.set_temperature
data:
temperature: 22
hvac_mode: heat
target:
entity_id:
- climate.varmepumpe
mode: single
David have done a great work with the emhass documentation. I recommend you read it before starting trying to use emhass. EMHASS: Energy Management for Home Assistant — emhass 0.4.8 documentation
If you need assistant I can help you more.
Here is my full emhass config: option.json · GitHub