EMHASS, Octopus Agile and Battery Optimisation... HELP

Is there any chance anyone can help here?

I’m trying to get EMHASS to start, and I can’t.

Targetting lowest overall cost.

I have…

  1. Octopus Agile Energy pricing, with 48 half hourly slots each 24hr with cost per kWh for each period. This is know about 4pm the day before.

  2. 500W heater that I can either run from grid (mains) or battery.
    HOWEVER the heater averages 73W consumption over 24hrs and consumes about 1.75kWh every 24hrs. Obviously the demand isn’t constant, but for ease let’s say it never goes about 100Wh in any 30 min period.

  3. 1kWh battery that I can charge at 1000W, which will run the heater at 500W (let’s for now assume no conversion losses).

The battery should start and the 24hr period at the same state of charge.

In Home Assistant I have the following entities…

Control

switch.office_heater_call_for_heat - this should be used for future demand prediction!

switch.office_heater_run_from_battery - run heater from battery
switch.office_heater_run_from_grid - run heater from grid
switch.office_heater_charge_battery - charge battery

Data

sensor.office_heater_battery_soc - % of battery remaining

Energy Prices fro Octopus Agile

sensor.octopus_energy_electricity_current_rate
event.octopus_energy_electricity_current_day_rates
See below for detail of attributes…

I would like EMHASS to optimise “run_from_battery”, “run_from_grid” and “charge_battery” to target minimum cost for the heat demand.

I am after a “starter config” for EMHASS that will at least let me start it… or any other ideas on how to achieve this.

Does that make any sense?

Thanks, Ben

Octopus Agile HA Entitie Detail

sensor.octopus_energy_electricity_current_rate

attributes:
state_class: total
mpan: “”
serial_number:
is_export: false
is_smart_meter: true
tariff: E-1R-AGILE-FLEX-22-11-25-B
start: “2024-01-15T14:30:00+00:00”
end: “2024-01-15T15:00:00+00:00”
is_capped: false
is_intelligent_adjusted: false
current_day_min_rate: 0.12474
current_day_max_rate: 0.37107
current_day_average_rate: 0.187215
data_last_retrieved: “2024-01-15T14:47:00.869016+00:00”
last_evaluated: “2024-01-15T14:58:01.867950+00:00”
unit_of_measurement: GBP/kWh
device_class: monetary
icon: mdi:currency-gbp
friendly_name: Electricity Current Rate

event.octopus_energy_electricity_current_day_rates

attributes:
event_types:

  • octopus_energy_electricity_current_day_rates
    event_type: octopus_energy_electricity_current_day_rates
    rates:
  • start: “2024-01-15T00:00:00+00:00”
    end: “2024-01-15T00:30:00+00:00”
    value_inc_vat: 0.1365
    is_capped: false
  • start: “2024-01-15T00:30:00+00:00”
    end: “2024-01-15T01:00:00+00:00”
    value_inc_vat: 0.14889
    is_capped: false
  • start: “2024-01-15T01:00:00+00:00”
    end: “2024-01-15T01:30:00+00:00”
    value_inc_vat: 0.1365
    is_capped: false
  • start: “2024-01-15T01:30:00+00:00”
    end: “2024-01-15T02:00:00+00:00”
    value_inc_vat: 0.12474
    is_capped: false
  • start: “2024-01-15T02:00:00+00:00”
    end: “2024-01-15T02:30:00+00:00”
    value_inc_vat: 0.1365
    is_capped: false
  • start: “2024-01-15T02:30:00+00:00”
    end: “2024-01-15T03:00:00+00:00”
    value_inc_vat: 0.13062
    is_capped: false
  • start: “2024-01-15T03:00:00+00:00”
    end: “2024-01-15T03:30:00+00:00”
    value_inc_vat: 0.14154
    is_capped: false
  • start: “2024-01-15T03:30:00+00:00”
    end: “2024-01-15T04:00:00+00:00”
    value_inc_vat: 0.13797
    is_capped: false
  • start: “2024-01-15T04:00:00+00:00”
    end: “2024-01-15T04:30:00+00:00”
    value_inc_vat: 0.14112
    is_capped: false
  • start: “2024-01-15T04:30:00+00:00”
    end: “2024-01-15T05:00:00+00:00”
    value_inc_vat: 0.14112
    is_capped: false
  • start: “2024-01-15T05:00:00+00:00”
    end: “2024-01-15T05:30:00+00:00”
    value_inc_vat: 0.16191
    is_capped: false
  • start: “2024-01-15T05:30:00+00:00”
    end: “2024-01-15T06:00:00+00:00”
    value_inc_vat: 0.14742
    is_capped: false
  • start: “2024-01-15T06:00:00+00:00”
    end: “2024-01-15T06:30:00+00:00”
    value_inc_vat: 0.168
    is_capped: false
  • start: “2024-01-15T06:30:00+00:00”
    end: “2024-01-15T07:00:00+00:00”
    value_inc_vat: 0.147
    is_capped: false
  • start: “2024-01-15T07:00:00+00:00”
    end: “2024-01-15T07:30:00+00:00”
    value_inc_vat: 0.15141
    is_capped: false
  • start: “2024-01-15T07:30:00+00:00”
    end: “2024-01-15T08:00:00+00:00”
    value_inc_vat: 0.2058
    is_capped: false
  • start: “2024-01-15T08:00:00+00:00”
    end: “2024-01-15T08:30:00+00:00”
    value_inc_vat: 0.17472
    is_capped: false
  • start: “2024-01-15T08:30:00+00:00”
    end: “2024-01-15T09:00:00+00:00”
    value_inc_vat: 0.17787
    is_capped: false
  • start: “2024-01-15T09:00:00+00:00”
    end: “2024-01-15T09:30:00+00:00”
    value_inc_vat: 0.17472
    is_capped: false
  • start: “2024-01-15T09:30:00+00:00”
    end: “2024-01-15T10:00:00+00:00”
    value_inc_vat: 0.1743
    is_capped: false
  • start: “2024-01-15T10:00:00+00:00”
    end: “2024-01-15T10:30:00+00:00”
    value_inc_vat: 0.17157
    is_capped: false
  • start: “2024-01-15T10:30:00+00:00”
    end: “2024-01-15T11:00:00+00:00”
    value_inc_vat: 0.1428
    is_capped: false
  • start: “2024-01-15T11:00:00+00:00”
    end: “2024-01-15T11:30:00+00:00”
    value_inc_vat: 0.15498
    is_capped: false
  • start: “2024-01-15T11:30:00+00:00”
    end: “2024-01-15T12:00:00+00:00”
    value_inc_vat: 0.1638
    is_capped: false
  • start: “2024-01-15T12:00:00+00:00”
    end: “2024-01-15T12:30:00+00:00”
    value_inc_vat: 0.16569
    is_capped: false
  • start: “2024-01-15T12:30:00+00:00”
    end: “2024-01-15T13:00:00+00:00”
    value_inc_vat: 0.168
    is_capped: false
  • start: “2024-01-15T13:00:00+00:00”
    end: “2024-01-15T13:30:00+00:00”
    value_inc_vat: 0.157815
    is_capped: false
  • start: “2024-01-15T13:30:00+00:00”
    end: “2024-01-15T14:00:00+00:00”
    value_inc_vat: 0.14112
    is_capped: false
  • start: “2024-01-15T14:00:00+00:00”
    end: “2024-01-15T14:30:00+00:00”
    value_inc_vat: 0.168
    is_capped: false
  • start: “2024-01-15T14:30:00+00:00”
    end: “2024-01-15T15:00:00+00:00”
    value_inc_vat: 0.16569
    is_capped: false
  • start: “2024-01-15T15:00:00+00:00”
    end: “2024-01-15T15:30:00+00:00”
    value_inc_vat: 0.14112
    is_capped: false
  • start: “2024-01-15T15:30:00+00:00”
    end: “2024-01-15T16:00:00+00:00”
    value_inc_vat: 0.203385
    is_capped: false
  • start: “2024-01-15T16:00:00+00:00”
    end: “2024-01-15T16:30:00+00:00”
    value_inc_vat: 0.30828
    is_capped: false
  • start: “2024-01-15T16:30:00+00:00”
    end: “2024-01-15T17:00:00+00:00”
    value_inc_vat: 0.37107
    is_capped: false
  • start: “2024-01-15T17:00:00+00:00”
    end: “2024-01-15T17:30:00+00:00”
    value_inc_vat: 0.35406
    is_capped: false
  • start: “2024-01-15T17:30:00+00:00”
    end: “2024-01-15T18:00:00+00:00”
    value_inc_vat: 0.36246
    is_capped: false
  • start: “2024-01-15T18:00:00+00:00”
    end: “2024-01-15T18:30:00+00:00”
    value_inc_vat: 0.3633
    is_capped: false
  • start: “2024-01-15T18:30:00+00:00”
    end: “2024-01-15T19:00:00+00:00”
    value_inc_vat: 0.36876
    is_capped: false
  • start: “2024-01-15T19:00:00+00:00”
    end: “2024-01-15T19:30:00+00:00”
    value_inc_vat: 0.21504
    is_capped: false
  • start: “2024-01-15T19:30:00+00:00”
    end: “2024-01-15T20:00:00+00:00”
    value_inc_vat: 0.2016
    is_capped: false
  • start: “2024-01-15T20:00:00+00:00”
    end: “2024-01-15T20:30:00+00:00”
    value_inc_vat: 0.21504
    is_capped: false
  • start: “2024-01-15T20:30:00+00:00”
    end: “2024-01-15T21:00:00+00:00”
    value_inc_vat: 0.17724
    is_capped: false
  • start: “2024-01-15T21:00:00+00:00”
    end: “2024-01-15T21:30:00+00:00”
    value_inc_vat: 0.20706
    is_capped: false
  • start: “2024-01-15T21:30:00+00:00”
    end: “2024-01-15T22:00:00+00:00”
    value_inc_vat: 0.15876
    is_capped: false
  • start: “2024-01-15T22:00:00+00:00”
    end: “2024-01-15T22:30:00+00:00”
    value_inc_vat: 0.1575
    is_capped: false
  • start: “2024-01-15T22:30:00+00:00”
    end: “2024-01-15T23:00:00+00:00”
    value_inc_vat: 0.1491
    is_capped: false
    min_rate: 0.12474
    max_rate: 0.37107
    average_rate: 0.187215
    mpan: “”
    serial_number:
    tariff_code: E-1R-AGILE-FLEX-22-11-25-B
    friendly_name: Electricity Current Day Rates

Hi! I also had quite a learning curve getting EMHASS to run, but I got there!
Are you using EMASS in a Docker or as add-on within HAOS? I started with HAOS-addon, but didn’t get that running. WIth Docker, you could start with the config_emhass.yaml you can find in github of the EMHASS repository. That should at least get it started, and then you can have a look at the logs within the Docker to see for any errors.
Good luck!

I am trying with Add On… but have had little joy.

I’m running HAOS, can I still use docker to run EMHASS?

I have plenty of hardware, so could run it on a separate Pi 4 with an SSD…

Thoughts?

Btw, thanks for your help!

No problem! Yes I use something similar, I have docker on a OMV6-NAS, and HAOS on separate hardware, works great!

I have EMHASS up and working now… (sorry I had to focus on other things temporarily).

Can anyone help me write a config_emhass.yml that will optimise use of battery storage to offset energy price, against a predicted demand?

Thanks, Ben

I am working on the same problem. I’ll post my config here… have you made progress?

I’ve been using Octopus Energy for a while and had not noticed how much functionality is now in the integration. Have a look at Target Rate Sensor(s) - Home Assistant Octopus Energy and see if that covers your requirement without using EMHASS.
Meanwhile I am continuing to work on feeding EMHASS with the Octopus Agile rates.