Skip to main content
  1. Shortcuts/

Smart Home Control

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
#

  1. Shortcut Input — receive the data from PocketHook
  2. Get Dictionary Value — extract state key
  3. If state equals “on”:
    • Control Home → Set lights to On
  4. 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.