Hourly electricity prices Netherlands

Perhaps a noob question, but I tried your last code and added it to my configuration.yaml and restarted. It gives me the message: This entity is no longer being provided by the rest integration. If the entity is no longer in use, delete it in settings.

Any idea I’m doing something wrong with perhaps my dashboard?

See that I missed the sensor in the code, can you try this?

sensor:
  - platform: rest
    unique_id: energyzero_prices_rest
    name: Gasprijs per uur 
    resource: https://api.energyzero.nl/v1/energyprices
    scan_interval: 900
    unit_of_measurement: "EUR/m³"
    value_template: >
        {{value_json.Prices[(now()+timedelta(hours=-1)).hour].price}}
    params:
      fromDate: >
        {{(now().strftime('%Y-%m-%d')|as_datetime).isoformat()}}Z
      tillDate: >
        {{((now()+ timedelta(days=2)).strftime('%Y-%m-%d')|as_datetime).isoformat()}}Z
      interval: 4
      usageType: 3
      inclBtw: true
    json_attributes:
        - Prices
        - readingDate

  - platform: rest
    unique_id: energyzero_powerprices_rest
    name: Stroomprijs per uur 
    resource: https://api.energyzero.nl/v1/energyprices
    scan_interval: 900
    unit_of_measurement: "EUR/kWh"
    value_template: >
        {{value_json.Prices[(now()+timedelta(hours=-1)).hour].price}}
    params:
      fromDate: >
        {{(now().strftime('%Y-%m-%d')|as_datetime).isoformat()}}Z
      tillDate: >
        {{((now()+ timedelta(days=2)).strftime('%Y-%m-%d')|as_datetime).isoformat()}}Z
      interval: 4
      usageType: 1
      inclBtw: true
    json_attributes:
        - Prices
        - readingDate

Thanks, yeah I did that but something went bad. Removed the lines, restarted, added them again and now it seems to work.

Thanks for the great code! Really useful since I moved to ANWB energy.

1 Like

FYI, I’m currently working on an integration that will allow you to retrieve EnergyZero prices. The python package is almost ready and now mainly working on fixing the last bits in the integration (like how to handle tomorrow’s retrieval before 15:00).

2 Likes

That is awesome! This will also work for ANWB customers ofcourse, which is great :slight_smile:

1 Like

Note that if you want to use “show extremas” feature, you have to change the data_generator.
Example:

type: custom:apexcharts-card
graph_span: 24h
span:
  start: day
now:
  show: true
  label: Now
header:
  show: true
  title: Energyzero Electricity Price (€/kWh)
  standard_format: true
yaxis:
  - min: 0
    decimals: 2
    apex_config:
      tickAmount: 8
      labels:
        show: true
      title:
        text: €/kWh
        style:
          fontSize: 12px
          fontFamily: Arial
          fontWeight: 500
series:
  - entity: sensor.energyzero_electricity_price
    float_precision: 3
    stroke_width: 2
    show:
      in_header: true
      extremas: true
    type: column
    opacity: 0.5
    data_generator: |
      return entity.attributes.Prices.map((record, index) => {
              return [new Date(record.readingDate).getTime(), record.price];
            });

The data generator now creates a date object.
In the series config the “show:” section is added to enable extremas (marking of the highest and lowest value)

1 Like

Just wondering: inclBTW=true

Does that mean: including ODE and energiebelasting (2 extra taxes) and ANWBs margin (per kWh or m3)

Or should I manually add these?

When I read this, only the 9/21% VAT is added to the price, so you should add the rest yourself.

image

1 Like

Seems you have to add EURO 0.18243 for every kWh
0,10908+0,0401+0,03325=0.18243

Klein foutje in de berekening? (eerste bedrag 0.019xxx ipv 0.109xxx)
Ik kom op € 0.09243

The cost work nice.
So how can I add the extra .09243 to the prize? For Electra and gas.

So I’m a bit stuck with the “how to add this to each attribute entry”.
Here’s how I calculated the extra cost for gas and electricity (as they are different)

#      = Inkoopkosten + Energiebelast +   ODE   = SUM     = incl 21% BTW
# electr   0.01908    +      0.04010  + 0.03325 = 0.09243 = 0.1118403
#    gas   0.07455    +      0.39591  + 0.09429 = 0.56475 = 0.6833475

Hi @klaasnicolaas

How are you progressing with the python package and the integration with HA?

Thanks,
Rien

I’ve already submitted this to the core repository for review, which is actually waiting for that. But in principle the integration is already usable.

And the python package can be found on PyPi, for those who want to work with code themselves:

Cool !!

So this will probably be in the 2023.1 release :slight_smile:

Great work.

3 Likes

I don’t expect it to go that fast, it’s just how fast they get to it with the backlog of PRs. But you can already use/test the code as a custom integration (in custom_components folder) in Home Assistant.

What I was still thinking about is the possibility to enter the different additional costs (inkoop, energiebelasting en ODE) in the options config_flow, so that we can create an entity that shows your net costs.

4 Likes

hello Dirk,

I was stuck on the same thing, but I solved it.
As you can see I have added it to the value_template for each.

 - platform: rest
    unique_id: energyzero_prices_rest
    name: Gasprijs per uur 
    resource: https://api.energyzero.nl/v1/energyprices
    scan_interval: 900
    unit_of_measurement: "EUR/m³"
    value_template: >
        {{value_json.Prices[(now()+timedelta(hours=-1)).hour].price + 0.56475}}
    params:
      fromDate: >
        {{(now().strftime('%Y-%m-%d')|as_datetime).isoformat()}}Z
      tillDate: >
        {{((now()+ timedelta(days=2)).strftime('%Y-%m-%d')|as_datetime).isoformat()}}Z
      interval: 4
      usageType: 3
      inclBtw: true
    json_attributes:
        - Prices
        - readingDate
  - platform: rest
    unique_id: energyzero_powerprices_rest
    name: Stroomprijs per uur 
    resource: https://api.energyzero.nl/v1/energyprices
    scan_interval: 900
    unit_of_measurement: "EUR/kWh"
    value_template: >
        {{value_json.Prices[(now()+timedelta(hours=-1)).hour].price + 0.09243}}
    params:
      fromDate: >
        {{(now().strftime('%Y-%m-%d')|as_datetime).isoformat()}}Z
      tillDate: >
        {{((now()+ timedelta(days=2)).strftime('%Y-%m-%d')|as_datetime).isoformat()}}Z
      interval: 4
      usageType: 1
      inclBtw: true
    json_attributes:
        - Prices
        - readingDate
1 Like

Hi, can you explain how to add the custom_component? i’ve copied energyzero folder from your github source into /root/config/custom_components, but that does not seem to work :slight_smile:

Got it working, “version” is missing in manifest.json thats why it did not work, made one up…

1 Like

Made some improvements and fixes for both the python package and the integration in the past 24 hours. Because a few things went wrong when the prices became 0 cents per kWh :sweat_smile:

2 Likes