2 seconds pulse Device Handler for Z-Wave relay

(Victor Sanchez) #1

Does any one know if a 1 to 3 seconds pulse DH exist for a zwave relay?

I’m trying to use de virtual momentary and the push capability DH button my relay doesn’t work.

I try the virtual garage door opener with no luck.

My relay it’s An Enerwave ZWN-RSM1S I try the DH from Mike Maxwell but no luck.

I need this to activate an electic door lock in the out side of my house.

Hope someone can put me in the right way.



Tagging @Mike_Maxwell

(Mike Maxwell) #3

not sure quite what you’re looking for, but it’s possible to edit any DH to include an off, with a delay after an on, or whatever’s being required.
One way of doing this is to find the on method in the DTH, then append the zwave off command after the zwave on command, and using the delayBetween wrapper to separate the commands sent to the device.

//example on method
def on() {
        sendEvent( name: "switch", value: "on")
        return zwave.basicV1.basicSet(value: 0xFF).format()
//example off method
def off() {
        sendEvent( name: "switch", value: "off")
    	return zwave.basicV1.basicSet(value: 0x00).format()

//on method modified to auto off after 2 seconds
def on() {
        sendEvent( name: "switch", value: "on")
        sendEvent( name: "switch", value: "off")
        return delayBetween([zwave.basicV1.basicSet(value: 0xFF).format(),zwave.basicV1.basicSet(value: 0x00).format()],2000)

(Victor Sanchez) #4

So @Mike_Maxwell can this be like this?


  • 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.

metadata {

definition (name: "Z-Wave Relay Push", namespace: "smartthings", author: "SmartThings") {
	capability "Actuator"
	capability "Switch"
	capability "Polling"
	capability "Refresh"
	capability "Sensor"
	capability "Relay Switch"

	fingerprint deviceId: "0x1001", inClusters: "0x20,0x25,0x27,0x72,0x86,0x70,0x85"
	fingerprint deviceId: "0x1003", inClusters: "0x25,0x2B,0x2C,0x27,0x75,0x73,0x70,0x86,0x72"

// 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 {
	standardTile("switch", "device.switch", width: 2, height: 2, canChangeIcon: true) {
		state "on", label: '${name}', action: "switch.off", icon: "st.switches.switch.on", backgroundColor: "#79b821"
		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"

	main "switch"


def installed() {

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.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)

final relays = [
    [manufacturerId:0x0113, productTypeId: 0x5246, productId: 0x3133, productName: "Evolve LFM-20"],
    [manufacturerId:0x0113, productTypeId: 0x5246, productId: 0x3133, productName: "Linear FS20Z-1"],
	[manufacturerId:0x5254, productTypeId: 0x8000, productId: 0x0002, productName: "Remotec ZFM-80"]

def productName  = null
for (it in relays) {
	if (it.manufacturerId == cmd.manufacturerId && it.productTypeId == cmd.productTypeId && it.productId == cmd.productId) {
		productName = it.productName

if (productName) {
	log.debug "Relay found: $productName"
	updateDataValue("productName", productName)
else {
	log.debug "Not a relay, retyping to Z-Wave Switch"
	setDeviceType("Z-Wave Switch")
[name: "manufacturer", value: cmd.manufacturerName]


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

def on() {
sendEvent( name: “switch”, value: “on”)
sendEvent( name: “switch”, value: “off”)
return delayBetween([zwave.basicV1.basicSet(value: 0xFF).format(),zwave.basicV1.basicSet(value: 0x00).format()],2000)

def off() {
zwave.basicV1.basicSet(value: 0x00).format(),

def poll() {

def refresh() {

I’m really new to programing, sorry

(Mike Maxwell) #5

looks right, so if it works, then it is!

(Victor Sanchez) #6

I will give it a try to day. Fingers crossed and the relay doesn’t turn into a nuc or something lol…

Thank for the help!

(Victor Sanchez) #7

Well I give it a try to day. With no luck. The only thing that turns on/off its the icon :confused: but the relay just turn on when push and of in the second push.

Any advice /help

(Mike Maxwell) #8

without having the actual device in question to test against, not much more that I can do.

(Victor Sanchez) #9

Thanks for the big help, i’m not an it or programer guy, i’m in a dead end.

Maybe if i offer a 5 bucks in an amazon gift card or transfer in a paypal account will be an interesting incentive to help me figure this out? lol i know its not big money but its my way to tell the helper thanks… well first the DH should work as i need. this will be a gentlemen arrange. trust and honesty its require.

(Mike Maxwell) #10

I would do this at no charge if I have the actual device you’re trying to use this code with.
What physical device are you trying to use here?

(Victor Sanchez) #11

Thanks for the help.

I’m using an Enerwave ZWN-RSM1S

My intention here its to open a door lock (a buzzer thats how in the USA name it) one of this
(check image)

But my relay aren’t working with the virtual momentary DH, or any momentary DH, i don’t know why, but with the z-wave relay DH i can press once and a second later press again and stop the current.

But i can’t find any DH code that really works with my relay.

Maybe i’m course or some thing lol, i imagine if a DH code works in a wall outlet or switch should work in the really. But i’m not a programer.

Sorry for the long explanation/frustration relive LOL

Hope with this info you can help me Mike in you’re spare time.

Sorry if my english its not the best, i haven’t practicing lately.