mirror of
https://github.com/jpawlowski/hass.tibber_prices.git
synced 2026-03-30 05:13:40 +00:00
Reorganized utility modules into structured package: - average_utils.py → utils/average.py - price_utils.py → utils/price.py - Created utils/__init__.py with clean exports Moved MINUTES_PER_INTERVAL to const.py (centralized constant management), with re-exports in utils modules for backward compatibility during migration. Added comprehensive package docstring explaining scope: - Pure data transformation functions (stateless) - No HA entity/coordinator dependencies - Clear separation from entity_utils/ (entity-specific logic) Impact: Cleaner module structure, easier navigation. Follows file organization policy from AGENTS.md (keep root clean).
63 lines
2 KiB
Python
63 lines
2 KiB
Python
"""
|
|
Pure data transformation utilities for Tibber Prices integration.
|
|
|
|
This package contains stateless, pure functions for data processing:
|
|
- Time-window calculations (trailing/leading averages, min/max)
|
|
- Price enrichment (differences, volatility, rating levels)
|
|
- Statistical analysis (aggregation, trends)
|
|
|
|
These functions operate on raw data structures (dicts, lists) and do NOT depend on:
|
|
- Home Assistant entities or state management
|
|
- Configuration entries or coordinators
|
|
- Translation systems or UI-specific logic
|
|
|
|
For entity-specific utilities (icons, colors, attributes), see entity_utils/ package.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from .average import (
|
|
calculate_current_leading_avg,
|
|
calculate_current_leading_max,
|
|
calculate_current_leading_min,
|
|
calculate_current_trailing_avg,
|
|
calculate_current_trailing_max,
|
|
calculate_current_trailing_min,
|
|
calculate_next_n_hours_avg,
|
|
round_to_nearest_quarter_hour,
|
|
)
|
|
from .price import (
|
|
aggregate_period_levels,
|
|
aggregate_period_ratings,
|
|
aggregate_price_levels,
|
|
aggregate_price_rating,
|
|
calculate_difference_percentage,
|
|
calculate_price_trend,
|
|
calculate_rating_level,
|
|
calculate_trailing_average_for_interval,
|
|
calculate_volatility_level,
|
|
enrich_price_info_with_differences,
|
|
find_price_data_for_interval,
|
|
)
|
|
|
|
__all__ = [
|
|
"aggregate_period_levels",
|
|
"aggregate_period_ratings",
|
|
"aggregate_price_levels",
|
|
"aggregate_price_rating",
|
|
"calculate_current_leading_avg",
|
|
"calculate_current_leading_max",
|
|
"calculate_current_leading_min",
|
|
"calculate_current_trailing_avg",
|
|
"calculate_current_trailing_max",
|
|
"calculate_current_trailing_min",
|
|
"calculate_difference_percentage",
|
|
"calculate_next_n_hours_avg",
|
|
"calculate_price_trend",
|
|
"calculate_rating_level",
|
|
"calculate_trailing_average_for_interval",
|
|
"calculate_volatility_level",
|
|
"enrich_price_info_with_differences",
|
|
"find_price_data_for_interval",
|
|
"round_to_nearest_quarter_hour",
|
|
]
|