Why would SmartThings API not work from flic but works from command line curl?

I am trying to get my flic buttons to work with SmartThings using HTTP request action.

They don’t have a dedicated integration with SmartThings so I am trying to use their HTTP Request option and the Smart Things Api.

First I got the api working from my command line using curl.
curl -v
-H “Content-Type: application/json”
-H “Authorization: Bearer 9dd27…”
-X POST -d ‘{“commands”:[{command:“on”,capability: ‘switch’,component:‘main’,arguments:}]}’

This works fine.

Next I configured Flic app for HTTP request when button is pressed.
Content Type:application/json
Body:{“commands”:[{command:“on”,capability: ‘switch’,component:‘main’,arguments:}]}
Http Headers:
Authorization: Bearer 9dd27…

This doesn’t work.

So next step was to debug this. So I created requestb.in inspection link.
Then I sent a CURL request to my requestb.in inspection link.
Then I sent a flic http request to my requestb.in inspection link.

They look the same for the required data.

  1. The device is in the URL so I have to assume that this would be correct from flic.
  2. The Authorization: Bearer token is in the header.
  3. The Content Type is application/json
  4. The body looks fine

Here are the two results from RequestBin
From Curl

From Flic HTTP Request

Why would the Curl request work and the Flic request fail?
Could the api be blocking flic user agent?
Could the api be blocking the flic ip for some reason?

I would not send the request directly to the ST api. I would use WebCore and send the request to that. I use that all the time for webcall from different devices and it works perfectly.

I hate to point out the obvious but the messages are not identical. The request-id and authorization are not the same. Also, the IP address is not the same. When you use curl, the request IP is the same as your hub. And flic’s is not. That might be what is causing the issue. If you issue your webcall to Webcore it is a LOT easier. Basically, all you’ll have to enter is the address like:


It’s a lot simpler than trying to access the API. Also, that would allow you to set the flic once and then you can modify its action through webcore.

If you don’t want to use webcore, you could use this HTTP endpoint smartapp.

I know but they are just test messages anyway. As long as what I sent is what was delivered they are working.

I notice your webcore has ifttt in the url, does it use IFTTT to communicate with SmartThings? Flic can already do that. I just don’t like the delay and frequent failures from IFTTT.

I have to take a look at this. Maybe I can create an endpoint app for my buttons to just control a virtual button on SmartThings and then everything is easy from that point.

In the end I found that the reason these two are the same is that I was testing using a different version of Flic and it was actually working. I need to go back and do the same test on the version I am running at home which isn’t working. I had assumed the approach I was using while away from home would work the same but it turns out it likely doesn’t. So I have to start my testing all over again.

Thanks for the input and ideas!

No, it doesn’t require ifttt. It just uses that channel but the request can come from anywhere. If you’re not using WebCore, you should check it out.
The independent smartapp I linked to would work if you don’t wanna go that route.

I just don’t want another cloud service in the loop. That is exactly what I am trying to get rid of. Otherwise I might as well just use ifttt.

webCoRE is not a cloud service, as far as I know. It only runs the configuration/designer on a cloud-based web server. All of the code runs within your ST account.

1 Like

OK thanks for that info. I guess I just don’t understand it well enough. I need to find time to evaluate CoRE and webCoRE but I find the threads extremely complex and confusing needing a lot of time to digest. Some day :slight_smile:

1 Like

You’d get the URL from WebCore. There is a whole other forum and wiki on getting that up and running. But if you just want to use the standalone HTTP endpoint app, then it will provide you with the link you’re looking for.

Yes, I understand that. I was just trying to figure out exactly how ti works. I found the github repo with the code so I can play with it now. I have a lot of experience writing smart apps and device handlers just have not created an end point like this. I have written smart apps that reach out to API’s to get information but never one that can be called from a web call. Should be interesting to try that.

The problem is the Flic HTTP Request action is extremely finicky and it doesn’t report errors when it fails so you have to just wait to see if anything happens and when it doesn’t you have to guess at what went wrong. I have become very frustrated trying to work with it. I really wish someone from SmartThings would work with the flic time to integrate the HUB directly. It would be SO NICE!

The issue really is that ST doesn’t have native BT support. If it did, integration with ST would be a lot easier.

I doubt that, flic needs custom BT code to work. I know because I built my own PI3 hub using flic BT library. I really doubt that ST having bluetooth would make any difference. Flic has reached out to SmartThings to integrate but I am told SmartThings is difficult to work with. Consider how many device handler coders still have to maintain our code because SmartThings has a very difficult policy to get the code added to their system. This also makes it easier for their support because issues can be ignored with the simple comment that they don’t support custom device code.

Flick only connects through bluetooth. Smartthings doesn’t have bluetooth connectivity. So, you need that stupid flic hub. Another hub?!? Native bluetooth support on ST is a lot more logical.

I’m with Ryan here - a Flic button is a simple BT device, and ST should be able to communicate with it.

However, it is an input device, not an output device like just about everything else that ST talks to. Is that a model that ST even supports?