Add "Enable a scene" and "Disable a scene" scene actions - #2928
Add "Enable a scene" and "Disable a scene" scene actions#2928Pierre-Gilles wants to merge 2 commits into
Conversation
Add two new scene actions, scene.enable and scene.disable, that turn the active flag of another scene on or off. This lets a scene arm or disarm another one without going through a virtual MQTT device. A scene is allowed to target itself, so a scene can disarm itself once its job is done and be re-armed later by another scene. - new ACTIONS.SCENE.ENABLE / ACTIONS.SCENE.DISABLE constants - server action handlers persisting the flag through scene.update, which also cancels or re-schedules the target scene triggers - AbortScene when no scene is selected or the target scene no longer exists - MCP scene creation schemas for both actions - front action card, action selector and en/fr/de translations
|
Warning Review limit reached
Next review available in: 33 minutes Limit details: You’ve used all 8 included reviews currently available under your plan. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (11)
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. Comment |
Deploying gladys-plus with
|
| Latest commit: |
c2a2ae0
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://8d8bb0ce.gladys-plus.pages.dev |
| Branch Preview URL: | https://claude-scene-enable-disable.gladys-plus.pages.dev |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2928 +/- ##
=======================================
Coverage 99.51% 99.51%
=======================================
Files 1235 1235
Lines 88064 88116 +52
=======================================
+ Hits 87638 87690 +52
Misses 426 426 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
🐳 A Docker image has been built for this branch and pushed to the GitHub Container Registry. You can test this pull request (AMD64 only) by pulling the image below: For example, run it with: sudo docker run -d \
--log-driver json-file \
--log-opt max-size=10m \
--cgroupns=host \
--restart=always \
--privileged \
--network=host \
--name gladys-claude-scene-enable-disable-action \
-e NODE_ENV=production \
-e SERVER_PORT=80 \
-e TZ=Europe/Paris \
-e SQLITE_FILE_PATH=/var/lib/gladysassistant/gladys-production.db \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /var/lib/gladysassistant:/var/lib/gladysassistant \
-v /dev:/dev \
-v /run/udev:/run/udev:ro \
ghcr.io/gladysassistant/gladys-preview:claude-scene-enable-disable-actionThis comment and the image are automatically updated on every new commit pushed to this pull request. Need an ARM64 image (Raspberry Pi, Apple Silicon, …)? Comment |
There was a problem hiding this comment.
Stale comment
Looks good to merge. This is a well-scoped additive feature: two new scene actions (
scene.enable/scene.disable) that persist the existingactiveflag throughscene.update, so scheduled jobs and MQTT subscriptions are cancelled or re-armed the same way as the scene-list toggle.What I checked:
- Constants feed
ACTION_LIST, so Joi already accepts the new types; MCPscene.createunion and en/fr/de keys are wired.- Self-targeting is correctly kept (unlike
scene.start), which is what makes the “run once, then disarm” pattern work.- Missing / deleted target →
AbortScene('SCENE_NOT_FOUND'); other errors still propagate from the action.- Disable does not abort an in-flight execution, which matches the current UI toggle (it only stops listening). Remaining actions in the current run still execute — that is the right behavior for “notify, then disarm myself”.
execute()still ignoresactive, so a disabled scene can still be started by hand /scene.start/ dashboard. The notices correctly talk about triggers only.- No new
DEVICE_FEATURE_CATEGORIES/TYPES.Not
risk:high(no auth, migration, or host/runtime change). Notneeds:human-review: this exposes the existingactiveflag with the same semantics as the UI switch, from a community request.Non-blocking notes on the inline comments: a no-op enable/disable still goes through
addScene(resets interval /for_durationtimers), and the selector does not show which scenes are currently disabled.Sent by Cursor Automation: Automatic PR review
…scenes Address review feedback on the enable/disable a scene actions. setSceneActive now returns early when the target scene already has the requested active value. scene.update re-adds the scene to the live store, which cancels its triggers and schedules them again, so an action keeping a scene in the state it is already in restarted interval jobs and dropped pending "for duration" timers on every run. A scene re-armed on a schedule could therefore never reach its next tick. The scene selector of the action card also appends a "disabled" suffix to the scenes which are not active: they are the usual targets of an "Enable a scene" action and were indistinguishable from the enabled ones. Autofix-Pass: 1
There was a problem hiding this comment.
Re-reviewed after c2a2ae0. Both notes from the previous pass are fixed:
setSceneActivenow returns early when the in-memory scene already has the requestedactivevalue, so a scheduled re-arm no longer resets interval jobs orfor_durationtimers. Covered by skip + still-update-when-different tests.- The scene selector suffixes currently disabled scenes (
Name (disabled)), with en/fr/de viawithText.
Looks good to merge. Additive scene.enable / scene.disable actions persist the existing active flag through scene.update (same cancel/re-schedule path as the scene-list toggle). Self-targeting is correctly kept (unlike scene.start) for the “run once, then disarm” pattern. Missing or deleted target still AbortScene('SCENE_NOT_FOUND'). Constants feed ACTION_LIST, so Joi accepts the new types; MCP scene.create union and the front action card are wired. No new DEVICE_FEATURE_CATEGORIES / TYPES.
Not risk:high (no auth, migration, or host/runtime change). Not needs:human-review: this exposes the existing active flag with the same semantics as the UI switch, from a community request.
Sent by Cursor Automation: Automatic PR review


Implements feature request: https://community.gladysassistant.com/t/pouvoir-activer-desactiver-une-scene-depuis-une-autre-scene/10580
Description
Scenes already have an
activeflag, but until now it could only be toggled by hand in the scene UI. This PR adds two new scene actions that let a scene turn another scene'sactiveflag on or off:scene.enable)scene.disable)This removes the need for the virtual MQTT device workaround people currently use to arm/disarm a scene from another scene.
The use case described on the forum: a scene checks a water tank level every 5 minutes and notifies when it reaches 40%. It should only be armed while the tank is being filled. With these actions, the checking scene can disable itself once it has notified, and a second scene (bound to a dashboard button) re-enables it when a new filling starts.
Details:
ACTIONS.SCENE.ENABLE/ACTIONS.SCENE.DISABLEconstants.scene.update, which already cancels or re-schedules the target scene's triggers, so a disabled scene really stops listening immediately.AbortScene('SCENE_NOT_FOUND')when no scene is selected or when the target scene no longer exists (deleted in the meantime); unexpected errors are propagated.en,frandde.This pull request was produced by an automated run.
Forum
Forum: https://community.gladysassistant.com/t/pouvoir-activer-desactiver-une-scene-depuis-une-autre-scene/10580
Checklist
cd server && npm run coverage(Codecov requires 100% coverage on changed lines) and Cypress (npm run cypress:run) if the UI changednpm run eslint,npm run prettier)Generated by Claude Code