Use certain Alexa to turn on items in that room



If that method can toggle a Simulated Switch, then webCoRE can trigger off of that action, and then turn on/off the fan.


I have it working for smart lights, smart plugs, fireplace switches, light switches and smart electrical outlets.


I believe you have to label them all as ‘lights’ for this to work, correct? (Or call the devices by name.)


That is correct. You have to go into the app and change the ones you want to come on when you say lights to a light and not a switch.


You can turn on a fan as a light, but you can’t say Alexa turn on the Fan and just have it turn on the Fan in that room.

On further consideration, it might be possible to do this with Echo speaks.
If you have a single simulated Fan switch that tuns on when you say turn on the Fan. Then look from which Echo you spoke to when that switch activates with getactivity and turn on the fan in that room. Really not that complicated a piston. I might have to try that.

Although you probably won’t be able to say “Turn on the Fan” as that will probably conflict with the Alexa general commands.

Edit:Only took about 10 minutes to write that up and it’s working pretty well.

I created a simulated switch called RoomFan and whatever room I am in if I say turn Roomfan on or off it turns that Fan on or off.


I did it this way:

  1. Alexa routines

  1. When activated, they turn on my GetActivity virtual switch, and then a virtual switch for the Webcore piston.

Together, they determine which Echo was spoken to, and then turn on the appropriate fan. I have duplicate virtual switches and pistons for the various fan speeds.


I agree. So, since I have two ceiling fans - one in the Master Bedroom and one in the Living Room, I just call the fans by their ST name for verbal commands… I have also set up Alexa buttons (one per room) as on/off toggles. These are good for silent actions when sleeping.


Care to share what your code looks like?


Ok, it is going to take me some time to wrap my head around all this. I would assume that this would work for any device as well? Say if I wanted to turn on the TV. I could set it up the same way?


Well, I use my Harmony hub for that. ST isn’t an IR repeater, so it can’t directly control a TV. But this would theoretically work with any device that can be turned on/off.

It works like this:

  1. Alexa routine: “Alexa, turn on fan”

  2. The routine first turns on GetActivity virtual switch, which

  3. Turns on WC GetActivity piston. This sends a command to Amazon to determine which Echo was spoken to last. (whichLastSpokenToDevice=living room echo) This can take 2-3 seconds.

  4. Secondly, turns on the WhichFanOn virtual switch, which starts the WC WhichFanOn piston. I also duplicated the GetActivity command just to make sure the info is updated.

  5. The WhichFanOn piston takes the whichLastSpokenToDevice info to determine which fan to turn on. (Living room echo=living room fan)

WhichFanOnHigh, WhichFanOnLow, and WhichFanOff all work the same way.


And finally (regarding webCoRE), I mostly control my two ceiling fans with a piston for each fan that watches/reacts to temperature range changes with TOD, presence, furnace/AC modes and override switch conditions. Both pistons are identical with a couple different variable values.

Here’s the temperature ranges I use (changeable via variables in each piston):

And, here’s the piston for the Master Bedroom:


There was a bug, so it’s not going to be quite as clean as I had hoped. It worked but using one simulated switch as a trigger for each room was an issue. If I turned on a fan in one room and then moved to another and wanted to turn it on. I would need to turn it off and then back on so the simulated switch would change.

So I opted for another approach which I will not be able to test until tomorrow probably. I will create a Alexa command probably just call it Ceiling Fan, which will toggle the RoomFan simulated switch. Then I will determine which room and then toggle the state of the Fan in that room. So after I say Ceiling Fan or whatever I end up calling it the fan in that room will turn on if off and off if on.

After I get that working I will post it if you want. I have the piston written but I still need to create the Alexa routine and test. that shouldn’t take long but I won’t get home until late tonight so it will be Thursday before I can check it out…


One loophole for this is to:

  • Create two SimSwitches. (IE: FanOn and FanOff)
  • Alexa routine = “Alexa, turn on CeilingFan” turns on both SimSwitches
  • Alexa routine = “Alexa, turn off CeilingFan” turns off both SimSwitches

Then, webCoRE’s piston can be something like this:

If FanOn changes to on
    Do cool stuff
    Turn off FanOn  (to reset itself)

If FanOff changes to off
    Do cool stuff
    Turn on FanOff  (to reset itself)

With this method, the SimSwitches or voice commands cannot get out of sync.
You will always be able to say one command to get the proper results.


I thought about that, as that is what I do with my automated shades. I have a on and a off switch for each shade. On is a change from off to on on the ON switch and off is a change from on to off on the OFF switch. I was trying to do it with just one. My current method seems to be working.

I got home a bit early and was able to try it. My routine toggles the RoomFan switch when I say Ceiling Fan and then my Piston toggles the state of the Ceiling fan in the room I said it. Not quite as clean as saying turn it on or off, but still pretty good.


I am going to be working on this in the next couple of weeks. I just moved, so I am a bit behind. I hope you will be around to assist me as, I really want to get it going.


Not a problem. I spend an inordinant and unhealthy amount of time on these forums anyways, lol :stuck_out_tongue:


So my ceiling fan piston works really well and it got me to thinking. I should try this with other things. I have Leviosa Shades in several rooms and using this technique I can now just say raise or lower shade and it raises or lower shade in the room I am in.

My wife did not seem impressed, however.


If you EVER achieve that with a smart home, please let us know HOW:)))))))))
Your “How to post” will be the most visited and liked.


This may be a bit challenging…

I find that most women use computers as a tool to accomplish something else…
While men typically see a computer as a “toy” and/or an extension of the self.

When it comes to getting our wives more excited with SmartHomes, the best advice I can give is to approach it from her perspective. If you know she likes her bubble baths, brainstorm with her, bounce ideas off of her, but let her have total control of your latest piston.

If something bothers her around the house, try to envision a piston that will make her life easier…

She won’t care about the programming logic that you add to the piston, but if we really listen to their requests, and take it to the next level, you can rest assure that she will at least like that part of her SmartHome. (one step at a time, LOL)

Over time, there will be more and more pistons hand crafted specifically for her…
She will come to expect & rely on them… (and may get frustrated during errors)

In my opinion, all of this is positive, and heading in the right direction.


You must know my wife!