macotron.homekit
Run Home scenes from a plugin. Each scene is a shortcut that you build in the Shortcuts app with a Home action, and keep in one folder, named Home by default.
const scenes = await macotron.homekit.scenes();
if (scenes.includes("Movie Night")) await macotron.homekit.run("Movie Night");
Apple gives the HomeKit framework only to Mac Catalyst apps signed for the App Store or for development. Macotron is signed with Developer ID, so it cannot read your homes or accessories directly. Shortcuts can, and Macotron runs your shortcuts.
Setting up
- In the Shortcuts app, make a folder named
Home. - In it, make one shortcut per scene or action: add an action from the Home category, then pick a scene, or an accessory and what it should do.
- Name each shortcut the way you want it to appear, such as
Lights Off.
Calls
scenes(opts?: { folder?: string }): Promise<string[]>
Resolves with the names of the shortcuts in the folder. folder defaults to "Home". A folder that does not exist gives [].
run(name: string): Promise<boolean>
Runs the shortcut with that name and resolves when it finishes: true if it ran, false if it failed or does not exist. Any shortcut works, not only those in the folder.
See also
- macotron.shortcuts to list and run any shortcut.
- The
homekit.jsplugin, which lists the scenes in a menu bar menu.