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

Hi everyone, I was wondering if there was someone who could give me some advice on how to program a Z-Wave Double Switch.
=> It supports the Switch Binary command class
=> The default Z-Wave Switch Binary is able to switch on one button but thats all.

From what I understand, it implements 2 instances.

Any advice?

1 Like

What’s the exact brand and model? There are many different Zwave command classes that a manufacturer can choose to implement, and the exact method for controlling it from SmartThings will depend on which command classes are available.

MCO Home.
http://www.mcohome.com/index.php?m=Product&a=show&id=29

In Openhab, it seems to be the standard handler.

Does Smartthings see it as one or two devices?

It sees it as one device. In ST it appears as Z-Wave Device Multichannel

Data
endpointId: 0
endpoints: 2

Raw Description
0 0 0x1001 0 0 0 a 0x25 0x27 0x85 0x60 0x8E 0x72 0x86 0xEF 0x20 0x60

Current States
epInfo: [null,null]

That’s a multiple endpoint device. SmartThings is not great with those, but you may be able to create custom code to handle it. It does have multichannel association, which is good. (If it was using scene commands we’d have a different problem.)

Also, I’m assuming you’re in Europe, is that correct?

@AdamV or @Fuzzyligic might have some ideas.

Yes Im from Europe, using a ST Hub bought in UK.

1 Like

Are you trying to use it as a light/something on/off switch or as a button controller for ST or both?

I am controlling 2 lights with this switch.

@Cedric,

my device type for the Fibaro Dual Relay and corresponding button binder smartapp should work for you based on the zwave classes you posted. please try it, the biutton binder is needed to bind a virtual switch to trigger the second relay.

just copy and create the device type, & Smartapp and then add a new device in the IDE of type Simulated Switch, and then install the smartapp from you Apps and bind the virtual switch to your device

Have a look wround on here a user has done the devixe type code for a MCO HOME 2 gang switch :slight_smile: they even talk of maybe doing the 3/4 gang codes if they get time to do so

As for an official integration ST made it very clear that multichannel association isnt on the close to do list or a priority and id agree for them it isnt but thencommunity created device type is apprently ideal anyways

1 Like

Indeed, thank you. I found this.
https://github.com/petermajor/SmartThings/blob/master/devices/MCO-Touch-Panel-Switch.groovy

I’m going to try this.

Thanks a lot!!!

2 Likes

Just to update everyone, this does not work


@Cedric do take a look at my handler and binder smart app this will work for you I think

Im on it
 Just wondering how to
"configure the smart app to bind the second switch to the simulated switch"

Just add a new device from the devices page in the IDE. Select the device handler as simulated switch.

Then use my device handler for the hardware switch.

Then just install the smart app and select the hardware switch in the first preference option, then select the simulated switch in the second preference option and click done.

This will bind the second switch of the relay to the virtual switch
from that point on just treat them as separate devices

OK, thanks I did that
 But nothing happens when I used the real or the simulated switch.

On the physical switch
2016-02-01 11:08:05.598 PM CET
moments ago APP_COMMAND off2
2016-02-01 11:08:04.788 PM CET
moments ago APP_COMMAND on2
2016-02-01 11:08:02.564 PM CET
moments ago APP_COMMAND off2
2016-02-01 11:08:00.867 PM CET
moments ago APP_COMMAND on2

On the simulated one
2016-02-01 11:08:05.420 PM CET
moments ago DEVICE switch off Living Room Switch 2 switch is off
2016-02-01 11:08:04.742 PM CET
moments ago DEVICE switch on Living Room Switch 2 switch is on
2016-02-01 11:08:02.583 PM CET
moments ago DEVICE switch off Living Room Switch 2 switch is off
2016-02-01 11:08:00.712 PM CET
moments ago DEVICE switch on Living Room Switch 2 switch is on

ok, if you can wait until tomorrow morning. Its late here in the UK, I can have a look at you device manual if i can find it online and try to figure out why.

You said nothing happens if you use the real switch. Do you mean when you press the physical switch 2? If that is the case that is an issue with your wiring or a defective switch as software is not needed for the physical switch to be used.

1 Like

I just meant when I pressed the switch in the ST application on my iphone:
=> click on the real switch icon
=> click on the simulated switch icon

For information, I also have MCO Home MH-S411 switches (single buttons) and the following handler works fine

metadata {
definition (name: “MCO Home Switch - MH-S411”, namespace: “smartthings”, author: “Cedric Lefebvre”) {
capability "Actuator"
capability "Indicator"
capability "Switch"
capability "Polling"
capability "Refresh"
capability “Sensor”

	fingerprint inClusters: "0x25"
}

// simulator metadata
simulator {
	status "on":  "command: 2003, payload: FF"
	status "off": "command: 2003, payload: 00"

	// reply messages
	reply "2001FF,delay 100,2502": "command: 2503, payload: FF"
	reply "200100,delay 100,2502": "command: 2503, payload: 00"
}

// tile definitions
tiles(scale: 2) {
	multiAttributeTile(name:"switch", type: "lighting", width: 6, height: 4, canChangeIcon: true){
		tileAttribute ("device.switch", key: "PRIMARY_CONTROL") {
			attributeState "on", label: '${name}', action: "switch.off", icon: "st.switches.switch.on", backgroundColor: "#79b821"
			attributeState "off", label: '${name}', action: "switch.on", icon: "st.switches.switch.off", backgroundColor: "#ffffff"
		}
	}

	main "switch"
	details(["switch"])
}

}

def parse(String description) {
def result = null
def cmd = zwave.parse(description, [0x20: 1, 0x70: 1])
if (cmd) {
result = createEvent(zwaveEvent(cmd))
}
if (result?.name == ‘hail’ && hubFirmwareLessThan(“000.011.00602”)) {
result = [result, response(zwave.basicV1.basicGet())]
log.debug “Was hailed: requesting state update”
} else {
log.debug “Parse returned ${result?.descriptionText}”
}
return result
}

def zwaveEvent(physicalgraph.zwave.commands.basicv1.BasicReport cmd) {
[name: “switch”, value: cmd.value ? “on” : “off”, type: “physical”]
}

def zwaveEvent(physicalgraph.zwave.commands.basicv1.BasicSet cmd) {
[name: “switch”, value: cmd.value ? “on” : “off”, type: “physical”]
}

def zwaveEvent(physicalgraph.zwave.commands.switchbinaryv1.SwitchBinaryReport cmd) {
[name: “switch”, value: cmd.value ? “on” : “off”, type: “digital”]
}

def zwaveEvent(physicalgraph.zwave.commands.configurationv1.ConfigurationReport cmd) {
def value = "when off"
if (cmd.configurationValue[0] == 1) {value = “when on”}
if (cmd.configurationValue[0] == 2) {value = “never”}
[name: “indicatorStatus”, value: value, display: false]
}

def zwaveEvent(physicalgraph.zwave.commands.hailv1.Hail cmd) {
[name: “hail”, value: “hail”, descriptionText: “Switch button was pressed”, displayed: false]
}

def zwaveEvent(physicalgraph.zwave.commands.manufacturerspecificv2.ManufacturerSpecificReport cmd) {
if (state.manufacturer != cmd.manufacturerName) {
updateDataValue(“manufacturer”, cmd.manufacturerName)
}
}

def zwaveEvent(physicalgraph.zwave.Command cmd) {
// Handles all Z-Wave commands we aren’t interested in
[:]
}

def on() {
delayBetween([
zwave.basicV1.basicSet(value: 0xFF).format(),
zwave.switchBinaryV1.switchBinaryGet().format()
])
}

def off() {
delayBetween([
zwave.basicV1.basicSet(value: 0x00).format(),
zwave.switchBinaryV1.switchBinaryGet().format()
])
}

def poll() {
delayBetween([
zwave.switchBinaryV1.switchBinaryGet().format(),
zwave.manufacturerSpecificV1.manufacturerSpecificGet().format()
])
}

def refresh() {
delayBetween([
zwave.switchBinaryV1.switchBinaryGet().format(),
zwave.manufacturerSpecificV1.manufacturerSpecificGet().format()
])
}

def indicatorWhenOn() {
sendEvent(name: “indicatorStatus”, value: “when on”, display: false)
zwave.configurationV1.configurationSet(configurationValue: [1], parameterNumber: 3, size: 1).format()
}

def indicatorWhenOff() {
sendEvent(name: “indicatorStatus”, value: “when off”, display: false)
zwave.configurationV1.configurationSet(configurationValue: [0], parameterNumber: 3, size: 1).format()
}

def indicatorNever() {
sendEvent(name: “indicatorStatus”, value: “never”, display: false)
zwave.configurationV1.configurationSet(configurationValue: [2], parameterNumber: 3, size: 1).format()
}

def invertSwitch(invert=true) {
if (invert) {
zwave.configurationV1.configurationSet(configurationValue: [1], parameterNumber: 4, size: 1).format()
}
else {
zwave.configurationV1.configurationSet(configurationValue: [0], parameterNumber: 4, size: 1).format()
}
}

Yeah no worries, I just wanted to check :grinning: I’ll have a peruse of the manual and see if I can figure out why