How balgerion/ha_pstryk works
Pstryk is a Home Assistant integration for monitoring electricity prices and energy costs. Users configure an API key and price options, then Home Assistant exposes price and financial-balance sensors; optional MQTT publishing provides EVCC-compatible forecasts. The README also documents 24-hour API forecasts, 48-hour MQTT/JSON data, best/worst hours, averages, and UTC-to-local conversion. The excerpts show setup and MQTT publishing, but not all coordinator-to-client or coordinator-to-entity calls, so those internal links are omitted where unverified.
Main entry points: __init__.py Entry setup · mqtt_common.py MQTT publishing · config_flow.py Config flow · mqtt_publisher.py EVCC formatter
Components 15
Setup & configuration
- Config flow
custom_components/pstryk/config_flow.py - Entry setup
custom_components/pstryk/__init__.py - Integration settings
custom_components/pstryk/const.py
Price and cost data
- API client
custom_components/pstryk/api_client.py - Price updates
custom_components/pstryk/update_coordinator.py - Energy cost updates
custom_components/pstryk/energy_cost_coordinator.py
Home Assistant entities
- Price sensors
custom_components/pstryk/sensor.py - Cost and balance sensors
custom_components/pstryk/sensor.py - JSON price sensors
custom_components/pstryk/sensor.py - Diagnostics
custom_components/pstryk/diagnostics.py
MQTT publishing
- EVCC formatter
custom_components/pstryk/mqtt_publisher.py - MQTT publishing
custom_components/pstryk/mqtt_common.py
Other components
- Home Assistant user
- Pstryk API
- Home Assistant MQTT
Connections 9
- Home Assistant user → Config flow: configures
README.md - Config flow → Pstryk API: validates key
custom_components/pstryk/config_flow.py - Entry setup → Price sensors: forwards setup
custom_components/pstryk/__init__.py - Entry setup → EVCC formatter: creates publisher
custom_components/pstryk/__init__.py - Entry setup → MQTT publishing: starts publishing
custom_components/pstryk/__init__.py - MQTT publishing → EVCC formatter: formats prices
custom_components/pstryk/mqtt_common.py - MQTT publishing → Home Assistant MQTT: publishes forecasts
custom_components/pstryk/mqtt_common.py - Price updates → Pstryk API: fetches forecasts
- Energy cost updates → Pstryk API: fetches cost data