sjanssen15
(Sander Janssen)
December 8, 2022, 8:25pm
13
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?
mbeefcake
(mbeefcake)
December 8, 2022, 9:02pm
14
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
sjanssen15
(Sander Janssen)
December 8, 2022, 9:35pm
15
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
sjanssen15
(Sander Janssen)
December 11, 2022, 7:58pm
17
That is awesome! This will also work for ANWB customers ofcourse, which is great
1 Like
duittenb
(Dirk)
December 13, 2022, 9:55am
18
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
duittenb
(Dirk)
December 13, 2022, 10:19am
19
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.
1 Like
adam020
(adam020)
December 14, 2022, 8:51pm
21
Seems you have to add EURO 0.18243 for every kWh
0,10908+0,0401+0,03325=0.18243
duittenb
(Dirk)
December 14, 2022, 10:45pm
22
Klein foutje in de berekening? (eerste bedrag 0.019xxx ipv 0.109xxx)
Ik kom op € 0.09243
Bernard-Jan
(Bernard-Jan Baerken)
December 15, 2022, 8:09pm
23
The cost work nice.
So how can I add the extra .09243 to the prize? For Electra and gas.
duittenb
(Dirk)
December 16, 2022, 9:56am
24
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.
home-assistant:dev
← klaasnicolaas:klaas-add/energyzero
opened 12:16AM - 13 Dec 22 UTC
<!--
You are amazing! Thanks for contributing to our project!
Please, DO N… OT DELETE ANY TEXT from this template! (unless instructed).
-->
## Proposed change
<!--
Describe the big picture of your changes here to communicate to the
maintainers why we should accept this pull request. If it fixes a bug
or resolves a feature request, be sure to link to that issue in the
additional information section.
-->
A new integration that uses the data from EnergyZero, interesting for those who have a dynamic energy contract with an energy company that is a partner of EnergyZero.
Note: I don't have 100% full coverage with the tests yet.
## Type of change
<!--
What type of change does your PR introduce to Home Assistant?
NOTE: Please, check only 1! box!
If your PR requires multiple boxes to be checked, you'll most likely need to
split it into multiple PRs. This makes things easier and faster to code review.
-->
- [ ] Dependency upgrade
- [ ] Bugfix (non-breaking change which fixes an issue)
- [X] New integration (thank you!)
- [ ] New feature (which adds functionality to an existing integration)
- [ ] Deprecation (breaking change to happen in the future)
- [ ] Breaking change (fix/feature causing existing functionality to break)
- [ ] Code quality improvements to existing code or addition of tests
## Additional information
<!--
Details are important, and help maintainers processing your PR.
Please be sure to fill out additional details, if applicable.
-->
- This PR fixes or closes issue: fixes #
- This PR is related to issue:
- Link to documentation pull request:
## Checklist
<!--
Put an `x` in the boxes that apply. You can also fill these out after
creating the PR. If you're unsure about any of them, don't hesitate to ask.
We're here to help! This is simply a reminder of what we are going to look
for before merging your code.
-->
- [X] The code change is tested and works locally.
- [X] Local tests pass. **Your PR cannot be merged unless tests pass**
- [X] There is no commented out code in this PR.
- [X] I have followed the [development checklist][dev-checklist]
- [X] The code has been formatted using Black (`black --fast homeassistant tests`)
- [X] Tests have been added to verify that the new code works.
If user exposed functionality or configuration variables are added/changed:
- [ ] Documentation added/updated for [www.home-assistant.io][docs-repository]
If the code communicates with devices, web services, or third-party tools:
- [X] The [manifest file][manifest-docs] has all fields filled out correctly.
Updated and included derived files by running: `python3 -m script.hassfest`.
- [X] New or updated dependencies have been added to `requirements_all.txt`.
Updated by running `python3 -m script.gen_requirements_all`.
- [ ] For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
- [X] Untested files have been added to `.coveragerc`.
<!--
This project is very active and we have a high turnover of pull requests.
Unfortunately, the number of incoming pull requests is higher than what our
reviewers can review and merge so there is a long backlog of pull requests
waiting for review. You can help here!
By reviewing another pull request, you will help raise the code quality of
that pull request and the final review will be faster. This way the general
pace of pull request reviews will go up and your wait time will go down.
When picking a pull request to review, try to choose one that hasn't yet
been reviewed.
Thanks for helping out!
-->
To help with the load of incoming pull requests:
- [X] I have reviewed two other [open pull requests][prs] in this repository.
[prs]: https://github.com/home-assistant/core/pulls?q=is%3Aopen+is%3Apr+-author%3A%40me+-draft%3Atrue+-label%3Awaiting-for-upstream+sort%3Acreated-desc+review%3Anone+-status%3Afailure
<!--
Thank you for contributing <3
Below, some useful links you could explore:
-->
[dev-checklist]: https://developers.home-assistant.io/docs/en/development_checklist.html
[manifest-docs]: https://developers.home-assistant.io/docs/en/creating_integration_manifest.html
[quality-scale]: https://developers.home-assistant.io/docs/en/next/integration_quality_scale_index.html
[docs-repository]: https://github.com/home-assistant/home-assistant.io
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
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
Bernard-Jan
(Bernard-Jan Baerken)
December 22, 2022, 5:02pm
29
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
picomatic
(Picomatic)
December 27, 2022, 7:08pm
30
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
picomatic
(Picomatic)
December 27, 2022, 9:51pm
31
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
2 Likes