Skip to content

Comments

[enocean] Add generic state machine infrastructure#20218

Open
svnsssd wants to merge 2 commits intoopenhab:mainfrom
svnsssd:pr1-generic-statemachine
Open

[enocean] Add generic state machine infrastructure#20218
svnsssd wants to merge 2 commits intoopenhab:mainfrom
svnsssd:pr1-generic-statemachine

Conversation

@svnsssd
Copy link

@svnsssd svnsssd commented Feb 12, 2026

This PR introduces a generic, reusable state machine infrastructure for the EnOcean binding.

Key Features

  • Generic type-safe state machine with bounded type parameters <A extends Enum<A>, S extends Enum<S>>
  • StateMachineProvider interface for easy integration into EEP handlers
  • Persistent state storage using Thing Properties (survives restarts)
  • Example implementation (ExampleAction/State/Transitions) demonstrating usage
  • New channel type statemachinestate for state visibility

Architecture

The state machine is designed to be device-agnostic and can be used by any EEP implementation that needs state tracking. The example shows a simple START→WARMUP→ACTIVE→READY→FINISH flow.

Testing

  • Clean build with mvn clean install
  • No production device implementations in this PR (see separate PR for FSB14)
  • Example classes serve as documentation and template

Changes

  • 15 files changed, 670 insertions(+), 32 deletions(-)
  • Core infrastructure only, no specific device implementations

Signed-off-by: Sven Schad svnsssd@gmail.com

- Add STMStateMachine with generic type parameters for actions and states
- Add STMTransition and STMTransitionConfiguration for transition definitions
- Add StateMachineProvider interface for EEPs to implement state machine support
- Add CHANNEL_STATEMACHINESTATE read-only channel for monitoring state
- Add Example classes (ExampleAction, ExampleState, ExampleTransitions) as documentation
- Update handler classes to use generic wildcard types for state machine support

This provides a generic, extensible state machine framework that can be used by
any EnOcean EEP that needs stateful behavior tracking.

Signed-off-by: Sven Schad <svnsssd@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant