[RELEASE] Virtual / Physical Switch Sync

Does the simulated energy switch that you have installed have this method? Long shot, but maybe you have an older version . . .

> def parse(Map description) {
> 	//def pair = description.split(":")
> 	//createEvent(name: pair[0].trim(), value: pair[1].trim())
>     def eventMap
>     if (description.type == null) eventMap = [name:"$description.name", value:"$description.value"]
>     else eventMap = [name:"$description.name", value:"$description.value", type:"$description.type"]
>     createEvent(eventMap)
> }

Yep, it has that method…

I did some more looking and I am still kind of crippled with the SmartThings IDE not showing errors, but the only way that I can get the SmartApp to break is to change the virtual device Device handler to something other than the Simulated switches I have listed here. The error message you first posted is stating that that is what is going on as well. I’ve installed the app a few times since you posted and my current installed instances of it are still working. It really sounds like you know what you are doing though, so I don’t know what to say.

OK well thanks anyway for looking into it for me. I’m still hitting a wall on this end, but I think I’m going to move on to other things at this point. The debugging ability is just too sparse to waste much more time on.

I did get the physical switches working with the map function finally, by specifically naming the passed variables in the smart app, i.e.

sendEvent(Device:settings["virtual${i}"], Map:[name:"switch", value:"$evt.value", type:"physical"])

instead of…

sendEvent(settings["virtual${i}"], [name:"switch", value:"$evt.value", type:"physical"])

The same thing did not work for the power/energy - I’m not getting any errors, but I’m also not getting those values set. I also added some logs to the def parse(Map description) in the simulated energy switch, and it’s just not getting called. Anyways - thanks for your help!

First, I have to say “thank you”! I appreciate all the work you must have put into this. I’d also like to add a suggestion. A simple, step by step process to making this work for those that haven’t done it before. I’ve spent hours just reading post after post, trying to get to the answer. Then when I found an apparent answer, I could not decipher how to get it done. I’m pretty computer literate, including a bit of coding, but I am unfamiliar with this process.
A good step by step might be something like this:
1 - Connect the switch and get it included in the network.
2 - Follow this link to the device handler code, in the upper right, click “raw” to remove extraneous characters.
3 - Select all and copy the code
4 - log into your Samsung account and select the "My Device Handlers"
5 - Click "add new handler"
6 - Click "from code"
7 - Paste the code you copied in step 3
8 - Click "create"
9 - Click “publish” and "for me"
10 - Follow this link to the smart app code, in the upper right, click “raw” to remove extraneous characters.
11 - Select all and copy the code
12 - Go back to your Samsung account and select "My Smart Apps"
13 - and so on and so on

I’ll even write it up and post it if I can ever get everything working. I think it may help many people to get the job done quickly.

Thanks again though, it must have taken some time to get it all figured out.

Just an FYI, there is a great resource on the forums for those new to the SmartThings community:

Also, as mentioned at the very top of this thread, there is an updated version of this app that makes things quite a bit simpler:

1 Like

Thanks for your reply. It actually helped. My issue was probably related to having read for so long on the topic and trying a couple different versions of things (which had me create the simulated switch) before arriving at your latest release (which I had installed) where I missed your “simulated switch” handler. I saw the energy switch and the dimmer. Anyway, it appears to be working now.

Thanks again!

1 Like

Sometimes, when I try to turn on one of the two lights attached to this relay, the relay chatters, the light flickers then stays off. When I try the next time it works. If I use the switch that controls both, they go on and off together flawlessly. If I have the one light on and try to turn it off occasionally it will also chatter the relay, flicker the light then stay on. This lasts about three seconds in either scenario. Would this be a relay problem or an issue in the app or device handler? I can live with it but it is a bit annoying.

I’m having the same issue with relay chatter on the second circuit. A few details:

1 - Some “physical” switches have shown up in the event log during this issue, and I don’t have the aux wires hooked up for a switch so I assumed maybe some noise got on those aux lines and make the relay toggle (I had the aux lines floating). Because they are switched to “line” (hot) with the switch (when you have one hooked up) I tied both aux lines to hot, assuming this would fix my problem. It did not, still have the issue. One “physical” switch did show up still…but those aux lines are definitely tied to line (see log below)

2 - It seems to work the first time after changing things (power on/off etc…), so you think you fixed it…but did not!

3 - Did you get yours working? Please note I just received this enerwave switch from Amazon a few days ago…

Log from second virtual switch (relay chattered way more than listed):
2017-01-07 9:56:00.177 AM EST
16 minutes ago
DEVICE switch off
2017-01-07 9:55:54.490 AM EST
16 minutes ago
DEVICE switch on
2017-01-07 9:55:05.912 AM EST
17 minutes ago
DEVICE switch off
2017-01-07 9:54:57.926 AM EST
17 minutes ago
DEVICE physical switch on
2017-01-07 9:54:56.383 AM EST
17 minutes ago
DEVICE switch off
2017-01-07 9:54:51.533 AM EST
17 minutes ago
DEVICE switch on
2017-01-07 9:54:45.569 AM EST
17 minutes ago
DEVICE switch off
2017-01-07 9:54:38.130 AM EST
17 minutes ago
DEVICE switch on
2017-01-07 9:54:35.297 AM EST
17 minutes ago
DEVICE switch off
2017-01-07 9:54:27.085 AM EST
17 minutes ago
DEVICE switch on
2017-01-07 9:52:35.911 AM EST
19 minutes ago
DEVICE switch off
2017-01-07 9:52:27.803 AM EST
19 minutes ago
DEVICE switch on

No matter which relay I put the fan on, first or second, the Enerwave switch had problems turning it on and relay would chatter. Depending on how I put the relay into the box it would get worse and better - so I assume there is a bad connection inside the device. Returning the relay. Fan is rated at 0.4A, relay at 4.0A. I double checked all connections.

My issue was strictly poor connection. Once I completely removed the pull
chain switch from the equation and rewired, chatter stopped and light works
better. However the app doesn’t update status very quickly. I have the same
issue with a couple rsm1 relays that I installed.

1 Like

If they are rsm1 plus devices, try this handler for instant status updates.

1 Like

Just added that device handler and loaded it up. Thank you. I’ll report back after ive tried it out for a while. I plan on buying a few more of the RSM1 plus relays. They’re way cheaper than buying the 3 way switch kits. Just tough to fit in the boxes

1 Like

I have three Zooz power strips and I used your app to set them up and it works great. However, I have only one instance of this app and discovered I can only see the first power strip’s settings in the Simulator. Just wanted to confirm I need to make copies of this app for my other two power strips… Thanks!

Yep, you will have to install an instance of the app for each Power Strip. It should automatically name the app based on the device name that is selected so you should be able to easily tell them apart. Oh, and make sure you are using the new version of the app that is linked at the very top. This thread is actually the old one.

Thanks! I checked out the new version and it does make setting up the power strip easier. But I found the original version fits my needs better. I ended up creating three copies of the original app in ‘My SmartApps’ and adding my power strip name to the name of the app to differentiate. Then I used the Simulator and assign my physical and virtual switches. With this original version, I can go back to the Simulator anytime to see the virtual switch mappings. I can also use the Simulator to swap the virtual switches (e.g., if I had Switch1 mapped to ‘Floor Lamp’ and Switch 2 mapped to ‘Desk Lamp’, I can use the Simulator to change the mapping so that ‘Desk Lamp’ is now Switch 1, and ‘Floor Lamp’ is Switch 2). It seems with the new version, to do the change the virtual switch mappings, you would have to change the Label of the virtual switch (device) but that won’t work if you have set up rules/automation specifically for that virtual switch.

1 Like

Great, I’m glad it is working for you!

I have a Enerwave Dual Relay. It has been working for 6months + and all of a sudden it stopped this week. I was able to exclude and remove the devices but when I went to add them back in ST doesn’t see the second “switch”. I remember having issues when I set it up to have ST see the second switch but I can’t remember what I did. I have added the new SmartApps and DH but still no luck. I have tried turning off/on the switch 3 times (how I got the main one to add) to no avail. They both run outside lights. Any suggestions on how to readd the second switch/relay?

It might be that it didn’t assign the correct device handler to the device when you included it. You can go into the IDE and manually assign the Enerwave Dual Relay handler to it.

Hello,

I have Fibaro Dimmer 2. I installed double switch on and I’d like to control other Fibaro RGBW on/off with the second switch (S2). I thought of two possible solutions. Set up group for S2 and RGBW but I don’t know how to do with Snartthings HUB. Second is to install virtual switches, It works with my gate opener, Fibaro Double Relay. I had to change the handler slightly to simulate a push button. It does not works with the Fibaro Dimmer. Can you help what should I change in the handler to make it compatible with your virtual switch app?

Istvan