Amazon Echo as Security Siren?

Hey all, I’m just now putting together my list of SmartThings devices, and I’m looking into security sirens. I’d also like to add an Echo at some point and thought perhaps these two could be combined. Would there be a way to have the echo sound a siren at full volume when a motion sensor or open/close sensor is tripped? Thanks in advance.

At present, the echo is not designed to be controlled by other devices. For example, there’s no way to easily have it do a voice notification if, say, the doors are left open. The siren is the same issue. The echo is set up to receive your voice input, parse it with a natural language parser, and then pass along request to other devices. Not to accept incoming requests that aren’t through its voice parser.

You can record individual custom sound as “songs” and then have it play that song, but it’s not very smooth.

You can also temporarily pair it as a Bluetooth speaker to another sound source, like your phone, or your computer, but again, you have to pre-recorded the sound you wanted to play, and you basically lose anything that’s interesting about the echo while it’s acting as a speaker.

You can have a siren sound much more easily from something like a Sonos or any of the cheaper alternatives to that. Or the classic dog barking etc.,

It’s entirely possible that at sometime in the future, echo will have a way to send it “make a sound now” commands, but it’s not in the current command structure.

So there are many different devices and different ways to get different sound to play as alerts when you have a SmartThings system, but echo is not part of that structure at this time.

The fortrezz is a popular networkable siren. And if you’re willing to spend the money, the Sonos is a very popular and very flexible device.

1 Like

Great information. Thanks very much. I’ll look into alternative options for now.

1 Like

Hi there,

I’ve tried doing some digging around, but sometimes these forums can be hard to stay current on! Since it’s been a couple of months since your comment, I was wondering if you know of any updates?

Thank you!

Jake

No change yet, Amazon still has Echo set up only as a voice parser or a Bluetooth speaker but no push sound capability or text to speech.

Amazon has to add the capability, then ST could use it. So use your regular Alexa app to put it in as a feature request through feedback.

What if you created a playlist (prime music, etc.) with an alarm or siren type sound/music and used IFTTT to cause echo to play this at max volume based on your ST event trigger.

Amazon does not at present offer any actions (" that" options) for their IFTTT channel. They have to add the push capability before ST could use it.

While it’s neither simple or easy, and does require an additional android device, there is now a way to have echo do voice notifications. See the following:

I got it working as a Siren, for this you need a WEB SERVER though. It’s a bit long multi-step process.

Short Story:
As we can control Echo’s music player through Amazon Alexa App on the browser (alexa.amazon.com), we can capture those URL requests through Developer Tools as cURLs and execute it on the server through an IFTTT virtual switch.

Long Story:

  1. Go to alexa.amazon.com on Chrome
  2. Go to Music & Books
  3. My Music Library (Upload a Siren Mp3 here) (Or we can trigger play command on Now Playing & Echo will resume what you were listening previously (Eg: TuneIn station)
  4. Open Developer Tools (F12), then Network tab
  5. Click on Siren Mp3 file on your Music Library
  6. Copy specific cURL with the track information (the one with the trackId:XXXXXX)
  7. Create a Virtual Button & link it to IFTTT Maker to request the URL on your web server (which will then execute the cURL)

Here’s my PHP code on the server (edited to remove my device IDs)

<?php if($_GET['uid'] != 'UNIQUE_CODE_HERE_SO_THERE_IS_SOME_SECURITY') exit(); switch($_GET['command']){ case "play": shell_exec("curl 'https://pitangui.amazon.com/api/np/command?deviceSerialNumber=.................XXXXXXXXXXXXXXX"); // Set volume to maximum shell_exec("curl 'https://pitangui.amazon.com/api/cloudplayer/queue-and-play?deviceSerialNumber=.................XXXXXXXXXXXXXXX"); // Then play Siren track break; case "pause": shell_exec("curl 'https://pitangui.amazon.com/api/np/command?deviceSerialNumber=.................XXXXXXXXXXXXXXX"); break; } echo 'done'; ?>

(You might have to update the cURL time to time as the browser session will get expired after some time on Amazon server, mine is working fine for last 2+ weeks)

You’re welcome! :slight_smile:

1 Like

Hi

This looks like exactly what I was after. When you say in step 7 “in your web server” what do you mean by this? I guess I am unsure where I need the code to be pasted?

Thanks

Lee

Hi Lee,

You need your own web server to do this.

In step 7,

In your web server, you need to execute the curl code (which sends a signal to Amazon Alexa Server to play the siren.mp3)
That’s my PHP code above on my web server.

Anyone got a python implementation of this?

This seems like a solution I could possibly use for something similar.
I was wanting to have my Echo start my playlist at night which is the sound of ocean waves. Every night I need to say a few commands to start it. But using what you described above I could maybe execute the operation when I turn off one of my lights in my BR as the trigger.
I don’t know anything about web servers though. I kind of searched youtube a little and was wanting to know which web server are you using?
And do you think I could do what I described above?

Hi Steven,

It’s bit technical & require some coding knowledge on the server.

Basically any web server would do, where you can execute an url request (I’m using curl here) to Amazon Alexa Service.

I’m looking at a way to implement this directly on SmartThings (so far the documentation says I can do it via http requests). I’m still learning programming on SmartThings, will get back here if I got it right.

Sounds like it may be beyond my know-how. If you do get something in SmartThings I would definitely love to use it.

Does this still work?

I’ve uploaded an MP3 to the Amazon account and I’ve captured the request with chrome dev tools.

When I click play in Amazon Music, the track starts playing as expected…

I’ve written a PHP script which should send the requests to “https://layla.amazon.co.uk/” as opposed to “https://pitangui.amazon.com” since I’m in Europe, but despite all of this, the track doesn’t start playing.

I’ve even copied ALL of the headers which chrome is sending, but this doesn’t seem to work.

I just wondered if this was still working for you… and if so, whether you could provide any further details on this.

Cheers

Jason

Managed to get this working in the end. Awesome stuff!

Hi Jason,

So sorry about my late reply. Glad you got it working. Yes it’s working fine for me too, using it for few months now.

Only issue I noticed is that the session expire when my Echo Dot reboots (power loss). So I’ve to update the code again. As I’m running it through a UPS along with my SmartThings Hub + Router, it’s pretty stable than I expected.

I’m pretty sure we can integrate this as a Device Handler it self without using a remote server, but I didn’t have the time to play with it (not so familiar with SmartThings API)

Does this method still work?

Just tried to run a URL with my device names based on Fiddler/Network Tools (F12) and it gave an error. If this ever worked, it seems like it’s a huge security flaw that w/o authentication you can have an Echo play a sound… I’m guessing the flaw was plugged at some point by Amazon.

:eyes::thinking:I’m curious as well.