Easiest way to get robust IFTTT support!

  • 6 September 2017
  • 13 replies
  • 3896 views

Userlevel 4
Badge +14
Hi, I have been spending a lot of time trying to create a simple and easy way to get IFTTT integration working. I know a few people would really like to have an easy way to get that, so here is one solution (the best, in my opinion, of course):

http://www.bronos.net/

It is basically the combination of a locally hosted machine (preferably a raspberry pi), which connects to a public broker server on the internet and waits for commands that you issue from IFTTT. To achieve this previously, you needed very tedious "hacks" using dropbox and various python scripts, or my HTTP API but dealing with port forwards, dynamic DNS hostnames and even your own SSL certificates.

With this you flash an SD-card with everything pre-installed, visit the local website to get knowledge about which will be your unique, public URL endpoint, and use that in your IFTTT webhooks.

Total cost would be a raspberry pi (B, 2 or 3, doesn't matter), the peripherals to it (SD-card, PSU, a case probably), and you are on your way.

I've used this extensively with my Alexa because IFTTT has the "trigger" keyword which can be used to trigger applets, which I in turn use to apply "presets" for my Sonos system.

I've tested it with Google Assistant as well, since those support arbitrary phrases to be learnt for IFTTT triggers (although, "play xxx" is reserved, unfortunately).

Please try it out, and let me know if you have any issues. Since this uses my HTTP API in parallel with the bronos cloud connection, everything that is supported in the HTTP API is supported via IFTTT, neat huh?

This is of course also useful for any online service that has the ability to integrate with arbitrary webhooks (if you can specify the format of the request)

This topic has been closed for further comments. You can use the search bar to find a similar topic, or create a new one by clicking Create Topic at the top of the page.

13 replies

Badge
Thanks Jishi, I knew those spare Raspberry Bs stashed in a drawer would come in handy one day:)
Hello!
I'm not getting it to run. After installation and "npm start" I only get the error message "missing script: start".
Userlevel 4
Badge +14
Seems like I forgot to add that to the package.json. Start it with

node index.js

In the meantime.
Userlevel 4
Badge +14
This is now fixed. Didn't affect the raspberry pi image though.
Userlevel 4
Badge +14
It just got my attention that the raspberry pi image didn't have a cleaned out token, which mean that everybody installing the raspberry pi image all got the same token. This probably resulted in that it only worked for a short period of time, until someone else connected with the same token, since the last one connected would get all the calls to his system.

This was of course a major screw-up on my part, but it has now been remedied and that token has been blacklisted.
@jishi, this looks great and very promising. Have to try this out this weekend! The only part I did not yet understand: how does the music playback actually start after IFTTT triggers "it" (quotation marks because I dont know what it actually triggers). Do I have to run the Sonos controller app on a machine on standby or from which device will the music be streamed to my Sonos after IFTTT triggering?
Userlevel 4
Badge +14
No, you don't need the sonos controller. The software that runs on the raspberry pi will take care of the controlling of the players (selecting music, playback, volumes etc), but the streaming source needs to be available. If it's an online streaming service, you are fine. If you keep local music on some computer at home, that one needs to be on.
I'm testing this for the first time using an Amazon Dash button to trigger an IFTTT applet. I followed your example to use webhooks to request my Sonos to play the previous song. The IFTTT log shows my applet triggers when I press the Amazon Dash button and the applet completes successfully. But, my Sonos does not play anything. Any tips on how to debug the Bronos webhook request?

This is the URL I specified in the webhooks web request field (that's not my real token):
https://broker.bronos.net/v1/123451234545322bbedc36040512345/MasterBedroom/play
Method: GET
Content Type: application/json
Userlevel 4
Badge +14
I'm testing this for the first time using an Amazon Dash button to trigger an IFTTT applet. I followed your example to use webhooks to request my Sonos to play the previous song. The IFTTT log shows my applet triggers when I press the Amazon Dash button and the applet completes successfully. But, my Sonos does not play anything. Any tips on how to debug the Bronos webhook request?

This is the URL I specified in the webhooks web request field (that's not my real token):
https://broker.bronos.net/v1/123451234545322bbedc36040512345/MasterBedroom/play
Method: GET
Content Type: application/json


Hi, how did you install this? Did you try running that request locally in your browser to see if it works? I think I found your attempts in my log, but it looks like you are running only the bronos software, and not the required sonos-http-api that is the actual software that controls the players. If you use the raspberry pi image, everything comes pre-installed, but if you install bronos manually you need to also run the sonos-http-api somewhere. By default it expects it to run on the same machine since it will send requests to localhost, but it is possible to run it on another machine but then you need to make sure it is configured for it.
Yep, I did a manual install of bronos-client on my Raspberry Pi that is also running media server software, but I didn't realize I also needed to install the Sonos API. Cool! Works great now! I really appreciate you making this software available!

BTW, I'm manually starting bronos-client and node-sonos-http-api using npm-start. Is there any easy way to have them start automatically when the Pi boots?
Userlevel 4
Badge +14

BTW, I'm manually starting bronos-client and node-sonos-http-api using npm-start. Is there any easy way to have them start automatically when the Pi boots?


I find that using pm2 is the easiest way to get stuff to auto start on boot, also keeping it running even if it crashes. Just search for a guide on how to install it.
Userlevel 7
Badge +26
Hi everyone, today we just announced that IFTTT and Sonos have been officially integrated. Take a look at our announcement post.
Userlevel 7
Badge +20

BTW, I'm manually starting bronos-client and node-sonos-http-api using npm-start. Is there any easy way to have them start automatically when the Pi boots?

I find that using pm2 is the easiest way to get stuff to auto start on boot, also keeping it running even if it crashes. Just search for a guide on how to install it.

PM2 works fine for me. It's also fairly simple to run node-sonos-http-api as a Docker container (even on a rPi). You need to use 'host' networking, and choose the required container restart policy.