Quick question: how to trigger a "shortcut" via API?

Dear Neeo SDK team,

I'm having a little trouble understanding how to execute a "shortcut" (not a "macro" - triggering those works perfectly!). Based on the data I receive:

{
    "deviceName": "Mini",
    "deviceRoomName": "Living Room",
    "deviceRoomKey": "6232364705365622784",
    "deviceKey": "6351832794427031552",
    "componentName": "OPTIONS",
    "componentType": "button",
    "componentKey": "6351832794590609408",
    "componentLabel": "OPTIONS",
    "actionName": null,
    "name": "OPTIONS (Mini)",
    "key": "6351861918256332800",
    "weight": 2
}

I'd expect to have to call the URL:

http://192.168.1.122:3000/v1/projects/home/rooms/6232364705365622784/devices/6351832794427031552/macros/6351861918256332800/trigger

E.g. filling values in order "deviceRoomKey", "deviceKey" and either "componentKey" or "key".

Problem is, I've tried using both of those potential keys as a macro key, but the API yields a 404. Inspecting the list of macros for the device also does not include any of the two IDs.

So my question is: how do I trigger a shortcut via API? Must I resolve the correct "macro" somehow and if so, how can I do that? Or is there a different URL I must call to trigger "shortcuts" which is different from the one that triggers a "macro"?

PS: I've tried adding "/trigger" after the URL that gave the JSON for the "shortcut" I pasted above. It gives a 404. And I don't know where else to attempt so I hope you can help!

Cheers,

Claus Due

Reply
2replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • Hi Claus,

    Shortcuts cannot always be directly triggered, for example text labels or images cannot be triggered currently, widgets which are made of multiple macros or even sliders which work differently.

    For a componentType of button like you have above the componentName and componentKey (OPTIONS and 6351832794590609408) should match a macro on the Mini device. So the url should be:

    http://192.168.1.122:3000/v1/projects/home/rooms/6232364705365622784/devices/6351832794427031552/macros/6351832794590609408/trigger

    To summarize regarding your questions, shortcuts cannot currently be explicitly triggered. For button and widget type shortcuts you have to lookup the desired macro and trigger it.

    The trigger currently results in a 500 if the wrong keys are used, 404 "Not found" indicates the url doesn't match a known route.

    Let me know if you have further questions.

    Like
  • Hi Patrick,

    Thanks for the response - I must admit, so far the only shortcut/widget I've been working with is the button ones, including the multi-button ones like d-pad and transport. With your explanation above I'm sure I can make those work like they should, and that solves my immediate question. I just have to look them up by name in the macros of the device they specify.

    I might have more questions later on about the other component types. As far as possible I try to seek the answers in the existing NodeJS SDK so I don't bother you needlessly ;)

    Cheers,

    Claus

    Like
Like Follow