Todki td-zw101 zwave switch driver

Anyone else have one of these switches i would like to get a driver that can configure it. The setup guide says it will strobe and the led light can be set.
This is from the manual
Parameter#12 default 2
0= off when power restored
1= on
2= status before falure

Led
Parameter 8 default 0
0= led on when off
1= led on when on
2= led off
3= led on

Led brightness
Paramter 11 default 85
1- 100

Strobe alarm
Parameter 10 default 0
0= strobe off
54 = alarm is on flashes at 400ms

Zw:Ls type:1001 mfr:0326 prod:0003 model:0012 ver:4.01 zwv:6.01 lib:03 cc:5e,55,98,9f, sec:86,25,70,85,8e,59 ,72,5a,73,6c,7a role:05 ff:8700 ui:8700

Have you tried Tweaker? You can switch to it as your DH, use it to change the parameters, then change back to a switch DH.

1 Like

Can someone tell whats wrong with this code. I’m trying to add setup for the light.

[pre]Preformatted text
/**

  • Copyright 2015 SmartThings
  • 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.

*zw:Ls type:1001 mfr:0326 prod:0003 model:0012 ver:4.01 zwv:6.01 lib:03 cc:5E,55,98,9F
*sec:86,25,70,85,8E,59,72,5A,73,6C,7A role:05 ff:8700 ui:8700
*
*TODKI Wireless Smart Power Switch Plug hub - TD-ZW101
*/

metadata {
definition(name: “TODKI TD-ZW101”, namespace: “smartthings”, author: “Tmaster”, ocfDeviceType: “oic.d.switch”, runLocally: false, minHubCoreVersion: ‘000.019.00012’, executeCommandsLocally: false) {
capability “Switch”
capability “Indicator”
capability “Refresh”
capability “Polling”
capability “Actuator”
capability “Sensor”
capability “Health Check”
capability “Configuration”

	fingerprint inClusters: "0x25,0x98"
	fingerprint deviceId: "0x10", inClusters: "0x98"
            fingerprint mfr: "0326", prod: "0003", model: "0012", deviceJoinName: "TODKI TD-ZW101 Switch"
}

simulator {
	status "on": "command: 9881, payload: 002503FF"
	status "off": "command: 9881, payload: 00250300"

	reply "9881002001FF,delay 200,9881002502": "command: 9881, payload: 002503FF"
	reply "988100200100,delay 200,9881002502": "command: 9881, payload: 00250300"
}

preferences
{
	section {
		input "ledIndicator", "enum", title: "LED Indicator", description: "Turn LED indicator... ", required: false, options:["on": "When On", "off": "When Off", "never": "Never"], defaultValue: "on"
}
	section {
		input title: "Device Debug", description: "This feature allows you log message handling to the device for troubleshooting purposes.", displayDuringSetup: false, type: "paragraph", element: "paragraph"
		input title: "Enable debug messages?", displayDuringSetup: false, type: "bool", name: "debugEnabled"
	}
}



// tile definitions


tiles {
	standardTile("switch", "device.switch", width: 4, height: 4, canChangeIcon: true) {
		state "on", label: '${name}', action: "switch.off", icon: "st.switches.switch.on", backgroundColor: "#00a0dc"
		state "off", label: '${name}', action: "switch.on", icon: "st.switches.switch.off", backgroundColor: "#ffffff"
	}
	standardTile("refresh", "device.switch", inactiveLabel: false, decoration: "flat") {
		state "default", label: '', action: "refresh.refresh", icon: "st.secondary.refresh"
	}

	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: "#00A0DC"
		attributeState "off", label: '${name}', action: "switch.on", icon: "st.switches.switch.off", backgroundColor: "#ffffff"
		}
       }
     main "switch"
	details(["switch", "refresh"])  
}

}

def installed() {
// Device-Watch simply pings if no device events received for checkInterval duration of 32min = 2 * 15min + 2min lag time
sendEvent(name: “checkInterval”, value: 2 * 15 * 60 + 2 * 60, displayed: false, data: [protocol: “zwave”, hubHardwareId: device.hub.hardwareID, offlinePingable: “1”])
}

def updated() {
response(refresh())
}

def parse(description) {
def result = null
if (description.startsWith(“Err 106”)) {
result = createEvent(descriptionText: description, isStateChange: true)
} else if (description != “updated”) {
def cmd = zwave.parse(description, [0x20: 1, 0x25: 1, 0x70: 1, 0x98: 1])
if (cmd) {
result = zwaveEvent(cmd)
log.debug("’$description’ parsed to $result")
} else {
log.debug(“Couldn’t zwave.parse ‘$description’”)
}
}
result
}

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

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

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

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

def zwaveEvent(physicalgraph.zwave.commands.securityv1.SecurityMessageEncapsulation cmd) {
def encapsulatedCommand = cmd.encapsulatedCommand([0x20: 1, 0x25: 1])
if (encapsulatedCommand) {
zwaveEvent(encapsulatedCommand)
}
}

def zwaveEvent(physicalgraph.zwave.Command cmd) {
log.debug “Unhandled: $cmd”
null
}

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, displayed: false]
}

def on() {
commands([
zwave.basicV1.basicSet(value: 0xFF),
zwave.basicV1.basicGet()
])
}

def off() {
commands([
zwave.basicV1.basicSet(value: 0x00),
zwave.basicV1.basicGet()
])
}

def ping() {
refresh()
}

def poll() {
refresh()
}

def refresh() {
command(zwave.basicV1.basicGet())
}

private command(physicalgraph.zwave.Command cmd) {
if ((zwaveInfo.zw == null && state.sec != 0) || zwaveInfo?.zw?.contains(“s”)) {
zwave.securityV1.securityMessageEncapsulation().encapsulate(cmd).format()
} else {
cmd.format()
}
}

private commands(commands, delay = 200) {
delayBetween(commands.collect { command(it) }, delay)
}
[/pre]

Probably want to post in the developers section.

https://community.smartthings.com/c/developers/63

1 Like