Overview#
Use PocketHook as a chat interface to control your smart home devices. Your server decides which devices to control based on your message, and triggers the appropriate iOS Shortcut.
Server Command#
Send lights on or lights off to your server.
Server Response#
{
"msg": "Turning on lights...",
"shortcut": "ToggleLights",
"data": { "state": "on" }
}
Required iOS Shortcut#
ToggleLights#
- Shortcut Input — receive the data from PocketHook
- Get Dictionary Value — extract
statekey - If state equals “on”:
- Control Home → Set lights to On
- Otherwise:
- Control Home → Set lights to Off
Server Code (router.ts)#
case "lights on":
return toResponse(
shortcut("Turning on lights...", "ToggleLights", { state: "on" })
);
case "lights off":
return toResponse(
shortcut("Turning off lights...", "ToggleLights", { state: "off" })
);
Advanced: Room-Specific Control#
Extend this with room parameters:
case "bedroom lights":
return toResponse(
shortcut("Bedroom lights...", "ToggleLights", {
state: "on",
room: "bedroom"
})
);
In the Shortcut, extract the room value and use it with the Control Home action to target specific rooms.