Zonneplan ONE custom component

That’s it. Don’t know what you are missing - I stopped calculating knowing I am paying so much less than everyone else around me :grin:

Agree though this is the one element where zonneplan should improve, give access to an XML file containing detailed calculations. That’s what Frank offers. But then again they are much more expensive.

Did zonneplan increase its prices? My zonneplan integration shows ca. 2c higher prices vs the zonneplan app since yesterday night. Anyone else observing the same?

Is there anyone who can help me with this. i reinstalled the integrations and authorized the api again. But no result.

Many sensors are by default disabled. Would suggest to check if you can enable these first (on the integration page) - typically takes a few minutes. If that doesn’t work enable debugging and post logs. Best to do this on GitHub.

Confirmation is in, zonneplan increased its fees for electricity by a factor 8 and for gas by 2.3 times. Effective 1 July and seemingly already included in the API. This means for the coming weeks there is a mismatch. (Apart from the fact that they no know shame at zonneplan as this coincides with implementation of a 2 month prepayment as opposed to currently in arrears.; Heavily discussed on tweakers for those interested)

I hope someone can point me in the right direction.
This entity is not working:
sensor.zonneplan_current_electricity_tariff
While this one works:
sensor.zonneplan_current_gas_tariff
Both are enabled. If I click on the status of the gas tariff entity I get a nice little graph with the history, where for the electricity tariff entity I get “No statistics found”.

Any idea how to trace this entity being empty? I want to automate stuff based on the electricity prices.

Looking in the logging I get a lot of errors like these:
WARNING (MainThread) [custom_components.zonneplan_one.coordinator] Could not find price of summary_data.price_per_hour.24.price
Sometimes for different hours than 24, but I don’t care about the forecast.

I do get this:
2023-05-27 17:02:26.841 DEBUG (MainThread) [custom_components.zonneplan_one.sensor] Value Zonneplan current electricity tariff: None [None]

2023-05-27 17:02:26.841 DEBUG (MainThread) [custom_components.zonneplan_one.sensor] Update Zonneplan current electricity tariff: None

Gas does work:
2023-05-27 17:02:26.801 DEBUG (MainThread) [custom_components.zonneplan_one.sensor] Value Zonneplan current gas tariff: 0.9555587999999999 [9555588]

2023-05-27 17:02:26.802 DEBUG (MainThread) [custom_components.zonneplan_one.sensor] Skipped update Zonneplan current gas tariff: 2023-05-27 16:44:24.208359+02:00 (last update) >= 2023-05-27 06:00:00+02:00 (update today)

I hope this helps.

EDIT: I had to update, I’m fairly new and I missed the HACS updates are in a different list in home assistant. I get the tariffs now, should all be OK

Updated the zonneplan plotly chart with now (as from @Hmmbob) and average in legend and chart
(ignore the space in the bottom of the chart due to yesterdays tariffs)
Copy and reuse if you like :wink:

image

type: custom:plotly-graph
title: Zonneplan electricity forecast
hours_to_show: 18
time_offset: 14h
fn: |
  $fn ({ hass, vars }) => {
    vars.x = []; vars.y = []; vars.color = []; vars.hover = []
    vars.min = {p: 999,t: null}; vars.max = {p:-999,t:null}
    vars.ymin = 999; vars.ymax = -999
    vars.unit_of_measurement = hass.states['sensor.zonneplan_current_electricity_tariff'].attributes.unit_of_measurement
    vars.now = {t: Date.now(), p: parseFloat(hass.states['sensor.zonneplan_current_electricity_tariff'].state)} 
    vars.now.h = "<b>" + vars.now.p.toFixed(3) + "</b> " + vars.unit_of_measurement + " @now " 
    vars.avg = { p: 0, c: 0 }
    hass.states['sensor.zonneplan_current_electricity_tariff']?.attributes?.forecast?.map(e => {
      var t = new Date(e.datetime).getTime()+1800000 
      var p = e.electricity_price/10000000
      vars.avg.p += p
      vars.avg.c++
      var c = e.tariff_group.replace("low", "#00a964").replace("normal", "#365651").replace("high","#ed5e18")
      if (t>=Date.now()-1800000) {
        if (p<vars.min.p) vars.min = {p,t,c}
        if (p>vars.max.p) vars.max = {p,t,c}
      }
      if (p<vars.ymin) vars.ymin = p
      if (p>vars.ymax) vars.ymax = p
      vars.x.push(t)
      vars.y.push(p)
      vars.color.push(c)
      vars.hover.push(String(new Date(t).getHours()).padStart(2,"0") + "-" + 
        String(new Date((new Date(t).getTime()+3600000)).getHours()).padStart(2,"0") + ": <b>" + 
        p.toFixed(3) + "</b> " + vars.unit_of_measurement)
    })
    vars.min.h = "<b>" + vars.min.p.toFixed(3) + "</b> " + vars.unit_of_measurement + " @ " + new Date(vars.min.t).getHours() + ":00"
    vars.max.h = "<b>" + vars.max.p.toFixed(3) + "</b> " + vars.unit_of_measurement + " @ " +  new Date(vars.max.t).getHours() + ":00"
    vars.avg.p = vars.avg.p / vars.avg.c
    vars.avg.h = "<b>" + vars.avg.p.toFixed(3) + "</b> " + vars.unit_of_measurement + " average"
    // console.log(vars)
  }
layout:
  yaxis:
    fixedrange: true
    tickformat: .2f
    range: $fn ({vars}) => [ vars.ymin-0.02, vars.ymax+0.02 ]
  xaxis:
    tickformat: '%H:%M'
config:
  displayModeBar: false
entities:
  - entity: ''
    unit_of_measurement: $ex vars.unit_of_measurement
    showlegend: false
    x: $ex vars.x
    'y': $ex vars.y
    marker:
      color: $ex vars.color
    type: bar
    hovertemplate: $ex vars.hover
  - entity: ''
    mode: markers
    textposition: top
    showlegend: true
    name: $ex vars.min.h
    hovertemplate: $ex vars.min.h
    yaxis: y0
    marker:
      symbol: diamond
      color: $ex vars.min.c
      opacity: 0.7
    x:
      - $ex vars.min.t
    'y':
      - $ex vars.min.p
  - entity: ''
    mode: markers
    textposition: top
    showlegend: true
    name: $ex vars.max.h
    hovertemplate: $ex vars.max.h
    yaxis: y0
    marker:
      symbol: diamond
      color: $ex vars.max.c
      opacity: 0.7
    x:
      - $ex vars.max.t
    'y':
      - $ex vars.max.p
  - entity: ''
    mode: markers
    textposition: top
    showlegend: true
    name: $ex vars.now.h
    hovertemplate: $ex vars.now.h
    yaxis: y0
    marker:
      symbol: diamond
      color: deepskyblue
      opacity: 0.7
    x:
      - $ex vars.now.t
    'y':
      - $ex vars.now.p
  - entity: ''
    name: Now
    hovertemplate: Now
    yaxis: y9
    showlegend: false
    line:
      width: 1
      dash: dot
      color: deepskyblue
      opacity: 0.7
    x: $ex [vars.now.t, vars.now.t]
    'y':
      - 0
      - 1
  - entity: ''
    name: $ex vars.avg.h
    hovertemplate: $ex vars.avg.h
    yaxis: y0
    showlegend: true
    line:
      width: 1
      dash: dot
      color: lightgrey
      opacity: 0.7
    'y': $ex [vars.avg.p, vars.avg.p]
    x: $ex [vars.x[0], vars.x[vars.x.length-1]]
1 Like

Nice, I’ll implement that too!

Do you have an updated version of these charts. I cant seem to get this working with the recent changes…
The data is there, only the bars are not showing…
image

This is the full code:

type: custom:stack-in-card
cards:
  - type: horizontal-stack
    cards:
      - type: custom:mushroom-template-card
        entity: sensor.avg_energy_price
        secondary: Gemiddeld tarief
        primary: € {{ states('sensor.avg_energy_price') | round(2) }} /kWh
        icon: mdi:currency-eur
        icon_color: orange
        tap_action:
          action: more-info
      - type: custom:mushroom-template-card
        entity: sensor.hours_low_coming
        secondary: Goedkoopste tarief
        primary: Over {{ states('sensor.hours_low_coming_far') | round(0) }} uur
        icon: mdi:clock-check
        icon_color: orange
        tap_action:
          action: more-info
      - type: custom:mushroom-template-card
        entity: sensor.zonneplan_current_electricity_tariff
        secondary: Huidig tarief
        primary: >-
          € {{ states('sensor.zonneplan_current_electricity_tariff') | round(2)
          }} /kWh
        icon: mdi:currency-eur
        icon_color: orange
        tap_action:
          action: more-info
  - type: custom:config-template-card
    variables:
      MOVINGAVERAGE: states['sensor.avg_energy_price_cnt']
    entities:
      - ${MOVINGAVERAGE.entity_id}
    card:
      type: custom:apexcharts-card
      apex_config:
        chart:
          height: 200px
          fontFamily: Raleway,sans-serif
        xaxis:
          labels:
            format: HH
        legend:
          show: false
        stroke:
          width: 2
        plotOptions:
          bar:
            columnWidth: 100%
        grid:
          show: true
          borderColor: '#00000030'
          strokeDashArray: 4
          position: back
        dataLabels:
          offsetY: -8
          background:
            opacity: 0.01
            enabled: true
            foreColor: '#CF7524'
            padding: 2
            borderRadius: 4
            borderWidth: 0
          style:
            fontSize: 9px
            color: rgb(200,200,200)
      experimental:
        color_threshold: true
      graph_span: 30h
      span:
        start: day
        offset: +6h
      update_interval: +1h
      header:
        title: Zonneplan Forecast
        show: true
      now:
        show: true
        label: NOW
      series:
        - entity: sensor.zonneplan_current_electricity_tariff
          color_threshold:
            - value: ${MOVINGAVERAGE.state * .50}
              color: '#7bd75d'
            - value: ${MOVINGAVERAGE.state * .50}
              color: '#7bd75d'
            - value: ${MOVINGAVERAGE.state * .75}
              color: '#228B22'
            - value: ${MOVINGAVERAGE.state * 1}
              color: '#d35400'
            - value: ${MOVINGAVERAGE.state * 1.25}
              color: '#c0392b'
          show:
            extremas: true
          type: column
          float_precision: 2
          data_generator: |
            return entity.attributes.forecast.map((entry) => {
              return [new Date(entry.datetime), entry.electricity_price/10000000];
            });
      yaxis:
        - id: '1'
          decimals: 1
          min: 10
          apex_config:
            tickAmount: 6

Yeah. There has been a change in the component.

Below is the one that works for me know. To be honest, not sure what has to be changed. Was a few weeks ago.

type: custom:stack-in-card
cards:
  - type: horizontal-stack
    cards:
      - type: custom:mushroom-template-card
        entity: sensor.avg_energy_price
        secondary: >
          {{ states('sensor.lowest_price') | round(1) }}/{{
          states('sensor.highest_price') | round(1) }} 
        primary: |
          {{ states('sensor.avg_energy_price_CNT') | round(2) }} € ct 
        icon: mdi:power-plug
        icon_color: orange
        tap_action:
          action: more-info
      - type: custom:mushroom-template-card
        entity: sensor.hours_low_coming
        secondary: |
          {{ states('sensor.hours_low_coming_short') | round(0) }} urgent
        primary: >
          {{ states('sensor.hours_low_coming') | round(0) }}/{{
          states('sensor.hours_low_coming_far') | round(0) }} H
        icon: mdi:clock-check
        icon_color: orange
        tap_action:
          action: more-info
      - type: custom:mushroom-template-card
        entity: sensor.zonneplan_current_gas_tariff
        secondary: |
          Gas
        primary: |
          {{ states('sensor.zonneplan_current_gas_tariff') | round(2) }} € 
        icon: mdi:gas-burner
        icon_color: orange
        tap_action:
          action: more-info
  - type: custom:config-template-card
    variables:
      MOVINGAVERAGE: states['sensor.avg_energy_price_cnt']
    entities:
      - ${MOVINGAVERAGE.entity_id}
    card:
      type: custom:apexcharts-card
      apex_config:
        chart:
          height: 200px
          fontFamily: Raleway,sans-serif
        xaxis:
          labels:
            format: HH
        legend:
          show: false
        stroke:
          width: 2
        plotOptions:
          bar:
            columnWidth: 100%
            borderRadius: 5
        grid:
          show: true
          borderColor: '#00000030'
          strokeDashArray: 4
          position: back
        dataLabels:
          offsetY: -8
          background:
            opacity: 0.01
            enabled: true
            foreColor: '#CF7524'
            padding: 2
            borderRadius: 4
            borderWidth: 0
          style:
            fontSize: 9px
            color: rgb(200,200,200)
      experimental:
        color_threshold: true
      graph_span: 30h
      span:
        start: day
        offset: +4h
      update_interval: +1h
      header:
        title: Zonneplan Forecast
        show: false
      now:
        show: true
        label: NOW
      series:
        - entity: sensor.zonneplan_current_electricity_tariff
          color_threshold:
            - value: ${MOVINGAVERAGE.state * .75}
              color: '#228B22'
            - value: ${MOVINGAVERAGE.state * 1}
              color: '#d35400'
            - value: ${MOVINGAVERAGE.state * 1.25}
              color: '#c0392b'
          show:
            extremas: true
          type: column
          float_precision: 2
          data_generator: |
            return entity.attributes.forecast.map((entry) => {
              return [new Date(entry.datetime).getTime(), entry.electricity_price /100000] ;
            });
      yaxis:
        - id: '1'
          decimals: 0
          min: 10
          apex_config:
            tickAmount: 4
            forceNiceScale: true

Ah I See, I found out that the biggest change is:

return [new Date(entry.datetime).getTime(), entry.electricity_price /100000] ;

vs mine: return [new Date(entry.datetime), entry.electricity_price/10000000];

When I change those I’m getting a nice chart, but the prices are in euro instead of cent:
image

What are your templates?
Mine:

    - platform: template
      sensors:
        avg_energy_price_cnt:
          friendly_name: Average current energy price cent
          unique_id: avg_energy_price_cnt
          value_template: >
            {% set ns = namespace(sum = 0, count = 0) %}
            {% for item in state_attr('sensor.zonneplan_current_electricity_tariff', 'forecast') -%}
              {% if as_datetime(item.datetime).date() == now().date()  %}
                {% set ns.sum = ns.sum +  item.electricity_price %}
                {% set ns.count = ns.count + 1 %}
              {% endif %}
            {%- endfor %}
            {{ (ns.sum/ns.count/100000) }}

    - platform: template
      sensors:
        avg_energy_price:
          friendly_name: Average current energy price
          unique_id: avg_energy_price
          device_class: monetary
          value_template: >
            {% set ns = namespace(sum = 0, count = 0) %}
            {% for item in state_attr('sensor.zonneplan_current_electricity_tariff', 'forecast') -%}
              {% if as_datetime(item.datetime).date() == now().date()  %}
                {% set ns.sum = ns.sum +  item.electricity_price %}
                {% set ns.count = ns.count + 1 %}
              {% endif %}
            {%- endfor %}
            {{ (ns.sum/ns.count/10000000) }}

I am happily using the Zonneplan ONE custom component for the forecast.

I have created a template sensor which calculates the best moment to charge my EV.
The template depends on a sensor which calculates the charging demand in hours. The template sensor state will be the cheapest moment to start the charge according the current Zonneplan forecast. Additionally the sensor also has attributes with the cheapest timeslot

  • in coming 12 hours
  • till midnight

2023-05-31 11_12_00-Škoda Enyaq Coupé – Home Assistant

- unique_id: 'd86b6fa4-9390-4887-88cc-1d37d29f27d9'
  icon: mdi:finance
  device_class: timestamp
  state: >
    {{ this.attributes.timeslot_start }}
  name: >
    {% set demand = this.attributes.hours_demand|int(1) %}
    {% set phrase = 'h' if count == 1 else 'hrs' %}
    Cheapest timeslot for {{demand}}{{phrase}} demand
  attributes:
    hours_demand: >
      {{states('sensor.ev_calculated_nett_battery_charging_requirement_hours')|int(1)}}
    hours_till_midnight: >
      {{24 - (now().timestamp() | timestamp_custom('%H') | int(0))}}
    forecast: >
      {% set price_unknown=99999999999999 %}
      {% set price_factor=10000000 %}
      {% set forecast = namespace(forecast_array=state_attr('sensor.zonneplan_current_electricity_tariff', 'forecast'),avg_price_arr=[]) %}
      {% set hours_demand = states('sensor.ev_calculated_nett_battery_charging_requirement_hours')|int(1) %}
      {% for n in range(hours_demand) %}
      {%   set forecast.forecast_array=forecast.forecast_array + [{'electricity_price':price_unknown,'datetime': (((forecast.forecast_array[forecast.forecast_array|length-1].datetime|as_timestamp) + 3600)|timestamp_custom('%Y-%m-%d %H:00:00%z', True))}] %}
      {% endfor %}
      {% for forecasthour in forecast.forecast_array %}
      {%   if as_timestamp(forecasthour.datetime) >= now().timestamp() | timestamp_custom('%Y-%m-%d %H:00:00%z') | as_timestamp %}
      {%     set timeslot = forecasthour.datetime %}
      {%     set avg_price_for_hours_demand = ((forecast.forecast_array[loop.index0 : loop.index0 + hours_demand] | sum(attribute='electricity_price')) / price_factor) / hours_demand %}
      {%     set timeslot_price = forecast.forecast_array[loop.index0].electricity_price / price_factor %}
      {%     set forecast.avg_price_arr=forecast.avg_price_arr + [{'timeslot_start': timeslot, 'avg_price': avg_price_for_hours_demand, 'start_price': timeslot_price }] %}
      {%   endif %}
      {% endfor %}
      {{ forecast.avg_price_arr }}
    timeslot_start: >
      {{ (this.attributes.forecast|sort(attribute='avg_price'))[0].timeslot_start }}
    timeslot_start_till_midnight: >
      {% set hours_till_midnight = 24 - (now().timestamp() | timestamp_custom('%H') | int(0)) %}
      {{ (this.attributes.forecast[0: hours_till_midnight]|sort(attribute='avg_price'))[0].timeslot_start }}
    timeslot_start_12_hours: >
      {{ (this.attributes.forecast[0: 12]|sort(attribute='avg_price'))[0].timeslot_start }}
2 Likes

I have visualized the EV Charge advise in plotly

type: custom:plotly-graph
title: $ex hass.states['sensor.zonneplan_status_tip'].state
hours_to_show: 20
time_offset: 16h
fn: |
  $fn ({ hass, vars }) => {
    vars.x = []; vars.y = []; vars.color = []; vars.opacity = []; vars.hover = []
    vars.min = {p: 999,t: null}; vars.max = {p:-999,t:null}
    vars.ymin = 999; vars.ymax = -999
    vars.unit_of_measurement = hass.states['sensor.zonneplan_current_electricity_tariff'].attributes.unit_of_measurement
    vars.gas_p_now = parseFloat(hass.states['sensor.zonneplan_current_gas_tariff'].state)
    vars.gas_unit_of_measurement = hass.states['sensor.zonneplan_current_gas_tariff'].attributes.unit_of_measurement
    vars.now = {t: Date.now(), p: parseFloat(hass.states['sensor.zonneplan_current_electricity_tariff'].state)} 
    vars.now.h = "<b>" + vars.now.p.toFixed(4) + "</b> " + vars.unit_of_measurement + " @ nu " 
    vars.avg = { p: 0, c: 0 }
    vars.avg_f = { p: 0, c: 0, t: new Date().getTime() }
    hass.states['sensor.zonneplan_current_electricity_tariff']?.attributes?.forecast?.map(e => {
      var t = new Date(e.datetime).getTime()+1800000 
      var p = e.electricity_price/10000000
      vars.avg.p += p
      vars.avg.c++
      if (t<Date.now()+1800000) {
        vars.avg_f.t = t
      } else {
        vars.avg_f.p += p
        vars.avg_f.c++
      }
      
      var c = e.tariff_group.replace("low", "#00a964").replace("normal", "#365651").replace("high","#ed5e18")
      if (t>=Date.now()-1800000) {
        if (p<vars.min.p) vars.min = {p,t,c}
        if (p>vars.max.p) vars.max = {p,t,c}
      }
      if (p<vars.ymin) vars.ymin = p
      if (p>vars.ymax) vars.ymax = p
      vars.x.push(t)
      vars.y.push(p)
      vars.color.push(c)
      vars.opacity.push(t < new Date().getTime() - 1800000 ? 0.3 : 1)
      vars.hover.push(String(new Date(t).getHours()).padStart(2,"0") + "-" + 
        String(new Date((new Date(t).getTime()+3600000)).getHours()).padStart(2,"0") + ": <b>" + 
        p.toFixed(4) + "</b> " + vars.unit_of_measurement)
    })
    vars.min.h = "<b>" + vars.min.p.toFixed(4) + "</b> " + vars.unit_of_measurement + " @ " + new Date(vars.min.t).getHours() + ":00"
    vars.max.h = "<b>" + vars.max.p.toFixed(4) + "</b> " + vars.unit_of_measurement + " @ " +  new Date(vars.max.t).getHours() + ":00"
    vars.avg.p = vars.avg.p / vars.avg.c
    vars.avg.h = "<b>" + vars.avg.p.toFixed(4) + "</b> " + vars.unit_of_measurement + " gemiddeld"
    vars.avg_f.p = vars.avg_f.p / vars.avg_f.c
    vars.avg_f.h = "<b>" + vars.avg_f.p.toFixed(4) + "</b> " + vars.unit_of_measurement + " gem. > nu"
    vars.ev = { p: 0, h: 'EV charging advice' }
    vars.ev.p = hass.states['sensor.template_d86b6fa4_9390_4887_88cc_1d37d29f27d9']?.attributes?.timeslot_start_avg_price
    if (vars.ev.p === null) {vars.ev.p = parseFloat(0)}
    vars.ev.l = "<b>" + vars.ev.p.toFixed(4) + "</b> " + vars.unit_of_measurement + " laadadvies"
    vars.ev.h = "<b>" + vars.ev.p.toFixed(4) + "</b> " + vars.unit_of_measurement + " gemiddeld"
    vars.ev.start = new Date(hass.states['sensor.template_d86b6fa4_9390_4887_88cc_1d37d29f27d9']?.attributes?.timeslot_start).getTime()
    vars.ev.end = new Date(new Date(vars.ev.start).setHours(new Date(vars.ev.start).getHours() + (hass.states['sensor.template_d86b6fa4_9390_4887_88cc_1d37d29f27d9']?.attributes?.hours_demand))).getTime()
    vars.ev_mn = { p: 0 }
    vars.ev_mn.p = hass.states['sensor.template_d86b6fa4_9390_4887_88cc_1d37d29f27d9']?.attributes?.timeslot_start_till_midnight_avg_price
    if (vars.ev_mn.p === null) {vars.ev_mn.p = parseFloat(0)}
    vars.ev_mn.h = "<b>" + vars.ev_mn.p.toFixed(4) + "</b> " + vars.unit_of_measurement + " gemiddeld"
    vars.ev_mn.start = new Date(hass.states['sensor.template_d86b6fa4_9390_4887_88cc_1d37d29f27d9']?.attributes?.timeslot_start_till_midnight).getTime()
    vars.ev_mn.end = new Date(new Date(vars.ev_mn.start).setHours(new Date(vars.ev_mn.start).getHours() + (hass.states['sensor.template_d86b6fa4_9390_4887_88cc_1d37d29f27d9']?.attributes?.hours_demand))).getTime()
    vars.ev_12 = { p: 0 }
    vars.ev_12.p = hass.states['sensor.template_d86b6fa4_9390_4887_88cc_1d37d29f27d9']?.attributes?.timeslot_start_12_hours_avg_price
    if (vars.ev_12.p === null) {vars.ev_12.p = parseFloat(0)}
    vars.ev_12.h = "<b>" + vars.ev_12.p.toFixed(4) + "</b> " + vars.unit_of_measurement + " gemiddeld"
    vars.ev_12.start = new Date(hass.states['sensor.template_d86b6fa4_9390_4887_88cc_1d37d29f27d9']?.attributes?.timeslot_start_12_hours).getTime()
    vars.ev_12.end = new Date(new Date(vars.ev_12.start).setHours(new Date(vars.ev_12.start).getHours() + (hass.states['sensor.template_d86b6fa4_9390_4887_88cc_1d37d29f27d9']?.attributes?.hours_demand))).getTime()
  }
layout:
  yaxis:
    fixedrange: true
    tickformat: .2f
    range: $fn ({vars}) => [ vars.ymin-0.02, vars.ymax+0.02 ]
  xaxis:
    tickformat: '%H:%M'
config:
  displayModeBar: false
entities:
  - entity: ''
    yaxis: y0
    mode: markers
    textposition: top
    showlegend: true
    name: >-
      $fn ({vars}) => "<b>" + vars.gas_p_now.toFixed(4) + "</b> " +
      vars.gas_unit_of_measurement + " gas"
    marker:
      symbol: diamond
      color: blue
    x: $ex [Date.now(), Date.now()]
    'y':
      - $ex vars.gas_p_now
  - entity: ''
    yaxis: y0
    unit_of_measurement: $ex vars.unit_of_measurement
    showlegend: false
    x: $ex vars.x
    'y': $ex vars.y
    marker:
      color: $ex vars.color
      opacity: $ex vars.opacity
    type: bar
    hovertemplate: $ex vars.hover
  - entity: ''
    mode: markers
    textposition: top
    showlegend: true
    name: $ex vars.min.h
    hovertemplate: $ex vars.min.h
    yaxis: y0
    marker:
      symbol: diamond
      color: $ex vars.min.c
      opacity: 0
    x:
      - $ex vars.min.t
    'y':
      - $ex vars.min.p
  - entity: ''
    mode: markers
    textposition: top
    showlegend: true
    name: $ex vars.max.h
    hovertemplate: $ex vars.max.h
    yaxis: y0
    marker:
      symbol: diamond
      color: $ex vars.max.c
      opacity: 0
    x:
      - $ex vars.max.t
    'y':
      - $ex vars.max.p
  - entity: ''
    name: Now
    yaxis: y0
    showlegend: false
    line:
      width: 1
      dash: dot
      color: deepskyblue
    x: $ex [Date.now(), Date.now()]
    'y':
      - 0
      - 1
  - entity: ''
    mode: markers
    textposition: top
    showlegend: true
    name: $ex vars.now.h
    hovertemplate: $ex vars.now.h
    yaxis: y0
    marker:
      symbol: diamond
      color: deepskyblue
      opacity: 0
    x:
      - $ex vars.now.t
    'y':
      - $ex vars.now.p
  - entity: ''
    name: $ex vars.avg.h
    hovertemplate: $ex vars.avg.h
    yaxis: y0
    showlegend: true
    line:
      width: 1
      dash: dash
      color: silver
      opacity: 0.6
    'y': $ex [vars.avg.p, vars.avg.p]
    x: $ex [vars.x[0], vars.x[vars.x.length-1]]
  - entity: ''
    name: $ex vars.avg_f.h
    hovertemplate: $ex vars.avg_f.h
    yaxis: y0
    showlegend: true
    line:
      width: 1
      dash: dash
      color: silver
      opacity: 0.6
    'y': $ex [vars.avg_f.p, vars.avg_f.p]
    x: $ex [vars.avg_f.t, vars.x[vars.x.length-1]]
  - entity: ''
    name: $ex vars.ev.l
    hovertemplate: $ex vars.ev.h
    yaxis: y0
    showlegend: true
    line:
      width: 3
      color: darkred
      opacity: 0.8
    'y': $ex [vars.ev.p, vars.ev.p]
    x: $ex [vars.ev.start, vars.ev.end]
  - entity: ''
    name: $ex vars.ev.l
    hovertemplate: $ex vars.ev_mn.h
    yaxis: y0
    showlegend: false
    line:
      width: 3
      color: darkred
      opacity: 0.8
    'y': $ex [vars.ev_mn.p, vars.ev_mn.p]
    x: $ex [vars.ev_mn.start, vars.ev_mn.end]
  - entity: ''
    name: $ex vars.ev.l
    hovertemplate: $ex vars.ev_12.h
    yaxis: y0
    showlegend: false
    line:
      width: 3
      color: darkred
      opacity: 0.8
    'y': $ex [vars.ev_12.p, vars.ev_12.p]
    x: $ex [vars.ev_12.start, vars.ev_12.end]
3 Likes
type: custom:stack-in-card
cards:
  - type: horizontal-stack
    cards:
      - type: custom:mushroom-template-card
        entity: sensor.avg_energy_price
        secondary: huidig Tarief
        primary: >
          € {{ states('sensor.zonneplan_current_electricity_tariff') | round(2)
          }}/kWh 
        icon: mdi:currency-eur
        icon_color: orange
        tap_action:
          action: more-info
      - type: custom:mushroom-template-card
        entity: sensor.zonneplan_cheapest_hours
        secondary: Goedkoopste tarief
        primary: |
          {{ states('sensor.zonneplan_cheapest_hours') | round(3) }}/kWh
        icon: mdi:currency-eur
        icon_color: orange
        tap_action:
          action: more-info
      - type: custom:mushroom-template-card
        entity: sensor.zonneplan_current_gas_tariff
        secondary: |
          Gas
        primary: |
          € {{ states('sensor.zonneplan_current_gas_tariff') | round(2) }} 
        icon: mdi:gas-burner
        icon_color: orange
        tap_action:
          action: more-info
  - type: custom:config-template-card
    variables:
      MOVINGAVERAGE: states['sensor.avg_energy_price_cnt']
    entities:
      - ${MOVINGAVERAGE.entity_id}
    card:
      type: custom:apexcharts-card
      apex_config:
        chart:
          height: 200px
          fontFamily: Raleway,sans-serif
        xaxis:
          labels:
            format: HH
        legend:
          show: false
        stroke:
          width: 2
        plotOptions:
          bar:
            columnWidth: 100%
            borderRadius: 5
        grid:
          show: true
          borderColor: '#00000030'
          strokeDashArray: 4
          position: back
        dataLabels:
          offsetY: -8
          background:
            opacity: 0.01
            enabled: true
            foreColor: '#CF7524'
            padding: 2
            borderRadius: 4
            borderWidth: 0
          style:
            fontSize: 9px
            color: rgb(200,200,200)
      experimental:
        color_threshold: true
      graph_span: 40h
      span:
        start: day
        offset: +4h
      update_interval: +1h
      header:
        title: Zonneplan Forecast
        show: false
      now:
        show: true
        label: NOW
      series:
        - entity: sensor.zonneplan_current_electricity_tariff
          color_threshold:
            - value: ${MOVINGAVERAGE.state * .0075}
              color: '#228B22'
            - value: ${MOVINGAVERAGE.state * 0.01}
              color: '#d35400'
            - value: ${MOVINGAVERAGE.state * 0.125}
              color: '#c0392b'
          show:
            extremas: true
          type: column
          float_precision: 2
          data_generator: |
            return entity.attributes.forecast.map((entry) => {
              return [new Date(entry.datetime).getTime(), entry.electricity_price /10000000] ;
            });
      yaxis:
        - id: '1'
          decimals: 2
          min: -0.2
          apex_config:
            tickAmount: 4
            forceNiceScale: true

Here’s an example that should work. just just use another template that’s all

Hi all,

Last night I installed the Zonneplan integration and linked it to my account. Somehow the P1 sensors do not show up. I only have the 5 entities from the solar inverter. therefore I cannot use the energy dashboard at all. I doublechecked and the P1 reader is hooked up to the ZonnePlan One inverter.
Am I missing something, or do I need to take some additional steps to access the P1 sensors?

Any help is greatly appreciated.

Normally, in your case, you would have 3 devices in the integration (Link to Integration – My Home Assistant):

  • Usage
  • Connect energiemeter
  • Solar inverter

If you’re not seeing the first two, something went wrong with linking the account. I assume you already tried rebooting Home Assistant?

I only have one device and 5 entities.
Could it be that I installed the integration at night and the Solar Inverter was in Sleep Mode?
zonneplan

Which device is it?

It is the Zonneplan One device with these entities:

Certain entities are disabled by default. Recommend to double check and manually enable them.