Skip to content

Instantly share code, notes, and snippets.

@christophengelmayer
Last active December 4, 2025 22:01
Show Gist options
  • Select an option

  • Save christophengelmayer/93512a78b9134627360a40562785d276 to your computer and use it in GitHub Desktop.

Select an option

Save christophengelmayer/93512a78b9134627360a40562785d276 to your computer and use it in GitHub Desktop.
Native Home Assistant spottyenergie.at Spot Prices that work with ha_epex_spot_sensor
#
# Replace INSERT_YOUR_CUSTOM_KEY_HERE with your API Information from https://i.spottyenergie.at/#/dashboard
#
command_line:
- sensor:
name: "Energy Spot Price Raw"
unique_id: energy_spot_price_raw
scan_interval: 900
command_timeout: 30
command: >-
curl -s 'https://i.spottyenergie.at/api/prices/CONSUMPTION/INSERT_YOUR_CUSTOM_KEY_HERE?timezone=at' |
jq -c '{data: .}'
value_template: "OK"
json_attributes:
- data
template:
- sensor:
- name: "Energy Spot Price"
unique_id: energy_spot_price
state_class: measurement
unit_of_measurement: "ct/kWh"
icon: mdi:currency-eur
state: >-
{% set prices = state_attr('sensor.energy_spot_price_raw', 'data') %}
{% if not prices %}
unknown
{% else %}
{% set now_ts = as_timestamp(now()) %}
{% for item in prices %}
{% set start = as_timestamp(item['from']) %}
{% set end = start + 15*60 %}
{% if now_ts >= start and now_ts < end %}
{{ item['price'] }}
{% endif %}
{% endfor %}
{% endif %}
attributes:
data: >-
{%- set items = state_attr('sensor.energy_spot_price_raw', 'data') or [] -%}
[
{%- for item in items %}
{%- set start = as_datetime(item.from) %}
{%- set end = as_datetime(items[loop.index].from) if not loop.last else (start + timedelta(minutes=15)) %}
{
"start_time": "{{ start.isoformat() }}",
"end_time": "{{ end.isoformat() }}",
"price_per_kwh": {{ item.price * 1.2 | float(0) }}
}{{ "," if not loop.last else "" }}
{%- endfor -%}
]
type: horizontal-stack
cards:
- type: custom:apexcharts-card
experimental:
color_threshold: true
graph_span: 2day
update_interval: 2m
now:
show: true
label: Jetzt
color: gray
span:
offset: +0day
start: day
yaxis:
- id: primary
decimals: 1
min: "|-1|"
max: "|+1|"
header:
show: true
title: Strompreis
show_states: true
colorize_states: true
all_series_config:
unit: ct/kWh
type: line
stroke_width: 0
show:
legend_value: false
in_header: true
header_color_threshold: true
color_threshold:
- value: 0
color: "#00c700"
- value: 5
color: "#7ddc00"
- value: 10
color: "#ffdd00"
- value: 15
color: "#ffb700"
- value: 20
color: "#ff7f00"
- value: 25
color: "#ff4c00"
- value: 30
color: "#ff0000"
series:
- entity: sensor.energy_spot_price
name: Electricity Price
type: column
extend_to: end
data_generator: |
return entity.attributes.data.map((entry) => {
return [new Date(entry.start_time), entry.price_per_kwh];
});
@christophengelmayer
Copy link
Author

Drop in replacement for EPEX Spot integration.

Works with EPEX Spot Sensor and ApexCharts Card.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment