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

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

@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