Skip to content

Added feature to trigger a shortcut when light is turned on or off#11

Open
zachcasper wants to merge 1 commit intoraine:mainfrom
zachcasper:main
Open

Added feature to trigger a shortcut when light is turned on or off#11
zachcasper wants to merge 1 commit intoraine:mainfrom
zachcasper:main

Conversation

@zachcasper
Copy link
Copy Markdown

This pull request adds support for running Apple Shortcuts automatically when Elgato lights are turned on or off. Users can now specify shortcut names in the Automation Settings, and the app will trigger the corresponding Shortcut whenever the light state changes. The update also improves documentation and internal event handling to support this feature.

Apple Shortcut Integration:

  • Added two new @AppStorage properties to AppState for storing the names of Shortcuts to run when lights turn on or off (shortcutOnLightOn, shortcutOnLightOff).
  • Updated AutomationSettingsView to include text fields for users to enter Shortcut names, and ensured these fields are reset to defaults when requested. [1] [2]
  • Introduced a new ShortcutTriggerController class, instantiated in AppCoordinator, to handle triggering Shortcuts based on light state changes. [1] [2]
  • Modified the Xcode project file to add ShortcutTriggerController.swift to the build and source lists. [1] [2] [3] [4]

Light State Change Event Handling:

  • Added a lightStateChanged static PassthroughSubject to ElgatoDevice, and publish an event every time the light's on/off state is changed. This enables other components (like the shortcut trigger) to react to light state changes. [1] [2]

Documentation Updates:

  • Updated README.md to document the new Apple Shortcuts integration and provide usage instructions for triggering Shortcuts on light state changes. [1] [2]

Signed-off-by: Zach Casper <zachcasper@microsoft.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