Tags: erlendsellie/priceanalyzer
Tags
Fix cheapest hours detection and add two cheapest hours attributes #28 - Fix incorrect cheapest hours detection Fixed timestamp timezone mismatch where UTC timestamps were compared against local timestamps is_ten_cheapest and is_five_cheapest now correctly match the hours in attribute lists #31 - Add two cheapest hours attributes Added two_cheapest_today and two_cheapest_tomorrow sensor attributes No temperature logic changes - attributes only for user automations
# Fix critical stability issues and add comprehensive retry mechanisms ## Major Fixes - **Fix infinite loop crashes**: Remove recursive calls in check_stuff() that caused Home Assistant crashes - **Fix duplicate setup errors**: Prevent "Config entry has already been setup" errors with proper region checking - **Fix API instance conflicts**: Use single NordpoolData instance to prevent resource conflicts ## New Features - **Comprehensive retry mechanisms**: Multi-layer retry system for API calls with exponential backoff - **Recorder attribute exclusion**: Prevent large attributes from bloating database while keeping them accessible - **Enhanced error handling**: Safe API call wrappers with detailed logging and graceful degradation ## Performance Improvements - **Database optimization**: Exclude raw_today, raw_tomorrow, and other large arrays from recorder - **HTTP timeout configuration**: 30-second total timeout, 10-second connect timeout for better reliability - **Memory efficiency**: Reduced database size and query overhead ## Technical Details - Add @backoff decorators to _io() and fetch() methods in aio_price.py - Implement _safe_api_call() wrapper in data.py with comprehensive exception handling - Use _unrecorded_attributes class attribute for proper recorder exclusion - Add duplicate region setup prevention in __init__.py - Enhanced exception coverage: ClientError, ClientTimeout, TimeoutError, ConnectionError, KeyError, ValueError, TypeError ## Breaking Changes None - All changes are backward compatible Fixes: #49
PreviousNext