Skip to content

feat(automations): self-rearming holiday mode (delay/duration on enable tools) - #39

Merged
simons-plugins merged 1 commit into
mainfrom
feat/holiday-mode
Jul 23, 2026
Merged

feat(automations): self-rearming holiday mode (delay/duration on enable tools)#39
simons-plugins merged 1 commit into
mainfrom
feat/holiday-mode

Conversation

@simons-plugins

@simons-plugins simons-plugins commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Closes #37. trigger_enable and schedule_enable now accept the IOM's optional delay/duration — 'disarm the morning schedule for two weeks' self-rearms with no follow-up ask. Shared validator from the device tools; unknown-arg guard updated. 364 tests (2 new). 2026.7.0 → 2026.7.1.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EYAGXd4bE9D9Z5kZeSHeo7

Summary by CodeRabbit

  • New Features

    • Added optional delay and duration settings when enabling triggers and schedules.
    • Duration can automatically revert the enabled or disabled state after the specified time.
  • Bug Fixes

    • Added validation to reject negative delay and duration values.
  • Chores

    • Updated the application version to 2026.7.1.
  • Tests

    • Added coverage for delay, duration, and invalid duration handling.

… — self-rearming holiday mode

'Disable for two weeks' now self-rearms: both enable tools accept
the IOM's optional delay/duration (seconds until the entity flips
back to its prior state), reusing the shared validator from the
device tools. Closes #37.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYAGXd4bE9D9Z5kZeSHeo7
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The automation enable tools now accept optional non-negative delay and duration values, forward them to Indigo trigger and schedule APIs, and document duration auto-revert behavior. Tests cover forwarding and negative-duration validation. Plugin and project versions are updated to 2026.7.1.

Changes

Automation enable options

Layer / File(s) Summary
Enable option contracts and handlers
Indigo MCP Lite.indigoPlugin/Contents/Server Plugin/tools/automations.py
Enable schemas and descriptions document delay and duration; handlers validate and forward these options to Indigo APIs.
Enable option validation tests
tests/test_automations.py
Tests verify delay and duration forwarding and reject negative duration values.
Release version metadata
Indigo MCP Lite.indigoPlugin/Contents/Info.plist, pyproject.toml
Plugin and project versions are updated from 2026.7.0 to 2026.7.1.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Tool
  participant EnableHandler
  participant IndigoAPI
  Tool->>EnableHandler: id, enabled, delay, duration
  EnableHandler->>IndigoAPI: trigger.enable or schedule.enable with timing options
  IndigoAPI-->>EnableHandler: enable result
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding delay/duration support for enable tools with self-rearming behavior.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/holiday-mode

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
tests/test_automations.py (1)

153-157: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Cover negative delay validation too.

The new contract validates both optional fields, but this test exercises only duration. Add an analogous negative-delay case and assert that trigger.enable is not called.

Suggested test
+def test_enable_rejects_negative_delay(mock_indigo):
+    mock_indigo.triggers.__getitem__.side_effect = lambda i: _fake_trigger(5, "T")
+    with pytest.raises(ValueError, match="delay"):
+        _trigger_enable_handler(
+            {"id": 5, "enabled": True, "delay": -1}, mock_indigo)
+    mock_indigo.trigger.enable.assert_not_called()
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/test_automations.py` around lines 153 - 157, Add a negative-delay test
alongside test_enable_rejects_negative_duration, invoking
_schedule_enable_handler with a negative delay and asserting ValueError. Also
verify mock_indigo.trigger.enable is not called when validation rejects the
input.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@tests/test_automations.py`:
- Around line 153-157: Add a negative-delay test alongside
test_enable_rejects_negative_duration, invoking _schedule_enable_handler with a
negative delay and asserting ValueError. Also verify mock_indigo.trigger.enable
is not called when validation rejects the input.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d8b4f178-ad91-4cff-87c3-ea9ffd0436d6

📥 Commits

Reviewing files that changed from the base of the PR and between c9cda9e and d3163c1.

📒 Files selected for processing (4)
  • Indigo MCP Lite.indigoPlugin/Contents/Info.plist
  • Indigo MCP Lite.indigoPlugin/Contents/Server Plugin/tools/automations.py
  • pyproject.toml
  • tests/test_automations.py

@simons-plugins
simons-plugins merged commit 1578d99 into main Jul 23, 2026
3 checks passed
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.

Holiday mode: delay/duration on trigger_enable + schedule_enable

1 participant