How to program a handler for a double switch (MCO Home)

@Cedric

that device has got to have the flimsiest manual i have ever seen for a zwave device, anyway i think i have got it. no promises though as i don’t have the device to test against.

once you have added the device to your switch you need to click the configure to correctly associate with groups 1,2 & 3 or it wont work (at least from the minimal info from the manual). you will need to use my button binder smartapp still, but i think this should work

1 Like

I will test this tonight when I go home. But to confirm, I need to do the following:

  • update the device handler (done)
  • click on switch 1 “configure” (done, nothing special happens)

Then how to associate to groups 1,2, 3? In th Smartapp I can associate to buttons 1,2,3,4.
=> Button 1 (the real device) to 1
=> Button 2 (the simulated device) to 2?

Well, it doesnt work…

On the physical switch

2016-02-02 8:07:54.750 PM CET
moments ago APP_COMMAND on
2016-02-02 8:07:53.904 PM CET
moments ago APP_COMMAND off

On the simulated switch
2016-02-02 8:07:54.702 PM CET
moments ago DEVICE switch on Living Room Switch 2 switch is on
2016-02-02 8:07:53.860 PM CET
moments ago DEVICE switch off Living Room Switch 2 switch is off

Does button 1 not work? The manual point out that the command to switch on off via cmd encap is the basic report. You completely lost me when you said you can associate button 1,2,3,4 in the smartapp. Are sure you are using the correct smartapp? There is no option fir button 1,3 or 4 in the smartapp

No, it doesn’t work. What is surprising is that before the latest upgrade of ST Hub it used to work with the default W-wave switch multichannel handler (but only the top button)

Should I use this one?

It doesnt work either… Sorry

@Cedric, i dont think i can help you then sorry. i am wondering though if the device just needs reset back to factory defaults and rejoined to the network again

Has anyone managed to get MCO TOUCH PANELs working yet — 1gang / 2gang / 3gang / 4gang :slight_smile:

Eagerrrr to purchase these or similiar switches if anyone has any recommendations?!?

I had the 1 button MCO Home working… THats all

I have the 2gang working but the status isn’t working - I have to “refresh” it every minute.
The connection may drops and I have to reset and re-pair again (z-wave repair didn’t work). It happened to 2 of my switches.

I have cobbled together some code for the 2-gang MCO MH-S312-EU which works perfectly both on updating the status on manual use of the switch and via the smartthings interface…

Would you have the code available?

Just uploaded the code to github: -

No replies for a while…is this 100% working now?

Hi morfsta,

I have managed to get your code working. But I wanted to know if there is any way to map the two buttons on my switch to virtual switches?

Here you go:

/**
 *  Dual Relay Adapter (i.e. Enerwave ZWN-RSM2 Adapter, Monoprice Dual Relay, Philio PAN04) Modified for MCO Dual Button Switch
 *
 *  Copyright 2014 Joel Tamkin updated Morfsta 2016
 *
 *	2015-10-29: erocm123 - I removed the scheduled refreshes for my Philio PAN04 as it supports instant
 *	status updates with my custom device type
 *
 *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 *  in compliance with the License. You may obtain a copy of the License at:
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
 *  on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
 *  for the specific language governing permissions and limitations under the License.
 *
 */
definition(
    name: "MCO-S312-EU Dual Switch",
    namespace: "morfsta",
    author: "Morfsta",
    description: "Associates Dual Relay MCO Switch Modules with one or two standard SmartThings 'switch' devices for compatibility with standard control and automation techniques",
    category: "My Apps",
    iconUrl: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png",
    iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png")


preferences {
  section("MCO Switch:") {
    input "rsm", "capability.zwMultichannel", title: "Which MCO Switch?", multiple: false, required: true
    input "switch1", "capability.switch", title: "First Switch?", multiple: false, required: true
    input "switch2", "capability.switch", title: "Second Switch?", multiple: false, required: false
  }
}

def installed() {
  log.debug "Installed!"
  //subscribe(rsm, "switch", rsmHandler)
  subscribe(rsm, "switch1", rsmHandler)
  subscribe(rsm, "switch2", rsmHandler)
  subscribe(switch1, "switch", switchHandler)
  subscribe(switch2, "switch", switchHandler)

  initialize()
}

def updated() {
  log.debug "Updated!"
  unsubscribe()
  subscribe(rsm, "switch", rsmHandler)
  subscribe(rsm, "switch1", rsmHandler)
  subscribe(rsm, "switch2", rsmHandler)
  subscribe(switch1, "switch", switchHandler)
  subscribe(switch2, "switch", switchHandler)
  
  initialize()
}

def switchHandler(evt) {
  //log.debug "switchHandler: ${evt.value}, ${evt.deviceId}, ${evt.source}, ${switch2.id}"
  switch (evt.deviceId) {
  	case switch1.id:
		switch (evt.value) {
        	case 'on':
        		log.debug "switch 1 on"
                rsm.on1()
                break
        	case 'off':
        		log.debug "switch 1 off"
                rsm.off1()
                break
            }
        break
    case switch2.id:
    	switch (evt.value) {
        	case 'on':
        		log.debug "switch 2 on"
                rsm.on2()
                break
        	case 'off':
        		log.debug "switch 2 off"
                rsm.off2()
                break
            }
        break

    default:
    	pass
  }
}

def rsmHandler(evt) {
	log.debug "$evt.name $evt.value"
    if (evt.name == "switch1") {
    	switch (evt.value) {
        	case 'on':
            	switch1.on()
                break
            case 'off':
            	switch1.off()
                break
        }
    }
    else if (evt.name == "switch2") {
    	switch (evt.value) {
        	case 'on':
            	switch2.on()
                break
            case 'off':
            	switch2.off()
                break
        }
    }
      	
}

def rsmRefresh() {
	rsm.refresh()
}
    
def initialize() {
    unschedule()
    //def exp = "* * * * * ?"
    //log.debug "Scheduling RSM refreshes"
	//schedule(exp, rsmRefresh)
    // TODO: subscribe to attributes, devices, locations, etc.
}

Hi @morfsta,

I’ve got your Device handler and Dual Relay Adapter working for the most part.

But the issue I’m having is that when I turn a switch on or off on my physical MCO Touch panel, the device status is not getting updated on the smartthings device, until I manually click refresh.

However, when I use the app to turn on or off a switch, my physical MCO panel responds immediately.

Any help would be appreciated!

Give this a try:

Thanks it’s working, but the 1 minute refresh interval is still too long. Is there any way I can make it shorter than one minute?

What is the model number? It shouldn’t require the refresh because it supports instant status reporting. Try “configure”.

Ok got it working thanks!