Routine or scene or piston...?


#1

I would like to do certain things like “turn off all downstairs lights”, “turn off all lights”, “turn off all lights and thermostat”.

With this, I will set certain buttons on certain HS-WD200+ switches to run some of these. I will also want to be able to interact with Alexa for some of these things.

Is it best to set this all up within ST routines, ST scenes, or in WebCoRE pistons?


#2

Not sure I can answer your question directly but I can tell you that with the new SmartThings app, routines are gone and you have to use the scene option.

You can still use routines in the classic app


#3

I may be a little biased, but I would recommend doing all of your coding in webCoRE, whenever possible. (even ‘Scenes’ and ‘Routines’ are better if coded entirely in webCoRE)


#4

I agree. I don’t have any routines or scenes and everything is done with webcore. It makes it easier to troubleshoot / keep up.


#5

I definitely considered that. My next question is … how do you integrate that with Alexa most ideally?


#6

I use virtual switches.
Alexa goodnight = turn off VS #1
piston #1 = if vs #1 turns of do XYZ


#7

Thank you for your suggestion. I’m trying to implement:

If VS switch changes to “off”:
----With a, b, c, d, etc, do: turn off

So I turn off VS, and indeed it turns off all the devices. Now I turn on some devices, and turn off VS again (though it is already off) and it doesn’t turn off the devices because it doesn’t “change to” off since it was already off. Any most efficient suggestions?

Thank you


#8

Since all your examples were to turn off the lights, this is how I would do it:

IF SimSwitch changes to off
Then 
    Turn off 4 lights
    Wait 1 sec
    Turn on SimSwitch
END IF

This resets the SimSwitch for the next cycle.


#9

Before your timer idea, I thought about doing “if any of a, b, c, d turn on > turn on simswitch” but waiting a second is just as good and easier. I can also just use a simulated button instead of virtual switch.

However, since I am creating the virtual switch and routine anyway, I was hoping to use it to also be able to turn ON all the lights. I could not wrap my head around how to do that though with just one virtual switch. Would I need two virtual switches for that?


#10

Hmmm… One SimSwitch to sync with 4 bulbs that can be any which way…

I think using two SimSwitches would be the easy way, but I can think of a few ways that you could do it with only one SimSwitch.

  1. If all 4 bulbs are always the same (either all on, or all off) -OR-
  2. If your turn all bulbs on always happens within a certain time period, and turn all off is a different time period -OR-
  3. If one of the 4 bulbs is treated as a ‘master’ bulb, and the SimSwitch follows that bulb.

If you decide to go with using two SimSwitches, there is a trick you may appreciate. You can ‘group’ the two SimSwitches in Alexa, so, for example saying, “Alexa, turn on SimSwitches” she can actually try to turn on both devices. One she will always succeed, one she will always fail, but webCoRE can pick up the slack and sync the two. This way, you don’t have to remember two different phrases for her


#11

Re 1, 2, 3: The switches are all independent and unrelated to times of the day.

I am not sure I understand how that works. How does Alexa succeed with one and fail with the other / how do you use webCoRE to sync the two?


#12

This is a creative approach, so it is likely undocumented anywhere…

Using the IDE, create 2 SimSwitches: ‘AllOn’ & ‘AllOff’.
The pistons in webCoRE can be based on this code:

IF AllOn changes to on
Then 
    Turn on 4 lights
    Wait 1 sec
    Turn off AllOn
END IF

IF AllOff changes to off
Then 
    Turn off 4 lights
    Wait 1 sec
    Turn on AllOff
END IF

Then, all you have to do is ‘Group’ the two SimSwitches in the Alexa app, maybe something like ‘Master Switch’. You will then be able to say, “Alexa, turn on/off Master Switch”, and the 4 bulbs will adjust accordingly.


Except for a few seconds, AllOn will perpetually be in the off position, and AllOff will be on.
So when you turn on/off the ‘Group’, only one command will actually be sent, and the other will be ignored.


#13

This makes perfect sense. Thank you!