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
picomatic
(Picomatic)
December 28, 2022, 4:44pm
33
Ok installed the new one, did not notice the “0 cents bug”, because i only monitor gas prices ;). Thx for new version.
Got it working too, thanks Klaas
Is anybody experienced in creating an apexcard based on the entity info of this integration
fbijma
(Frans Bijma)
December 28, 2022, 7:46pm
35
Thanks a lot for this, I was creating something myself using node red. It worked already, but I think this will be more mature then my creation…
Thanks again, just installed it and will give it a try. Tomorrow will be a long period of free power again.
Regards Frans
1 Like
fbijma
(Frans Bijma)
December 28, 2022, 8:05pm
36
I do not think that is possible right now. It is missing a sensor holding the whole day to create a graph from. It looks like it only holds one variable like current, next, percentage, highest, lowest etc.
Hi Frans,
The entity sensor.energyzero_today_energy_average_price has this info in the attributes
It is indeed an attribute in the sensor.energyzero_today_energy_average_price
, a basic version of an apexchart can be found in this GitHub gist.
fbijma
(Frans Bijma)
December 29, 2022, 10:10am
39
Thanks, found it.
Let’s create a graph now.
1 Like
Mummie41
(Mummie41)
December 29, 2022, 12:12pm
40
Thnx All,
I now have the current rates for energy and gas. Can this be used in the energy dashboard? I tried it like this, but i am not convinced it is actually working.
I cannot add foto’s. I used the ‘price current hour’ as entity for the costs.
Mummie41
(Mummie41)
December 29, 2022, 12:15pm
41
The total costs are still 0,00 Euro?
fbijma
(Frans Bijma)
December 29, 2022, 12:19pm
42
It works, I did the same.
But to get the real costs you probably need to manipulate the numbers using a template adding taxis and such. And create a new sensor entity with adjusted numbers.