Day Ahead Optimizer (DAO) is een gratis, open-source programma dat met de dynamische stroomprijzen van morgen en de weersverwachting uitrekent wanneer je thuisbatterij, elektrische auto, warmtepomp, boiler en apparaten zoals de wasmachine het best kunnen laden of draaien. DAO is gemaakt door Corneel en wordt ontwikkeld op GitHub; de Nederlandse gebruikers vind je vooral in het DAO-topic op Tweakers.

DAO rekent met een wiskundige optimalisatie (Mixed-Integer Linear Programming) het goedkoopste plan uit voor de komende uren en zet de uitkomst in helpers in Home Assistant. Je eigen automatiseringen voeren dat plan daarna uit. In deze blog lees je wat DAO doet, wat je nodig hebt en hoe je het koppelt aan Home Assistant.

Wat DAO voor je plant:

  • Thuisbatterij: laden, ontladen of 0 op de meter per kwartier of uur
  • Elektrische auto: wanneer en met welke stroom, zodat hij op tijd vol is
  • Warmtepomp en boiler: verwarmen op de goedkoopste momenten
  • Apparaten zoals wasmachine, droger en vaatwasser: de goedkoopste starttijd binnen jouw venster
  • Rapporten over verbruik, kosten, besparing en CO2 in een eigen webpagina

⚙️ Wat heb je nodig?

  • Een energiecontract met dynamische stroomprijzen (bijvoorbeeld Zonneplan, Tibber of een andere leverancier)
  • Home Assistant, met de energiesensoren die je ook voor het energiedashboard gebruikt
  • DAO als Home Assistant-add-on (Home Assistant OS) of als Docker-container
  • Een database voor DAO: SQLite, MariaDB/MySQL of PostgreSQL
  • Een gratis API-sleutel van Meteoserver voor de weersverwachting
  • Een prijsbron: Nord Pool (aangeraden), ENTSO-E, easyEnergy of Tibber

🧩 Zo werkt DAO met Home Assistant

1. Prijzen en weer ophalen

Rond 13:00 haalt DAO de day-ahead prijzen van morgen op en een paar keer per dag de weersverwachting. Dat regel je in het onderdeel scheduler van de instellingen.

2. Rekenen

Op vaste momenten (bijvoorbeeld elk uur of elk kwartier) rekent DAO het goedkoopste plan uit voor de uren waarvan de prijzen bekend zijn. Daarbij kijkt het naar de SoC van je batterij en auto, je verwachte zonne-opbrengst en je basisverbruik.

3. Helpers vullen

Het resultaat voor het eerstvolgende interval schrijft DAO naar helpers in Home Assistant: het vermogen van de batterij, de laadstroom van de auto, of de starttijd van een apparaat zoals de wasmachine. Die helpers maak je zelf aan en vul je in bij de instellingen van DAO.

4. Uitvoeren

Je eigen automatiseringen of scripts lezen die helpers en sturen je batterij, laadpaal en apparaten aan. DAO stuurt dus niet zelf je omvormer; dat doe jij in Home Assistant.

🛠️ DAO installeren als add-on

  1. Ga in Home Assistant naar Instellingen → Add-ons → Add-on-winkel, klik rechtsboven op ⋮ → Repositories en voeg https://github.com/corneel27/day-ahead/ toe.
  2. Installeer de add-on Day Ahead Optimizer en start hem.
  3. Open de webinterface (standaard poort 5000) en vul onder Config de options.json en secrets.json in. Een voorbeeld staat in de documentatie.
  4. Vul per apparaat de helpers in die DAO moet vullen, en de energiesensoren die DAO uit de Home Assistant-database leest.
  5. Start onder Run handmatig een berekening en kijk onder Home of het plan klopt.

Draai je Home Assistant niet op Home Assistant OS, dan kun je DAO als Docker-container draaien. Hoe dat werkt, staat in de documentatie van DAO.

📝 Voorbeeld: helpers voor DAO

DAO schrijft naar gewone helpers. Een paar voorbeelden; de namen kies je zelf en vul je in bij de instellingen van DAO:

input_number:
  dao_tb_power_feedin:      # DAO zet hier het batterijvermogen (W)
    min: -10000
    max: 10000
input_boolean:
  dao_ev_laadpaal_actief:   # DAO zet dit aan als de auto moet laden
input_select:
  dao_strategy:
    options:
      - minimize cost
      - minimize consumption

📊 Het plan van DAO in Home Assistant

DAO heeft een eigen webpagina met grafieken, maar je kunt het plan ook in Home Assistant halen. De rapporten van DAO zijn via een API op te vragen, bijvoorbeeld het netverbruik voor vandaag en morgen. Vervang <ip-van-dao> door het adres van je DAO-installatie:

rest:
  - resource: http://<ip-van-dao>:5000/api/report/grid/vandaag_en_morgen
    scan_interval: 3600
    timeout: 90
    sensor:
      - name: DAO planning grid
        value_template: "{{ value_json.data | count if value_json.data is defined else 0 }}"
        json_attributes:
          - data

Op dezelfde manier haal je onder meer de prijzen (da), zon (pv_ac), batterij (bat_in, bat_out), auto (ev), apparaten (mach) en SoC (soc) op. Met de data in het attribuut kun je een eigen planningskaart op je dashboard maken.

💡 Tips uit de praktijk

  • Begin met één apparaat, bijvoorbeeld de thuisbatterij, en voeg pas daarna de auto en apparaten toe. Dan zie je per stap of het plan klopt.
  • Kies de strategie bewust: minimize cost rekent op de laagste kosten, minimize consumption zo veel mogelijk op 0 op de meter tegen de laagste kosten. Sinds versie 2025.10.5 kun je de strategie ook uit een helper laten lezen.
  • Rekent DAO per kwartier, laat je eigen automatiseringen dan ook per kwartier reageren, en niet alleen op het hele uur.
  • Houd de energiesensoren in Home Assistant op orde: DAO leest het verbruik uit de Home Assistant-database om je basisverbruik te bepalen.

❓ Veelgestelde vragen

Wat kost DAO? DAO is gratis en open source. Je hebt alleen een gratis API-sleutel van Meteoserver nodig en, afhankelijk van de prijsbron, eventueel een sleutel van ENTSO-E of Tibber.

Werkt DAO met kwartierprijzen? Ja, DAO kan met prijzen per kwartier rekenen. Volgens de documentatie werkt dat met Nord Pool en Tibber; ENTSO-E staat erbij als nog niet getest.

Moet ik Home Assistant OS hebben? Voor de add-on wel. Zonder Home Assistant OS draai je DAO als Docker-container en koppel je hem met een toegangstoken (aan te maken in je profiel) aan Home Assistant.

Stuurt DAO zelf mijn batterij of laadpaal aan? Nee. DAO zet alleen helpers in Home Assistant. Je eigen automatiseringen of scripts voeren het plan uit. Kant-en-klare voorbeelden staan hieronder.

🔗 Kant-en-klaar met DAO

📚 Meer over DAO

Let op gebruik is op eigen risico!!


Day Ahead Optimizer (DAO) with Home Assistant: plan your home battery, car and appliances

Day Ahead Optimizer (DAO) is a free, open-source program that uses tomorrow’s dynamic electricity prices and the weather forecast to work out when your home battery, electric car, heat pump, boiler and appliances such as the washing machine should best charge or run. DAO is made by Corneel and developed on GitHub; most Dutch users meet in the DAO topic on Tweakers.

DAO uses mathematical optimisation (Mixed-Integer Linear Programming) to calculate the cheapest plan for the coming hours and writes the result to helpers in Home Assistant. Your own automations then carry out that plan. This blog explains what DAO does, what you need and how to connect it to Home Assistant.

What DAO plans for you:

  • Home battery: charge, discharge or zero on the meter per quarter hour or hour
  • Electric car: when and at which current, so it is full in time
  • Heat pump and boiler: heating at the cheapest moments
  • Appliances such as washing machine, dryer and dishwasher: the cheapest start time within your window
  • Reports on consumption, costs, savings and CO2 on its own web page

⚙️ What do you need?

  • An energy contract with dynamic electricity prices (for example Zonneplan, Tibber or another supplier)
  • Home Assistant, with the energy sensors you also use for the energy dashboard
  • DAO as a Home Assistant add-on (Home Assistant OS) or as a Docker container
  • A database for DAO: SQLite, MariaDB/MySQL or PostgreSQL
  • A free API key from Meteoserver for the weather forecast
  • A price source: Nord Pool (recommended), ENTSO-E, easyEnergy or Tibber

🧩 How DAO works with Home Assistant

1. Fetch prices and weather

Around 13:00 DAO fetches tomorrow’s day-ahead prices and a few times a day the weather forecast. You set this in the scheduler section of the settings.

2. Calculate

At fixed moments (for example every hour or every quarter hour) DAO calculates the cheapest plan for the hours with known prices, taking into account the SoC of your battery and car, expected solar yield and base load.

3. Fill helpers

DAO writes the result for the next interval to helpers in Home Assistant: the battery power, the car’s charge current, or the start time of an appliance such as the washing machine. You create those helpers yourself and enter them in the DAO settings.

4. Carry out

Your own automations or scripts read those helpers and control your battery, charger and appliances. So DAO doesn’t control your inverter itself; you do that in Home Assistant.

🛠️ Installing DAO as an add-on

  1. In Home Assistant go to Settings → Add-ons → Add-on store, click ⋮ → Repositories at the top right and add https://github.com/corneel27/day-ahead/.
  2. Install the Day Ahead Optimizer add-on and start it.
  3. Open the web interface (port 5000 by default) and fill in options.json and secrets.json under Config. An example is in the documentation.
  4. For each device, enter the helpers DAO should fill, and the energy sensors DAO reads from the Home Assistant database.
  5. Start a calculation manually under Run and check under Home whether the plan makes sense.

Not running Home Assistant OS? Then run DAO as a Docker container. How that works is in the DAO documentation.

📝 Example: helpers for DAO

DAO writes to ordinary helpers. A few examples; you choose the names yourself and enter them in the DAO settings:

input_number:
  dao_tb_power_feedin:      # DAO zet hier het batterijvermogen (W)
    min: -10000
    max: 10000
input_boolean:
  dao_ev_laadpaal_actief:   # DAO zet dit aan als de auto moet laden
input_select:
  dao_strategy:
    options:
      - minimize cost
      - minimize consumption

📊 The DAO plan in Home Assistant

DAO has its own web page with charts, but you can also bring the plan into Home Assistant. DAO’s reports are available via an API, for example grid consumption for today and tomorrow. Replace <ip-van-dao> with the address of your DAO installation:

rest:
  - resource: http://<ip-van-dao>:5000/api/report/grid/vandaag_en_morgen
    scan_interval: 3600
    timeout: 90
    sensor:
      - name: DAO planning grid
        value_template: "{{ value_json.data | count if value_json.data is defined else 0 }}"
        json_attributes:
          - data

In the same way you can fetch prices (da), solar (pv_ac), battery (bat_in, bat_out), car (ev), appliances (mach) and SoC (soc). With the data in the attribute you can build your own planning card on your dashboard.

💡 Tips from practice

  • Start with one device, for example the home battery, and only then add the car and appliances. That way you see at each step whether the plan is right.
  • Choose the strategy deliberately: minimize cost aims for the lowest cost, minimize consumption for zero on the meter as much as possible at the lowest cost. Since version 2025.10.5 the strategy can also be read from a helper.
  • If DAO calculates per quarter hour, let your own automations react per quarter hour too, not only on the hour.
  • Keep the energy sensors in Home Assistant in order: DAO reads consumption from the Home Assistant database to determine your base load.

❓ Frequently asked questions

What does DAO cost? DAO is free and open source. You only need a free Meteoserver API key and, depending on the price source, possibly an ENTSO-E or Tibber key.

Does DAO work with quarter-hourly prices? Yes, DAO can calculate with prices per quarter hour. According to the documentation this works with Nord Pool and Tibber; ENTSO-E is listed as not yet tested.

Do I need Home Assistant OS? For the add-on, yes. Without Home Assistant OS you run DAO as a Docker container and connect it to Home Assistant with an access token (created in your profile).

Does DAO control my battery or charger itself? No. DAO only sets helpers in Home Assistant. Your own automations or scripts carry out the plan. Ready-made examples are below.

🔗 Ready-made with DAO

📚 More about DAO

Use at your own risk!!



Geef een reactie

Je e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *