Using Dawn to Dusk for Lights that work with Alexa, but do not work with smartthings

I have Echo devices, Lohas (Tuya) Lights and ST motion sensors. All showing in the Alexa app.
All working perfectly with Alexa routines to turn lights on/off when motion is sensed during certain hours.
Going forward this will be again as the days grow longer (having to manually adjust the time the lights go on/off).

It is not possible to add the lights directly to SmartThings.
I have integrated webCore into the ST app.

I understand I should now be able to create a virtual switch/sensor (not sure which) in the ST IDE, I can manage this if I knew which.
But how to use this, with the Smart Lighting Smart App to get the lights to come on only during Dusk till dawn?
Looked at a few guides and struggling to get it working.

If it is not possible to add the lights to ST, then you probably cannot add them to webcore. And therefore you cannot control them with either. And as far as I can tell, the Tuya app does not use sunrise/sunset in their WiFi scheduling. You might look into IFTTT. I do not use that and cannot advise you there.

@JDRoberts might be a great source for info here.

Virtual switches, used with an automation to trigger at dusk/dawn, and using Alexa as the man in the middle to control the lights based on said virtual switch. Pretty easy!

This should help:

Uh, yep, missed that part. If they are visible to Alexa, many options are possible. Thanks for pointing that out @saosinx88.

2 Likes

This should be pretty straightforward as long as you think about it the right way.

  1. If the light were in your smartthings account, you could control it the way you want to, correct?

If so, set up your piston to do everything you want, but have the end result be that it turn on a virtual switch instead of the actual light.

  1. Now make sure that you can create a Alexa routine (not a smart things routine) such that when a specific sensor opens, your Lohas light turns on.

  2. So far, so good. Now we have to hook those two together.

Fortunately, one of the community members here has created a DTH for a virtual device which is both a sensor and a switch. When you use anything to turn on the switch, including smartlighting or a webcore piston, the sensor will look like it opened. When you turn off the switch, the sensor will look like it closed.

Voila! Now you have a virtual sensor that you can turn on and off just like a switch. This is how we will tie 1) and 2) above together.

The community FAQ will walk you through the exact steps to create that virtual device and use it in an Amazon routine

There is a set of very specific steps that have to be done in a particular order. So do all of the steps in exactly the order shown, even if you think you have already done some of them.

https://thingsthataresmart.wiki/index.php?title=How_to_use_SmartThings_to_have_Alexa_do_something_without_speaking_to_it

At the end of this you will have a virtual device which you can turn on and off like a switch, which will look to Alexa like a sensor is opening and closing. :sunglasses:

  1. now go back to the automation/piston that you created in step one and have it turn on the virtual switch that you created in step four.

  2. and finally, go back to the Alexa routine that you created in step two, and change it so that it triggers based on the virtual sensor that you created in step four.

And that should do it. Whatever logic you set up, when smartthings turns the virtual switch on, The associated virtual contact sensor will open and your Alexa routine will turn on your Lohas light.

  1. Then go back up to the beginning with step one and start over again but this time use the logic to turn the light off.

So you will end up with one routine that turns the lohas light on and a separate routine that turned the lohas light off.

I don’t know whether you will need two pistons or not, that just depends on how you design it.

So for each Lohas Light you will have one virtual device created using the instructions in the community FAQ. We usually call this virtual device a “proxy.“ What is unusual about it is that the proxy device will look like both a switch and a sensor. That makes it easy to turn on and off while still having a device that Alexa can recognize to trigger an Alexa routine.

You can use the same proxy with Ifttt if your switch has an IFTTT channel. And have your 3rd party switch be the “if” and the switch part of the proxy be the “that.“ again you need one applet to turn the proxy on and another applet to turn the proxy off. :sunglasses:

I love this community
nice, helpful people everywhere!

1 Like

Thanks everyone. I already sorted this.
Created a virtual switch.
Setup routine in Alexa to turn light on with virtual switch turned on.
Set up an automation in Smart Lighting to turn switch on dusk till dawn when motion starts and to turn off when motion stops with duration 1 minute.
All working :slight_smile:

Quick edit.
I forgot I also have Alexa routine to turn off light after motion stops for duration 1 minute.

3 Likes