Last active
October 15, 2025 06:33
-
-
Save klaasnicolaas/ccfd1cd3da62a13b3199ff378480bdbb to your computer and use it in GitHub Desktop.
Collecting the hourly energy prices via a service in the EnergyZero or easyEnergy integration and using them in an ApexCharts card in your dashboard.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - type: custom:apexcharts-card | |
| graph_span: 1d | |
| header: | |
| show: true | |
| title: Electriciteitsprijzen Vandaag (€/kwh) | |
| span: | |
| start: day | |
| now: | |
| show: true | |
| label: Now | |
| yaxis: | |
| - id: price | |
| decimals: 2 | |
| apex_config: | |
| tickAmount: 5 | |
| series: | |
| - entity: sensor.energy_prices_today | |
| name: Price this hour | |
| yaxis_id: price | |
| data_generator: | | |
| return entity.attributes.prices.map((entry) => { | |
| return [new Date(entry.timestamp).getTime(), entry.price]; | |
| }); | |
| type: column | |
| show: | |
| extremas: true | |
| opacity: 0.8 | |
| float_precision: 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| # Today - Hourly energy prices | |
| template: | |
| - trigger: | |
| - platform: homeassistant | |
| event: start | |
| - platform: time_pattern | |
| hours: "*" | |
| action: | |
| - service: energyzero.get_energy_prices | |
| response_variable: response | |
| data: | |
| config_entry: PUT_HERE_YOURS | |
| incl_vat: True | |
| sensor: | |
| - name: Energy prices - Today | |
| device_class: timestamp | |
| state: "{{ now() }}" | |
| attributes: | |
| prices: '{{ response.prices }}' | |
| # Tomorrow - Hourly energy prices | |
| - trigger: | |
| - platform: homeassistant | |
| event: start | |
| - platform: template | |
| value_template: "{{ now() > today_at('14:00') and now().minute == 0 }}" | |
| action: | |
| - service: energyzero.get_energy_prices | |
| response_variable: response | |
| data: | |
| config_entry: PUT_HERE_YOURS | |
| start: "{{ now() + timedelta(days=1) }}" | |
| end: "{{ now() + timedelta(days=1) }}" | |
| incl_vat: True | |
| sensor: | |
| - name: Energy prices - Tomorrow | |
| device_class: timestamp | |
| state: "{{ now() + timedelta(days=1) }}" | |
| attributes: | |
| prices: '{{ response.prices }}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The trigger and the sensor can be in the template file.
I started with 2 installation on 2 different machines. 1 NUC -prod and LT -play, both created from scratch.
Testing on the play, then when succeeded, copy to the production one.
Installed the apexcharts om the play. Everything worked.
Copy to the prod, I got issues.
Now the setup, I struggled a lot with the inclusion of the trigger+sensor, the Studio Code Server gave indeed a couple of issues, like multipe occurence of:
. Still having the error messages. Could not solve the issue.
But it is working like it supposed to.
I followed the newest implementation of HA documentation.
The configuration file can be as simple as possible.
The mentioned sensors with trigger has to be placed in the template.yaml and the configuration.yaml
includes "template: !include template.yaml" (no "").
Configuration.yaml
Beginning of template.yaml
Does anyone has an idea why the errors are reported by the Studio Code Server ?? And how to solve it?