Thanks for this integration, my contract starts tomorrow so prepping for the transition from Frank Energie.
Question though, my integration shows everything (all entities including the 8hour forecast) except for the gas price- is this a known issue? Could it be because my contract is not yet active?
In the current_tarrif attributes the details of upcoming (and past) prices are shown. However the ‘last’ time slot is that of 22:00 (see below) while the app shows also 23:00 to 24:00
Is there a reason for this? Is there some kind of offset as the price seems to be the one of 23:00 to 24:00
That should be fine… works with apex; date/time is stored as UTC an HA will automatically show the applied time zone; same should be for template sensors.
I would need to check manual. But take below sensor. It compares with now().date(); Are you sure it then automatically takes 1 hour from the previous day and not just the 23 hours it can find for today?
- platform: template
sensors:
avg_energy_price:
friendly_name: Average current energy price
value_template: >
{% set ns = namespace(sum = 0, count = 0) %}
{% for item in state_attr('sensor.zonneplan_current_electricity_tariff', 'forcast') -%}
{% if as_datetime(item.datetime).date() == now().date() %}
{% set ns.sum = ns.sum + item.price %}
{% set ns.count = ns.count + 1 %}
{% endif %}
{%- endfor %}
{{ (ns.sum/ns.count/100000) }}
like @Hmmbob suggests; Did you create the sensors? Below is what I use. Also please note that the dev of this integration recently changed something. There was a spelling mistake in the sensor attributes and it was changed from “forcast” to “forecast”.
The yaml for the 2 sensors I use below:
- 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.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.price %}
{% set ns.count = ns.count + 1 %}
{% endif %}
{%- endfor %}
{{ (ns.sum/ns.count/10000000) }}