Flic button

@Brenttron @fredrik Yeah, my initial instruction was not that clear… I tried to put more detail on them, let me know if you are stuck somewhere and you need more help to get going.

2 Likes

@jbisson Thanks for updating the instructions. Much clearer now. I managed to get the access_token by using curl, but after trying the public end-point in my browser I get the following message:

{“error”:true,“type”:“AccessDenied”,“message”:“This request is not authorized by the specified access token”}

Do you have any suggestions how to get past this?

BTW, the curl syntax which eventually gave me the access token was: curl -X POST -d “grant_type=authorization_code&code=CODE&client_id=CLIENTID&client_secret=CLIENTSECRET&redirect_uri=www.blah123.comhttps://graph.api.smartthings.com/oauth/token --header “Content-Type: application/x-www-form-urlencoded”

PS. I’m using the UK Hub if that changes anything…

2 Likes

@jaaks I’m assuming you are at step 10 correct? Could you tell me which url you are trying to use? It should look like this one:
https://graph.api.smartthings.com/api/smartapps/installations/ba86d3a6-f498-4803-b503-abfd45e102b5/button/turquise/0/click?access_token=54cc5a76-53ac-5497-96ff-4846fbc02a11

1 Like

@jbisson Thanks so much for the help. I’m indeed at step 10 and the response I got from step 9 was:
{“access_token”:“03c0bf71-xxxx-xxxx-8ed2-28004ca8f6d5”,“token_type”:“bearer”,“expires_in”:1576781340,“scope”:“app”}

The public end-point I’m trying to reach is: https://graph.api.smartthings.com/api/smartapps/installations/734d15f6-xxxx-xxxx-b855-0a1f0e845858/button/white/0/click?access_token=03c0bf71-xxxx-xxxx-8ed2-28004ca8f6d5

1 Like

@jaaks My bad…there is another step that you needed to do… I’ll udpate my steps. But basically, you need to do this:
https://graph.api.smartthings.com/api/smartapps/endpoints?access_token=bcea5b37-1868-4418-a131-3c82a2e9eb91

and this will give you the url for your endpoint (in the uri) section. Just that take link and append the /button section.

1 Like

The questioner is in the UK. It’s likely that the URL will be different.

1 Like

@jbisson Thanks for the updates. These got me one step further, but still the end-point does not appear to be operational.

The new instructions for Step 10 gave me the following:
[{“oauthClient”:{“clientId”:"…"},“location”:{“id”:"…",“name”:"…"},“uri”:“https://graph-eu01-euwest1.api.smartthings.com:443/api/smartapps/installations/a096c1ec-xxxx-xxxx-b5fa-cc39fabb3865”,“base_url”:“https://graph-eu01-euwest1.api.smartthings.com:443”,“url”:"/api/smartapps/installations/a096c1ec-xxxx-xxxx-b5fa-cc39fabb3865"}]

After that I tried to access the end-point at https://graph-eu01-euwest1.api.smartthings.com:443/api/smartapps/installations/a096c1ec-xxxx-xxxx-b5fa-cc39fabb3865/button/white/0/click?access_token=4b17641d-xxxx-xxxx-88a2-4524e95676cb

However, the response is probably not what it should be:
{“error”:true,“type”:“SmartAppException”,“message”:“Method Not Allowed”}

1 Like

I forgot I changed the smart app from GET to a PUT so you’ll need to use curl to trigger it. The url is good, just need to use a PUT. Try this:
curl -X PUT -H “Content-Type: application/x-www-form-urlencoded” -d ‘’ “https://graph.api.smartthings.com/api/smartapps/installations/a096c1ec-aa3e-41de-b5fa-cc39fabb3865/button/white/0/click?access_token=bcea5b37-1868-4418-a131-3c82a2e9eb90” --header “Content-Type: application/x-www-form-urlencoded”

1 Like

@jbisson That did the trick, thank you! Was quite a journey to get this to work, but it’s working perfectly now and the latency seems to be a lot better compared to IFTTT. Thanks again for all the help.

2 Likes

One last question though… How to you get CoRE to detect the click and doubleClick events?

It’s working perfectly well with the hold function.

However, CoRE does not seem to detect the push capability of these Flic button device types and the double click does not seem to be a separate event altogether.

1 Like

Click should be button one, double-click should be button two, and long hold should be button three from core’s perspective.

That’s how the other button controllers work – – they convert their actions to a button number and send that.

1 Like

@JDRoberts Thank you for the suggestion. However, it seems the Flic Device Type does not function like this. At least I was not able to get the click and double-click events working while testing the different variations of buttons 1-4.

The Flic device type in SmartThings app is capturing the physical button events perfectly, but right now I was only able to get the hold function detected in CoRE as a condition.

Any help is greatly appreciated.

1 Like

@jaaks I remember that I needed to tweak the CoRE to use a 3 events system. However, I just made a change to the flic button handler to support the 3 buttons (as suggested by @JDRoberts) so it should now work. Just update the flic button handler (should be version 1.1.0), make sure you re-configure it and update it.

The mapping between action and button numbers are as follow, this will be very usefl if using CoRE smartApps:
Click event: Button#1 -> pushed
Double Click event: Button#2 -> pushed
Hold event Button#3 -> pushed

let me know!

2 Likes

It also means the flic should be able to be used with The official smart lighting feature. It recognizes buttons as a control method. :sunglasses:

1 Like

@jbisson I’m glad to report everything in working perfectly now! Both with CoRE and the official Smart Lighting SmartApp as @JDRoberts suggested.

As one of the backers of Flic on Indiegogo back in 2014 it’s great to finally see these things come to good use with SmartThings. The latency always bothered me when using IFTTT for the integration.

The delay is around one second now compared to 4-5 seconds with IFTTT and that makes these buttons much easier to live with.

Thanks for developing this!

3 Likes

Three Cheers to jbisson, jaaks, and JDRoberts on this one. I was able to take the instruction steps written by jbisson along with the troubleshooting done by jaaks and implement everything this evening and all is working perfectly! It sure did take me a while to piece it all together but with this and core I am up and running. Thanks for all the time put in on it. Also, thanks to JDRoberts for the IFTTT method and the suggestion to improve the Flic button handler. My Flics and I are now living happily! :smiley:

3 Likes

Hey @JDRoberts! I was just curious how you’re liking your Flic button a few months later. Have you tried a Lowe’s Iris button to compare against? I’m just needing something reliable for WAF that will turn on our bedstand lights in the middle of the night so she doesn’t have to reach for her phone.

Thanks!

Edit: or is there some other button on the market that I’m missing? Amazon IoT button via IFTTT? I’m trying to turn on z-wave dimming modules.

I still really like the flic buttons, but our household is unusual in that the buttons have to be dog – friendly so my service dog can use them also. The flic is a nice soft rubbery button, so he likes those. Although his new favorite is the harmony pop buttons which are much bigger. :sunglasses::dog:

There are quite a few button-type devices now, some wall mountable, some for tabletop or handheld. See the following list (this is a clickable link):

Thanks for this answer JDRoberts, I really appreciate it!

1 Like

I agree - the buttons should support z-wave or zigbee, or something else, to avoid being dependent of a mobile/internet/IFTTT etc. They have a really nice button, but it is difficult to base ones home automation on a button that may not work when it is needed :slight_smile: