v0.18.0.dev1
Pre-release
Pre-release
[0.18.0.dev1] - 2025-12-13
Changed
- Allow Python 3.11 and 3.12 again!
- Breaking: All events now contain untyped payloads instead of typed ones
StateChangeEventis nowRawStateChangeEvent- There is a new DI handler for
TypedStateChangeEventto handle conversion if desired
- Breaking: State conversion system now uses dynamic registry instead of hardcoded unions
StateUniontype has been removed - useBaseStatein type hints insteadDomainLiteraltype has been removed - no longer needed with dynamic registration- State classes automatically register their domains via
__init_subclass__hook
- Breaking:
try_convert_statenow typed to returnBaseState | Noneinstead ofStateUnion | None- Uses registry lookup instead of Pydantic discriminated unions for conversion
- Falls back to
BaseStatefor unknown/custom domains try_convert_statemoved tohassette.state_registrymodulestates.__init__now only imports/exports classes, no conversion logic
- Improved dependency injection system for event handlers, including support for optional dependencies via
Maybe*annotations - Renamed
states.pytostate_manager.py(and renamed the class) to avoid confusion withmodels/statesmodule - Removed defaults from StateT and StateValueT type vars
- Removed type constraints from StateValueT type var to allow custom types to be used
- Moved
accessors,conditions,dependencies, andpredicatesall tohassette.event_handlingfor consistency - Moved DI extraction and injection modules to
hassette.bus
Added
TypeRegistryclass for handling simple value conversion (e.g. converting "off" to False)- Handling of Union types
- Handling of None types
- Handling of type conversion for custom
AnnotatedDI handlers
Removed
- Breaking: Removed
StateUniontype - replaced withBaseStatethroughout codebase - Breaking: Removed
DomainLiteraltype - no longer needed with registry system - Breaking: Removed manual
_StateUniontype definition from states module - Breaking: Removed StateValueOld/New, StateValueOldNew, StateOldNew, MaybeStateOldNew, AttrOld, AttrNew, AttrOldNew DI handlers
- These can be used still by annotating with
Annotated[<type>, A.<function>]using providedaccessorsmodule - They were too difficult to maintain/type properly across the framework
- These can be used still by annotating with
Full Changelog: v0.17.0...v0.18.0.dev1