Recently we made the switch from a variable energy contract to a dynamic energy contract (ANWB Energie) with a different energy price every hour. In this blog, we’re going to talk about a new integration I’ve been working on for the past month that will be available with the Home Assistant 2023.2 release.

That new integration is EnergyZero, a company where other parties can purchase their electricity/gas according to day-ahead market prices. Well-known partners who work with EnergyZero are, for example:
All the companies mentioned above are also available as a virtual integration in Home Assistant.
The idea of dynamic prices is that you can benefit more quickly from changes in the energy market. If you adjust your own energy consumption to consumption in the cheap hours, you could save quite a bit of money. However, there is always a risk because the price can also suddenly become more expensive on average, but in general you would be cheaper than a variable energy contract*.
*at least applicable to our situation
The integration
The integration consists of 2 services, one for gas and one for electricity.
Electricity market prices

The price can be different every hour and the new prices for the next day are published every afternoon around 14:00 UTC time. The following different types of entities are created:
- Th
e
current and next hour electricity market price - Average electricity price of the day
- Lowest energy price
- Highest energy price
- Time of day when the price is highest
- Time of day when the price is at its lowest
- Percentage of the current price compared to the maximum price of the day
Gas market prices
For gas service, only the current and next hour entity are created, because the prices only change once every 24 hours, so it would not really be necessary to show the min and max, for example. The new price will be published every morning around 05:00 UTC time.
More concrete information about this new integration can also be found in the documentation.
All-in price sensor template
The prices shown in the entities are raw prices that only include the 21% VAT. To determine the current all-in price you can use the template sensor below, which add the energy tax and storage costs. The templates below are based on added prices that ANWB Energie communicates, you may still have to adjust them for your own situation.
Templates were last updated on: 3-2-2023
- sensor:
- name: EnergyZero all-in current energy price
unique_id: allin_energy_current_price
icon: mdi:cash
unit_of_measurement: "€/kWh"
state_class: measurement
state: >
{% set energy_tax = 0.1524 %}
{% set storage = 0.02118 %}
{% set current_price = states('sensor.energyzero_today_energy_current_hour_price') | float %}
{{ (current_price + energy_tax + storage) | round(4) }}
Personally, I use this entity in the Energy Dashboard to see if the calculated price in Home Assistant corresponds to what is stated in the ANWB Energie app.
You can make a similar template sensor for gas, but the added costs will be slightly different:
- sensor:
- name: EnergyZero all-in current gas price
unique_id: allin_gas_current_price
icon: mdi:cash
unit_of_measurement: "€/m³"
state_class: measurement
state: >
{% set energy_tax = 0.5927 %}
{% set storage = 0.08275 %}
{% set current_price = states('sensor.energyzero_today_gas_current_hour_price') | float %}
{{ (current_price + energy_tax + storage) | round(4) }}
It may be possible that adjustments are still needed to these templates. So far a comparison between the ANWB Energie app and the Energy Dashboard in Home Assistant, shows a small difference.
Please note that the integration does not support the mapping of every hour in Apexcharts via the attributes! This method is a workaround, that creates a bulk load of data in the state machine and is not accepted in core.
Who knows, maybe there will be better support for this in the future.
Package on PyPi
Do you want to collect the EnergyZero data in your own way and process it in another project? Then take a look at the repository of the python package, that is also on PyPi. The integration in Home Assistant also uses this package.

Alternatives
In the meantime, I’m also working on a similar integration for easyEnergy. If you still want that hourly graph in an Apexchart, try the custom integration of ENTSO-e or Nordpool.
3 comments
Thanks for the work you put in the integration for HA.
Is it possible to add an extra feature for the addition costs (see Nordpool HACS integration)?
Kind regards,
Erik
The feature was considered, but ultimately decided not to add it because the additional costs are not given by the API.
See also this post on the community forum: https://community.home-assistant.io/t/hourly-electricity-prices-netherlands/485842/67
./Klaas
Hoi Erik, Klaas,
Allereerst wil ik me aansluiten bij de complimenten en dank voor de bestaande intergraties en het energy dashboard.
Voor Erik, mss kijken op YT ik zag daar oplossingen langskomen met een hulp getal en/of template sensoren om die ‘extra kosten’ toe te voegen boven op het basis tarief. Smart home junkie kanaal oid meen ik.
Aan Klaas, kwam via een opmerking in de Victron Community weer terug op jouw spoor. Gebruik(te) vorig jaar HA met Zuijdwijks slimme meter in parallel met P1meter van ztatz.nl om de ‘stroom die over is’ via transformator en Victron PV in een batterij te laden en later te ontladen met wat slimmer stekkers. Toch een MWh in huis gehouden. Dus kon je energie Dashboard goed gebruiken 👊🏼
Voor dit jaar het idee om dat te verbeteren met een multiplus II en minder omzet verliezen.
Ik ben (nog) geen programmeur en was aan het zoeken in bestaande oplossingen, want wijs worden van bestaand werk geeft hopelijk wat sneller overzicht en/of resultaat. Kwam bij Shelly-Victron/Venus code uit van Fabian Lauer, zag daar jou remark.
Nu groeit idee twee eigenlijk sneller dan de upgrade: het moet mogelijk zijn om vanuit P1monitor of Esphome-dsmr die data te trekken en op te laten halen/plaatsen in dbus-Venus OS.
Daarmee zou ik/men in de toekomst het aankopen en plaatsen van een speciale gridmeter besparen en koppelt de bestaande DSMR aan VenusOS, als invoer voor een ESS.
Hopelijk kom ik na genoeg zelfstudie tot inzicht om deze informatie stroom opgang te krijgen en iets bij te dragen aan onze community.