Using Execute Scene API

Has anyone been able to successfully use the Execute Scene functionality as shown in the Bond Local API with the Bond Bridge model BD-1000?

I’ve been able to successfully use most of the Scene commands–such as getting the list of scenes, details of an individual scene, etc.–but have been unable to execute (run) a scene using curl commands.

This is what’s failing for me:

C:\>curl -H "BOND-Token: 146c79028d606d23" -i http://10.xx.xx.xxx/v2/scenes/38c8bcdf8f7cf474/
HTTP/1.1 200 OK
Connection: close
BOND-Flags: 4
Content-Length: 372
Content-Type: application/json; charset=utf-8

Note the response is 200 OK, which is NOT one of the listed responses in the API document. I should be seeing 204 Scene Executed (or one of the error responses).

Any tips/hints on using this functionality? I’m writing an interface for a home automation hub and would like to add this functionality to it.

Thanks in advance for any help y’all can provide! :wink:

The URL you’re hitting (GET /v2/scenes/{id}/) is the endpoint for retrieving scene details, not executing it — that’s exactly why you’re getting a 200 with a JSON body (that response you cut off is probably the scene definition itself).

To execute the scene, you need to PUT to the /run sub-resource:

curl -X PUT -H "BOND-Token: 146c79028d606d23" -i http://10.xx.xx.xxx/v2/scenes/38c8bcdf8f7cf474/run -d '{}'

Two things to double check:

  1. Method matters — plain curl with no -X sends a GET. You need -X PUT.
  2. Path matters — append /run, not just the bare scene ID.

That should give you the 204 response you were expecting. Let us know if that doesn’t resolve it.

2 Likes

Thank you, Chris. I’m embarrassed I didn’t catch that error. :flushed_face:

It works, of course–although I got "_error_id":23,"_error_msg":"json parse error" until I changed the -d “{}” to use double quotes instead of the single quotes in your example.

Appreciate the quick assistance!

BTW, a nice addition to the Bond App would be the ability to get the scene_id directly (perhaps in a way similar to that of groups, as available in Group Settings. It would save someone from grinding through fetching the list of groups and matching each id to the name of the scene.

2 Likes

Hey @Barkis !

I am one of the developers of the Bond Home app, and I am glad to share that we are working on adding the Scene ID to the Scene Details screen, just below the Scene name, with a tap on it to copy, just like the other ID cells (for example, the one in Group Settings)

The next app version release is scheduled for August 17, so it may take a while until you get this update, but if you would like to have it sooner, you can join our Beta testing program using this link: Join the Bond Home beta - TestFlight - Apple

If you have any questions, feel free to send me a DM :smiley:

Thanks a lot!

3 Likes