Water leak sensor with alexa routine?

You shouldn’t need Alexa helper at all for this: It doesn’t create the right kind of virtual devices and you’re just going to use the built-in Alexa features.

The code for a virtual sensor which has switch capability is in post 97 of the FAQ I already gave you. That’s the one you want.

( I know that FAQ needs to be rewritten as an article in the community wiki, I just haven’t felt up to doing it last couple of weeks. It’s a lot to read through right now because it’s conversation as the features were being released. Sorry if it’s been confusing. )

Update: doing it as I outlined a few posts go isn’t quite as awesome as I imagined. Unless I’m missing something, an Alexa routine is tied to only one Echo. It’s a PITA to write six routines to do the same ting on six echo devices… and the routines don’t play from ecobee devices

You’re missing something. :wink:

If you want to have announcements from multiple devices at the same time, you use the “messaging” choice when you create the routine ( instead of the “Alexa says” choice). That let you pick all devices or multiple selected devices for the announcement. :sunglasses:

Thanks JD - my 1st routine in Alexa, you’re a great help as always

1 Like

Sorry this maybe a daft question but where is post 97? I can’t see any device handler.

Could anyone do me a step by step I’m a tad confused. I just want Alexa to announce when waters detected. Can’t get my head around this.


Post 97 is the 97th post in the thread. The thread title is a clickable link.

FAQ: Using Contact and Motion Sensors to Trigger Alexa Routines (DTH in post 97) (Official Amazon Feature)

It was posted on August 31 by BJPierron…

Apologies I’ve found them and added them in the smarthings IDE but now how do I use them?

Sorry, I’m not feeling well and I’m not up to writing out the step by step for you. Someone else will need to do that.

Ah ok no problem. Thanks for your help so far.

If anyone would do me a step by step that would be much appreciated. I’ve used ST’s a while back but for the life of me can’t get my head around this

Many thanks

Just coming back to this. Ive now created a virtual simulated contact sensor using that device handler called water detected. I can see this on my smarthings dashboard as a contact sensor. {closed}

My amazon echo sees this and allows me to setup a routine when this is open itll tell me theirs a water leak. im still struggling to find a way to trigger this using the physical leak sensor i have. Ive tried the smart lighting app but this will only allow me to control a outlet or light bulb?

Can anyone tell me where im going wrong? I feel like im nearly there :slight_smile:


The device hanlder JD linked you to should be exposed as a switch in smart lighting. So create a device using that handler and then create a smart lighting rule to turn on that device when moisture is detected by your leak sensor.


Ok ive done that and its setup using the smartlighting app and it switches on when the leak sensor detects water.

Now its a switch though rather than contact sensor alexa wont allow me to use this within a routine. ill go the my alexa app it discovers it as a switch but if i go to routines and try and create one it will only allow me to select a sensor device (motion/contact) not a switch

It should show as both. you’re using the device handler with namespace: “bjpierron” right?


Doh! No wonder i couldn’t get it working. I was using the wrong device handler all along.

It now works a treat. Thanks alot guys.

1 Like

interesting topic. I’m having trouble with trying to add the dth. should I copy the whole code and then click the from code tab in the IDE. because when I do that and click create, I get an error message saying something about error on line 36

There are almost no explanatory comments in the script. Besides copying and pasting it into the device handler what else needs to be done?

The following FAQ explains how to use custom code in smartthings. It should give you all the details that you need.

Maybe I’m very stupid, or something changed recently, I don’t want to blame anyone here, but today, I can clearly see the DHT has been published by BJPierron in Post 95, NOT Post 97. I was simply pooling my hair out to find the link for the code in post 97. Yes, I know, post 95 was just 2 posts upper, but just for the sake of accuracy…
Please correct if I’m wrong, but my browser shows today the DHT in post 95. Should I always subtract 2 from the post # :grinning:

It’s still in post 97.

Using Contact and Motion Sensors to Trigger Alexa Routines (DTH in post 97) (Official Amazon Feature)

The counter on the right of the screen has to do with whereever your cursor last had focus. But if you click on the date in the upper right of the post you can see the exact number of it.

Thanks a lot for your fast answer. It was quite helpful for someone like me who’s new to this forum.
Now grace to you, I understand how to check the post#.
I could have sword the counter that shows at the right of the page when scrolling is the post #. Damn it.
Thanks again…

1 Like

© 2019 SmartThings, Inc. All Rights Reserved. Terms of Use | Privacy Policy

SmartThings; SmartApps®; Physical Graph; Hello, Home; and Hello, Smart Home are all trademarks of the SmartThings, Inc.