How to auto switch your power amp with IFTTT

It’s trivially easy to get RoonBridge on RasPi communicate play/stop status into IFTTT (or execute any command available on your RasPi. Anyone who can paste commands on linux can do it. If you use IFTTT, you can figure out how to switch the amps (Harmony Remote, WeMo Switch, …). If you delve a little deeper into RasPi projects, you can do about anything you want: send http commands, MQTT messages, change a color led, send commands through IR led, switch a relay…)

Prerequisites:
You have a working RoonBridge on RasPi. I used Debian Jessie and the easy install. The RasPi is connected through USB to a Devialet 120. If you were able to install RoonBridge yourself, you’ll be able to do it. If you want to use IFTTT, you need a free account and a maker channel key.

Disclaimer:
Information given is as is, and I take no responsibility in whatever happens after you use this information. For myself, I’m gonna test this for a few weeks before switching my tube amps with it. If you’re amp doesn’t handle cycling power well, test it out with switching a light, sending yourself messages or mails or whatever.

Caveats
This method sends an “ON” command with every new push on the play button, or new stream. I can’t think about a scenario where periodic “ON” commands would do any harm, but beware.
I’ve been testing this for a few hours. I don’t now if this method needs finetuning for log rotation etc.

How-to

  1. login over ssh. If you installed RoonBridge, you know how to do it!

  2. Install Swatch and dependencies. This program executes commands on occurrence of text in the logfile

sudo apt-get install swatch

  1. Fire up nano to create the config file for Swatch. You can prepare the text on your pc, and paste the whole text in, or you can use nano.

sudo nano /etc/swatch.conf

  1. Paste the following text. Don’t forget to insert your IFTTT Maker Channel key twice, and also fill in the commands for On and OFF. The latter is done in the IFTTT interface.
    You can also change the command between quotes to anything that performs the required action on your Pi

watchfor /status":“Teardown/
exec “curl https://maker.ifttt.com/trigger/your_command_for_off_here/with/key/your_key_here”
watchfor /starting playback: now/
exec “curl https://maker.ifttt.com/trigger/your_command_for_on_here/with/key/your_key_here

  1. save the config file by pressing and quit nano by pressing <-x>

  2. to autostart on boot we’ve got edit rc.local:

sudo nano /etc/rc.local

  1. Paste the following on a new line before the last line (exit 0)

swatch --config-file=/etc/swatch.conf --tail-file=/var/roon/RAATServer/Logs/RAATServer_log.txt --daemon

  1. save the config file by pressing and quit nano by pressing <-x>

  2. type “sudo reboot”, wait a minute and start using roon remote to start, stop and start. Your IFTTT actions should fire.

Any comments are welcome. I guess this can use some finetuning and error handling

@crieke: I hope this answers your question in another thread.

Steven

1 Like

Thank you, Steven.
I will look into this. For now I used a self written python script to check my sonos and squeezebox player and control the Amp. I used IFTTT only for Hue Light and Wemo yet, maybe it is a better option in this case as well.

Christopher,

No need to use IFTTT. Just fire your python script on the exec lines between the quotes instead of the curl commands. I’m running this with OpenHAB. Just used IfTTT because more Roon Users will be able to use this method, if they wish. I’m no fan of running part of ones home automation outside ones own home though.

Steven

Hi Steven,

I like your setup. I also own a devialet amplifier and am frustrated at the Moment that I cannot use IFTTT or the Harmony remote for Controlling it.

Yesterday, I became aware of Global Cache iTach which allows to send commands to the iTach device via IP which then tells devialet what to do (connected via that special serial cable).

I also would like to tell roon (headless version installed on my NUC), to start playing a playlist of my choice.

So I have a few questions for you:

  1. How do you control devialet? Manually by using the devialet app or devialet remote?
  2. Do I really need the RasPi for controlling roon via IFTTT or would it also be possible to use the NUC only?
  3. Is there a possibility to control roon via http commands as well?

Regards
Kian