Add disable_events and enable_events scheduler triggers#10
Merged
majamassarini merged 4 commits intodevfrom Mar 2, 2026
Merged
Add disable_events and enable_events scheduler triggers#10majamassarini merged 4 commits intodevfrom
majamassarini merged 4 commits intodevfrom
Conversation
Introduce two new scheduler trigger types to allow disabling and re-enabling specific events in the appliance state machine: - state.entering.disable_events.Trigger: fires immediately when the appliance enters a specified state and calls appliance.disable() for each of its events, preventing those events from being processed by the state machine until explicitly re-enabled. - state.entering.delay.enable_events.Trigger: fires after a configurable timeout following state entry and calls appliance.enable() for each of its events, restoring normal event processing. - date.enable_events.Trigger: the resettable date trigger forked by the delay variant, recognised by process._run() via isinstance to call appliance.enable(). process._run() is updated to dispatch on isinstance rather than calling performer.notify() when either new trigger type is dequeued. Builder classes and YAML tags are registered for both new trigger types (state.entering.disable_events.Trigger and state.entering.delay.enable_events.Trigger). A unit test verifies the full cycle: forced.Event.Off is disabled when the sound player enters Fade In, and re-enabled after the timeout. Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com>
When Fade In transitions to Off upon receiving elapsed.Event.On, the new Off state was carrying elapsed.Event.On forward (via get_new_state), which blocked the next morning's Off -> Fade In transition whose guard requires elapsed.Event.On to be absent. Explicitly call next(elapsed.Event.Off) on the new Off state so the elapsed event is always reset before the player settles back into Off. Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The "will send" messages were at info level causing noise in the logs. Lower them to debug and include the state transition (old -> new) for more context alongside the outgoing messages. Also include the state transition in the "Appliance updated by redis" debug message. Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Generic task names "Appliance updated by redis" and "Performer updated by redis" made it impossible to identify which entity was involved when asyncio logged task-related messages. Include the specific name. Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduce two new scheduler trigger types to allow disabling and re-enabling specific events in the appliance state machine:
state.entering.disable_events.Trigger: fires immediately when the appliance enters a specified state and calls appliance.disable() for each of its events, preventing those events from being processed by
the state machine until explicitly re-enabled.
state.entering.delay.enable_events.Trigger: fires after a configurable timeout following state entry and calls appliance.enable() for each of
its events, restoring normal event processing.
date.enable_events.Trigger: the resettable date trigger forked by the delay variant, recognised by process._run() via isinstance to call appliance.enable().
process._run() is updated to dispatch on isinstance rather than calling performer.notify() when either new trigger type is dequeued.
Builder classes and YAML tags are registered for both new trigger types (state.entering.disable_events.Trigger and state.entering.delay.enable_events.Trigger).
A unit test verifies the full cycle: forced.Event.Off is disabled when the sound player enters Fade In, and re-enabled after the timeout.
Assisted-By: Claude Sonnet 4.6 noreply@anthropic.com