Comments (5)
The forecast prices are in an attribute of the current_electricity_tariff sensor.
Try this in the template editor:
{% set cheapest = state_attr('sensor.zonneplan_current_electricity_tariff', 'forcast')
| selectattr('datetime', '>', utcnow().isoformat())
| sort(attribute='price')
| first %}
{{ cheapest.price /10000000 }}
{{ cheapest.datetime }}
You can for example create a template sensor for the cheapest upcoming hour:
template:
- sensor:
- name: zonneplan_cheapest_hour
state: >
{% set cheapest = state_attr('sensor.zonneplan_current_electricity_tariff', 'forcast')
| selectattr('datetime', '>', utcnow().isoformat())
| sort(attribute='price')
| first %}
{{ cheapest.datetime }}
Hope this helps.
from home-assistant-zonneplan-one.
Thanks! But somehow the date and price aren't the same as the Zonneplan app. But that has nothing to do with your script.
Two questions;
- Is there a way to limit the quantity of forecast hours to the upcoming, let's say, 10 hours instead of 24 hours?
- Is it possible to format the datetime stamp to only show the hour? And maybe calculate how many hours that is from the current time?
from home-assistant-zonneplan-one.
The price shown in the app is the lowest price of the current day (not taken in account the prices for the next day). I think that is why it's different.
You can do anything with the data you want.
For example, this will give you the next 10 hours:
{{ (state_attr('sensor.zonneplan_current_electricity_tariff', 'forcast')
| selectattr('datetime', '>', utcnow().isoformat())
| sort(attribute='datetime'))
[:10] }}
Or the cheapest 10 hours:
{{ (state_attr('sensor.zonneplan_current_electricity_tariff', 'forcast')
| selectattr('datetime', '>', utcnow().isoformat())
| sort(attribute='price'))
[:10] }}
And to only get the hour from the datetume you can use time functions: https://www.home-assistant.io/docs/configuration/templating/#time
For the example in my previous comment:
{% set cheapest = state_attr('sensor.zonneplan_current_electricity_tariff', 'forcast')
| selectattr('datetime', '>', utcnow().isoformat())
| sort(attribute='price')
| first %}
{{ cheapest.price /10000000 }}
{{ as_datetime(cheapest.datetime).hour }}
But I think these questions are not really in the right place. This is not an issue with this integration. I think you will find most answers to these questions in the community or feel free to send me a DM.
from home-assistant-zonneplan-one.
@fsaris Maybe you can enable discussions on your repository for these kind of questions
from home-assistant-zonneplan-one.
Done https://github.com/fsaris/home-assistant-zonneplan-one/discussions
from home-assistant-zonneplan-one.
Related Issues (20)
- Gas price unavailable HOT 67
- Is it possible to add Peak Power (Piekvermogen) value HOT 2
- Is it possible to pull "laadpaal" data from the zonneplan API ? HOT 21
- Typo forcast HOT 1
- Forecast prices are not in euros HOT 1
- Zonneplan API unstable; cache results (longer)? HOT 26
- Zonneplan one became unavailable HOT 1
- No current tariff changes event HOT 2
- Meter readings HOT 2
- Sometimes the current elek/gas tarif is nothing HOT 6
- Daylight saving time HOT 6
- charge_point (laadpaal) stopped working HOT 3
- Current en forecast electricity price not working HOT 3
- Current electricity tariff 'unknown' HOT 1
- Show electricity costs today and gas costs today in entity HOT 15
- Gas en electra prijzen standaard paar cent hoger dan in de zonneplan app HOT 12
- Deleting a (one) device HOT 4
- zonneplan one fails to start HOT 4
- New property: Tomorrows gas price HOT 19
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from home-assistant-zonneplan-one.