Integrating ceiling fans/fireplaces into WebCoRE using Bond bridge


#1

I am participating in the beta program for the local API on the Bond Bridge . With the most recent beta firmware, I can now easily use the “Make Web Request” action within pistons to control my Minka Aire ceiling fans. With almost every ceiling fan going towards RF remotes, integrating these into home automation can be vexing. Bond is trying to solve that with this product. It is still very much in beta, one of my ceiling fans does not work at all, so I am not prepared to recommend buying one at this point. But, support was very responsive even before I started the beta, and the devs have been great to work with during the beta. For example, originally they handled authenticating a web request using a custom HTTP header. This worked great with curl, but will not work at all with WebCoRE. When I described the problem, they added an additional auth method using the body of the PUT request that made integrating with WebCoRE a cinch. I will update once the beta finishes (hopefully with all my fans fully working!).


#2

To get started with the bridge, I created a virtual switch and then created a simple piston tied to that switch to control the light on the ceiling fan:

The ‘your-token-here’ is an auth token you can get from the iOS/Android Bond app to authenticate the API requests. The deviceid is a unique ID assigned by the bridge when you add a fan/fireplace/whatever remote to the bridge. You would need to use ‘curl’ or something similar to find this (this is well documented in the API guide for the bond). I also masked my IP address for obvious reasons. Previously, the only way to integrate Bond with ST/WebCoRE was using IFTTT, which had horrible latency (like 5 seconds after button push). With the new local API, latency is well under a second. I won’t call it instantaneous, but it is very satisfactory.


#3

Following up on this topic, after further refinements the Bond product is now essentially perfect for what I need. The latency is so low as to be barely perceptible. I have sylvania zigbee buttons mounted on top of the light switches in my kids’ bedrooms to control their ceiling fans, including the light on the fan. Pushing a button triggers a piston to send a web request to the Bond bridge to turn on (or off) the lights. This now happens so quickly, that I cannot tell the difference in latency vs holding the fan remote in my hand and just hitting the button on the remote.

I can say I recommend Bond as a solution to integrate ceiling fans into SmartThings without any reservation.


#4

A couple notes on getting it working:

Setting the auth token is a little tricky to get the syntax right on, be very careful to note exactly what I show in the screenshot. The token itself is a hex string, like ‘abcdef1234567890’. What I ended doing was setting a global variable with just the token. Like this:

I can then use this in any piston that needs to talk to the Bond. I also set global variables for the Device ID for each ceiling fan (follow the Bond API docs on how to retrieve device IDs).

When creating a piston, I define two variables. First, the http put request body:

I tried to make this expression what I saved in the global, but WebCoRE will not accept this expression in a global string variable for some reason. That is why I set in the piston itself. The expression needs to be:

'\{\"_token\": \"'@Bond1Token'\"\}'

The second variable is the URL for the web request:

Obviously change the fake 1.2.3.4 IP address to what the Bond bridge actually is. I could have set that IP as a global variable, but since I use static DHCP entries for things like the bridge, that value will never change in my environment.

Last thing is to create the web request itself, which looks like this:

Hope this helps integrate the Bond Bridge with SmartThings using WebCoRE. As I stated above, the Bond folks have been great to work with throughout the beta process and their support has been top notch.


#5

We’ll be adding support to deactivate token authentication on trusted networks pretty soon, too, to make this even more simple.


#6

not to fork this topic. I have a fan that support winter mode via remote.

Would I send this command?
http://1.1.1.1/v2/devices/"@FoyerDevID"/actions/SetDirection(-1)

or do I need to change something in the web request?


#7

The -1 should be in the body of the request as an argument {"argument": -1}

FYI we implemented this, if this simplifies things for anyone’s setup: http://docs-local.appbond.com/#tag/Token/paths/~1v2~1token/patch. See the disable flag


#8

@bond-jacob I’m novice when it comes to webcore and working with API’s. But I’d like to set a breeze script so would I use the following link in my request?

"http://1.1.1.1/v2/devices/%22@XXXXXXDevID%22/actions/SetBreeze([1, 20, 90])"


#9

@teh.d or @bond-jacob, could either of you help me figure out how to translate the following curl command into webCoRE web request?

curl -H "BOND-Token: f074b61f628018fd" -i http://192.100.0.61/v2/devices/79135791/actions/SetSpeed -X PUT -d "{\"argument\": 3}"

I’m trying to follow the steps in Post #4 but it seems like I’m getting stuck on adding the argument part. I can get this to work properly in my Mac via terminal but having difficult getting it to work in a Rest client or the webCoRE web request action.

I’m somewhat of a novice with the advanced features of webCoRE so I feel like doing this is probably super easy for most. Can anyone advise the best way to approach this?