name: stwhas-strompreise description: "Fetch real-time electricity spot prices from Stadtwerk Hassfurt (haStrom flex / flex pro). TRIGGER when: user asks about electricity prices, Strompreise, spot prices, EPEX prices, energy costs, Stadtwerk Hassfurt, haStrom, or day-ahead prices. Also trigger for price comparisons between flex and flex pro tariffs, cheapest hours to use electricity, or historical electricity price analysis. DO NOT TRIGGER for: general energy topics, solar/gas prices, or electricity providers other than Stadtwerk Hassfurt."
Stadtwerk Hassfurt Electricity Spot Prices
Fetch hourly EPEX spot prices for the haStrom flex and haStrom flex pro tariffs from the Stadtwerk Hassfurt public API.
API Endpoints
Important: Use HTTP, not HTTPS.
| Endpoint | Tariff |
|---|---|
http://eex.stwhas.de/api/spotprices |
haStrom flex |
http://eex.stwhas.de/api/spotprices/flexpro |
haStrom flex pro |
Optional query parameters
start_date=YYYYMMDD— start date for historical dataend_date=YYYYMMDD— end date for historical data- Both can be combined:
?start_date=20260101&end_date=20260131
Day-ahead prices
After 14:00 CET, prices for the next day become available. Before 14:00, only today's prices are returned.
How to fetch prices
Use Python with urllib (no external dependencies needed):
import json
import urllib.request
def fetch_prices(tariff="flex", start_date="", end_date=""):
"""Fetch spot prices from Stadtwerk Hassfurt API.
Args:
tariff: "flex" or "flexpro"
start_date: Optional, format YYYYMMDD
end_date: Optional, format YYYYMMDD
"""
base = "http://eex.stwhas.de/api/spotprices"
url = base if tariff == "flex" else f"{base}/flexpro"
params = []
if start_date:
params.append(f"start_date={start_date}")
if end_date:
params.append(f"end_date={end_date}")
if params:
url += "?" + "&".join(params)
req = urllib.request.Request(url, headers={"Accept": "application/json"})
with urllib.request.urlopen(req, timeout=15) as resp:
return json.loads(resp.read().decode("utf-8"))
API Response Format
haStrom flex (/spotprices)
{
"object": "list",
"tariff_info": {
"name": "haStrom flex",
"minimal_energy_price": "16.78 ct/kWh",
"maximal_energy_price": "25.82 ct/kWh",
"taxes": "5.95 ct/kWh",
"netcosts": "6.16 ct/kWh",
"margin": "3.45 ct/kWh",
"basic_charge": "210.06 EUR/year",
"vat": "19 %"
},
"data": [
{
"start_timestamp": "2026-03-12 00:00:00",
"end_timestamp": "2026-03-12 01:00:00",
"e_price_epex_excl_vat": 10.018,
"e_price_has_incl_vat": 16.784,
"t_price_has_incl_vat": 28.89,
"unit": "ct/kWh"
}
]
}
haStrom flex pro (/spotprices/flexpro)
{
"object": "list",
"tariff_info_flex_pro": {
"name": "haStrom FLEX PRO",
"minimal_energy_price": "3.45 ct/kWh",
"taxes": "5.95 ct/kWh",
"netcosts": "6.16 ct/kWh",
"margin": "3.45 ct/kWh",
"basic_charge": "210.06 EUR/year",
"vat": "19 %"
},
"data": [
{
"start_timestamp": "2026-03-12 00:00:00",
"end_timestamp": "2026-03-12 01:00:00",
"e_price_epex_excl_vat": 10.018,
"e_price_has_pro_incl_vat": 15.372,
"t_price_has_pro_incl_vat": 27.48,
"unit": "ct/kWh"
}
]
}
Key differences between response fields
| Field | flex | flex pro |
|---|---|---|
| Tariff info key | tariff_info |
tariff_info_flex_pro |
| Energy price field | e_price_has_incl_vat |
e_price_has_pro_incl_vat |
| Total price field | t_price_has_incl_vat |
t_price_has_pro_incl_vat |
| Has max energy price | Yes (price cap) | No (direct EPEX pass-through) |
| Min energy price | Higher floor (~16.78 ct) | Lower floor (~3.45 ct) |
Price field glossary
e_price_epex_excl_vat— Raw EPEX spot market price, excluding VAT (identical in both tariffs)e_price_has_incl_vat/e_price_has_pro_incl_vat— Energy price including VAT, tariff-specifict_price_has_incl_vat/t_price_has_pro_incl_vat— Total price including taxes, grid fees, margin, and VAT
Tariff comparison
haStrom flex: Energy price has a floor (min ~16.78 ct/kWh) and a cap (max ~25.82 ct/kWh). Lower risk, but less savings potential when EPEX is very low or negative.
haStrom flex pro: Energy price passes through EPEX fluctuations more directly with a very low floor (~3.45 ct/kWh) and no cap. Higher savings potential during low-price hours (midday solar surplus), but higher prices during peak hours.
Presentation guidelines
When presenting prices to the user:
- Always show both tariffs side by side unless the user asks for a specific one
- Highlight the cheapest hours — useful for scheduling high-consumption appliances (dishwasher, washing machine, EV charging)
- Show min/max/average for quick overview
- Use ct/kWh as the unit — all prices from the API are in ct/kWh
- Note the day-ahead availability — remind users that tomorrow's prices appear after 14:00 CET
- For negative EPEX prices: point out that flex pro passes savings through while flex stays at floor price