N00b: Automate via ST when Device is Paired to Alexa

Hi - sorry if this is basic - I am new to HA, and have read a lot, but struggling in an area. I have an Alexa with some WiFi devices paired to it. I just got an ST device, and also a Samsung motion detector. My end goal is to have the motion detector turn on the lights (TopGreener WiFi dimmer switch) using an automation based out of ST. (the Alexa one does not allow me to use a timed schedule, and the ST one looks like it should). Alexa sees the motion sensor and the dimmer switch, and will allow me to turn on the light via motion. However, I want to control this via ST so I can have it only turn on between 12AM and 5 AM. The issue is that ST does not see the TopGreener switch, only the devices paired to it (like my TV). Is there a way to make it see the switch that is paired through the alexa, or no?

Thank you very much for the help - I appreciate it!

This can definitely be done, but it requires some of the advanced features of smartthings. It certainly not basic. :sunglasses:

I’m not feeling very well today so I won’t be able to walk you through all of the details, but I will give you the top level approach and then other people can help with the specifics.

Smartthings allows you to create “virtual“ devices. These exist only as code, but smartthings and Echo will treat them just like any other physical device.

So in your case, you will create a virtual motion sensor. Then you would turn that virtual motion sensor on based on all of the other conditions that you want to factor in, which could include time of day, obviously activity on the real physical motion sensor, etc.

Even better, you can create a virtual motion sensor that also has “capability.switch” which means that smartthings will see it as both a switch and a motion sensor. So you will be able to turn it on using any of the standard automations, Which will then look like a motion sensor coming on, Which you can then use to trigger your echo routine.

I hope that’s all clear. The real physical motion sensor might be detecting activity all day long, but you could set up a rule so that the Virtua motion sensor only turns on during a certain time range, when certain people are home, and when the real physical motion sensor detects activity. Or whatever set of restrictions you want to reply.

The following FAQ discusses all of this and has the DTH you will need for a sensor combined with a switch. ( I don’t remember if that one is a contact sensor or a motion sensor, but it doesn’t actually matter as the echo routine will trigger off of either and it doesn’t have to be perfect match to the physical device. )

1 Like

Hi, JDRoberts - I hope you are feeling better! Thank you for the reply even when you were not!

I am just starting to look into this, but have an immediate question. I wanted to make sure that my question came across clearly. I have the following setup:
ST Hub: Has Samsung Motion Detector paired via Zigbee
Echo Dot: Has TopGreener WiFi dimmer switch paired to it via WiFI

Desired outcome:
when motion sensed, turn on lights, but only between 12AM and 5AM, turn off after 30 seconds of no motion

In the Alexa app, I see the motion sensor, and I see the TopGreener WiFi light switch. I can set the Routine up to turn that on when the sensor see motion, and off when it does not. I can’t, however, put a schedule in place to only do it between 12AM and 5AM - just all the time. I would like to use the Samsung classic app to make a smart lighting automation, however it does not see the TopGreener WiFi dimmer switch.

So, are you saying that if I make a virtual switch, I should somehow be able to see that in the Alexa app, but have the virtual switch only active from 12-5 via the ST app? Just making sure the tie-in is correct so I can visualize it in my head.

Thank you again!


Yes, once you create the virtual switch/sensor, Approve it for use by Echo, and discover new devices from Echo, then the virtual Device shows up in your Alexa app just like all your other SmartThings devices. Echo doesn’t know that it’s virtual.

So you can then go ahead and create your routine to trigger off of that virtual sensor instead of triggering it from the real sensor.

Because the virtual sensor doesn’t really exist, you have to have an automation turn it on to make activated. That’s why it’s convenient if it also looks like a switch because those are very easy to turn on and off.

Now you use the official smart lighting feature and you say when the real motion sensor turns on, turn on the virtual switch—but only between those two specific times.

And you Will have the switch turn off after inactivity.

If you want to get even more complicated you can, but you will probably have to use something other than the official features: see the following FAQ:


Also, it’s not that the switch is only active between 12 am and 5 am— instead, it’s that the automation which turns on the virtual switch when the real motion sensor detects activity is only active between 12 AM and 5 AM. The time restriction is on the automation. :sunglasses:

1 Like

Hi, JDRoberts - OK, I have made some progress, but am stuck, though I am sure it’s probably simple once you help… :slight_smile:

I have:

  1. In the SmartThings web portal, created a Device - Simulated Switch (name = test)
  2. In the classic SmartThings app on phone, created a Routine using Simulated Switch
    2a. told that to "Automatically perform “test” when “things start happening”
    2b. Which = Motion Sensor
    2c. Things start happening = start time 12:00AM, End time 5:00 AM
  3. discovered it in the Alex app
  4. Create an Alexa Routine
    4a. When this happens / Device / NOTHING SHOWS UP

I was expecting to see the “test” device there, and be able to activate it, however it’s not there. Could you please let me know what I am missing? (I also tried a Simulated Motion Sensor instead of the Simulated Switch, but got similar results…)

Thank you ever so much - I appreciate it!


Please read the first FAQ I linked to above. It explains the process. Since Alexa will only trigger its routines from a sensor, not a switch, you have to use a DTH which is both a simulated sensor and a simulated switch. And that DTH is in the FAQ that I already linked to in post 2 above.

1 Like

Hi, JD - I read through the FAQ and got some stuff going, but am still stuck…

First though - THANK YOU for your help - I appreciate it!

OK - here’s where I am at:
My goal is to have a light switch that is WiFi (so only in Alexa) triggered by my ST hub, which has a motion sensor connected via Zigbee. I want it to only trigger the light during the hours of 11pm and 5 am. Here are the steps I have tried:

  1. In the SmartThings web portal, created a Device - Simulated Switch (name = Kitchen)
    1a. updated the DTH with BJ’s code so it is a combo switch/sensor
  2. In the classic SmartThings app on phone, created a Routine called “kitchen switch”
    2a. Turn on these lights or switches = kitchen (the simulated switch with BJ’s DTH)
    2b. Automatically perform “Kitchen switch”
    2c. Things start happening = Which: Ecolink Motion Sensor; start time 11pm, End time 5:00 am
  3. discovered it in the Alexa app
  4. Create an Alexa Routine
    4a. When this happens / Device / Kitchen (tried both Open and Close with same result)
    4b. Alexa will: turn on kitchen light at 50%

The weird thing is I swear it worked one time - I had the times wide open for testing. So after it worked, I narrowed the times to what I wanted, and it quit working! I have removed and re-added everything several times, but though it all shows up, the light will not come on.

Do you have any ideas on what I am doing wrong or missing?

Thank you!


When you say you have “removed and re-added” things, are you talking about the SmartThings skill? That’s the one that people say they had to disable/re-enable when they added a new virtual sensor in order to get it to work.

This is discussed in detail in the FAQ, but essentially after you have created the virtual device, you want to

  1. disable The smartthings skill in the Amazon app
  2. sign out of the Amazon app
  3. sign back into the Amazon app
  4. enable the SmartThings skill in the Amazon app again

At that point, as long as you created the virtual device correctly, it should be able to trigger an Amazon routine.


Perfect - thank you! :slight_smile:

1 Like