SwiidInter In-Line Z-Wave cord switch. Device Handler

I have a couple of these SwiidInter z-wave in-line cord switches.

http://www.swiid.com/en/produits.html#swiidinter

I have successfully integrated these into HE. They get discovered as a 'device' and I then changed the Device Type to the following.
Works OK.
Here is the DH code should you wish to connect one of these.
Thanks to @Robin for the original DH code.

metadata {
	definition (name: "swiidinter Cord Switch with Association", namespace: "Hubitat", author: "Robin Winbourne") {
		capability "Actuator"
		capability "Switch"
		capability "Polling"
		capability "Refresh"
		capability "Sensor"
        capability "Configuration"

command "configure"
		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"
			}
		}
		standardTile("refresh", "device.switch", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
			state "default", label:'', action:"refresh.refresh", icon:"st.secondary.refresh"
		}
standardTile("configure", "device.configure", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
state "configure", label:'', action:"configure", icon:"st.secondary.configure"
}
		main "switch"
		details(["switch","refresh","configure"])
	}
}

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(hubitat.zwave.commands.basicv1.BasicReport cmd) {
	[name: "switch", value: cmd.value ? "on" : "off", type: "physical"]
}

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

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

def zwaveEvent(hubitat.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(hubitat.zwave.commands.hailv1.Hail cmd) {
	[name: "hail", value: "hail", descriptionText: "Switch button was pressed", displayed: false]
}

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

def zwaveEvent(hubitat.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()
	])
}
1 Like

That looks familiar lol… thanks for porting it over :smile:

1 Like

Yes, I should have acknowledged you’re the original author.

1 Like

You did… it’s still in the definition :wink:

Couldn’t care either way though, I’m sure I copied most of it from something else myself haha

Maybe change the namespace to Hubitat instead of ST though.

I’m not seeing anything special with this driver, if someone can get me the fingerprint I’ll add it to the Generic Zwave switch, obviously the indicator and paddle options will be irrelevant…

Is this what you are talking about?

image

1 Like

Close. Exclude, re-pair, and select details on the first window. There’s a more detailed list that appears.

for zwave devices, this is enough detail...
It is however helpful to paste the actual text so I can copy it.

  • deviceType: 256
  • inClusters: 0x25,0x27,0x85,0x72,0x86
  • deviceId: 256
  • manufacturer: 358

Actually, this switch was a PIA and never works with the a standard switch handler (not at first anyway).

There is an important part missing above that was in my original handler:

def configure() {
                zwave.associationV2.associationSet(groupingIdentifier:2, nodeId:zwaveHubNodeId).format(), 
}

Ah, so just ZigBee unknown devices need the initial pairing details? Good to know.

1 Like

well that’s funky that it needs association group 2 set in order to report, this is the first actual single endpoint switch I’ve seen that needed that, how bizarre…
OK, well you’re on your own with that bad boy…

1 Like

It certainly is a mighty weird switch lol… but one of a kind in regards to design!!

But they are good for putting in-line for lamps etc. as they give manual and automation capability.

1 Like

HE newbie here, set up today & this is the first device I've added. Copied in the driver code (thanks) & it kind of works in that I've been able to switch the light on & off, but the status isn't being reported back correctly & seems really inconsistent , e.g. it will say it's off when it's physically on. Any ideas or is this just not a great zwave device?