What's Changed
This release focuses on code quality, maintainability, and type safety improvements.
Improvements
- Base Entity Classes: New
MoogoCoordinatorEntity,MoogoDeviceEntity, andMoogoDeviceControlEntitybase classes eliminate code duplication across sensors and switches - Type Safety: Added TypedDict models (
CoordinatorData,DeviceData,ScheduleCache) for better type checking - Utility Functions: Extracted common operations into
utils.py(timestamp conversion, level status, safe type conversions) - Refactored Coordinator: Split large
_async_update_data()method into smaller, focused methods - Config Flow Improvements: Extracted exception handling and added proper reload error handling
- Constants: Added named constants for magic numbers, status strings, and icons
Bug Fixes
- Fixed duplicate schedule counting in sensor (now uses cached counts)
- Fixed mypy type errors (
ConfigFlowResult,DeviceInforeturn types)
Testing
- Added 22 new utility function tests
- All 42 tests passing
- mypy: 0 errors
- ruff: all checks passed
Full Changelog: v2.0.0...v2.0.1