Linear Z-wave Siren device type needed

Hi I have a Linear Z-Wave Siren (Battery Operated) and I really need someone to right me code for this please. The device shows battery level, siren, strobe and if the siren is tripped how long the siren will go off for.

Thanks, Brandon

Is the device being detected on the network? Is it pairing to ST Hub?

No, I am really worried. Is there a way you can create a device type?

You need to be able to pair first, if you cannot pair then I do not believe there is a way to write a device driver. I suspect that if you can get it to pair, that you can use the default Siren driver through the IDE to make it work.

First thing is getting it to pair.

It kind of paired as a Z-Wave Switch, sorry about the confusion I thought you meant for it to show up as a Z-Wave siren. Also when it did pair and I would turn the switch on and off nothing happened, but it did show up as a Z-Wave switch.

Try logging into the ide and changing it to a z-wave siren and see if that works

I changed it to a Z-Wave Siren and it worked. However I would like to have it so I could adjust the siren activation time. (When it is activated, how long it will go off for) Also it would be nice to have the siren+strobe control.

Thanks again, Brandon

Looks like it should be doable with a custom device type. Since the detfault version works, the other functions just need to be added to it

From the documentation

CONFIGURATION
The WA105DBZ-1 supports the Confi guration command. The WA105DBZ-1 can
be confi gured to operate slightly differently than how it works when you fi rst
install it. Using the Confi guration command you can confi gure the following:
Parameter 0: Siren / Strobe Mode
By default, the siren and strobe on the WA105DBZ-1 will activate when turned
on. To activate the Siren only, set parameter 0 to 1. For strobe only set to 2.
• Parameter No: 0
• Length: 1 Byte
• Valid Values = 0 (default) or 1 or 2. Default is 0.
Parameter 1: Auto Stop Time
By default the auto stop time is 30 seconds. Setting parameter 1 to 1 will
increase the time to 60 seconds. Changing it to 2 will increase the stop time to
120 seconds. Setting the stop time to 3 will turn off the auto stop and will require
a command from the Controller to turn off.
• Parameter No: 1
• Length: 1 Byte
• Valid Values = 0 or 1 or 2 or 3. Default is 0.
Default Setting
Each confi guration Parameter can be set to its default setting by setting the
default bit in the Confi guration Set command. See your controller’s instructions
on how to do this (and if it supports it).
All confi guration commands will be reset to their default state when the
WA105DBZ-1 is excluded from the Z-Wave network by using the controller to
reset the node

I’m kind of confused how will I change this?

Thanks, Brandon

It’ll have to be incorporated by someone into a device type. If I get some time, I’ll try to do so. I haven’t worked with a device that sends config commands, but it doesn’t look hard. I won’t have one to test with, but that shouldn’t matter

@brandonw1041 can you post the raw description from the device’s setting in the ide

should look something like this
Raw Description 0 0 0x0806 0 0 0 10 0x40 0x42 0x43 0x44 0x45 0x70 0x31 0x8F 0x86 0x72 0x85 0x2C 0x2B 0x73 0x81 0x7A

Also, do you get a battery reading with this device type? Looking at the z-wave specs on this device it may not support battery reporting

Yes I am getting a battery reading with the generic device type.

Here is the raw description from the ide:

0 0 0x1000 0 0 0 5 0x25 0x80 0x70 0x72 0x86

Thanks, Brandon

OK. Try this out and let me know if it works. It tests fine with a virtual device, but no way to know for sure if it’ll work with the real thing till you try it out

/**
 *  
 *
 *  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.
 *
 *  Linear Z-Wave Siren
 *
 *  Author: Kevin Tierney
 *  Date: 2015-07-30
 */

metadata {
	definition (name: "Linear Z-Wave Siren", namespace: "tierneykev", author: "Kevin Tierney") {
		capability "Actuator"
        capability "Alarm"
        capability "Battery"
        capability "Polling"
        capability "Refresh"
        capability "Sensor"
		capability "Switch"
        
        command "test"
        command "strobe"
        command "siren"
        command "both"

        //Supported Command Classes
        //0x20-Basic ,0x25-Binary Switch ,0x70-Configuration , 0x72-Manufacturer Specific ,0x86-Version
        fingerprint inClusters: "0x20,0x25,0x70,0x72,0x86,"
	}
   
	simulator {
		// reply messages
		reply "2001FF,2002": "command: 2003, payload: FF"
		reply "200100,2002": "command: 2003, payload: 00"
		reply "200121,2002": "command: 2003, payload: 21"
		reply "200142,2002": "command: 2003, payload: 42"
		reply "2001FF,delay 3000,200100,2002": "command: 2003, payload: 00"
	}

	tiles {
		standardTile("alarm", "device.alarm", width: 2, height: 2) {
			state "both", label:'alarm!', action:'alarm.siren', icon:"st.alarm.alarm.alarm", backgroundColor:"#e86d13"
            state "siren", label:'siren!', action:'alarm.strobe', icon:"st.alarm.alarm.alarm", backgroundColor:"#e86d13"
            state "strobe", label:'strobe!', action:'alarm.both', icon:"st.alarm.alarm.alarm", backgroundColor:"#e86d13"						
		}
 
        standardTile("test", "device.alarm", inactiveLabel: false, decoration: "flat") {
                state "off", label:'', action:"test", icon:"st.secondary.off"
                state "test", label:'', action:"alarm.off", icon:"st.secondary.test"
            }
        /*standardTile("off", "device.alarm", inactiveLabel: false, decoration: "flat") {
            state "default", label:'', action:"alarm.off", icon:"st.secondary.off"
        } */
         valueTile("battery", "device.battery", inactiveLabel: false, decoration: "flat") {
			state "battery", label:'${currentValue}% battery', unit:""
		}
        standardTile("refresh", "device.refresh", inactiveLabel: false, decoration: "flat") {
			state "default", label:'', action:"refresh.refresh", icon:"st.secondary.refresh"
		}

       
		main "alarm"
		//details(["alarm","off","test","battery","refresh"])
        details(["alarm","test","battery","refresh"])
	}

preferences {
    input "autoStopTime", "enum", title: "Disarm Time",required:true,displayDuringSetup:true, options: ["30","60","120","Infinite"],default:'30'
} 

	}

def updated() {
		def autoStopTimeParameter = 0
        if (autoStopTime == '30') {
        	autoStopTimeParameter = 0
        } else if( autoStopTime == '60'){
        	autoStopTimeParameter = 1
        } else if (autoStopTime == '120') {
        	autoStopTimeParameter = 2
        } else if (autoStopTime == 'Infinite') {
        	autoStopTimeParameter = 3
        }
        log.debug "AutoStopTime - ${autoStopTimeParameter}"
	    zwave.configurationV1.configurationSet(parameterNumber: 1, size: 1, configurationValue: [autoStopTimeParameter])
}

def strobe() {
	log.debug "Setting alarm to strobe."
    sendEvent(name: "alarm", value: "strobe")
    zwave.configurationV1.configurationSet(parameterNumber: 0, size: 1, configurationValue: [2])
}

def siren() {
	log.debug "Setting alarm to siren."
   sendEvent(name: "alarm", value: "siren")
   zwave.configurationV1.configurationSet(parameterNumber: 0, size: 1, configurationValue: [1])
}

def both() {
	log.debug "Setting alarm to both."
    sendEvent(name: "alarm", value: "both")
	zwave.configurationV1.configurationSet(parameterNumber: 0, size: 1, configurationValue: [0])

    
}
def off() {
	log.debug "Ending Test"
	[
		zwave.basicV1.basicSet(value: 0x00).format(),
		zwave.basicV1.basicGet().format()
	]
}
def test() {
	log.debug "testing siren"
[
		zwave.basicV1.basicSet(value: 0xFF).format(),
		"delay 3000",
		zwave.basicV1.basicSet(value: 0x00).format(),
		zwave.basicV1.basicGet()
	]
    
}

def parse(String description) {
	log.debug "parse($description)"
	def result = null
	def cmd = zwave.parse(description, [0x20: 1])
	if (cmd) {
		result = createEvents(cmd)
	}
	log.debug "Parse returned ${result?.descriptionText}"
	return result
}

def createEvents(physicalgraph.zwave.commands.basicv1.BasicReport cmd)
{
	def switchValue = cmd.value ? "on" : "off"
	def alarmValue
	if (cmd.value == 0) {
		alarmValue = "off"
	}
	else if (cmd.value <= 33) {
		alarmValue = "strobe"
	}
	else if (cmd.value <= 66) {
		alarmValue = "siren"
	}
	else {
		alarmValue = "both"
	}
	[
		createEvent([name: "switch", value: switchValue, type: "digital", displayed: false]),
		createEvent([name: "alarm", value: alarmValue, type: "digital"])
	]
}


def createEvents(physicalgraph.zwave.Command cmd) {
	log.warn "UNEXPECTED COMMAND: $cmd"
}


def createEvents(physicalgraph.zwave.commands.batteryv1.BatteryReport cmd) {
	def map = [ name: "battery", unit: "%" ]
	if (cmd.batteryLevel == 0xFF) {
		map.value = 1
		map.descriptionText = "$device.displayName has a low battery"
	} else {
		map.value = cmd.batteryLevel
	}
	state.lastbatt = new Date().time
	createEvent(map)
}

def poll() {
	if (secondsPast(state.lastbatt, 36*60*60)) {
		return zwave.batteryV1.batteryGet().format
	} else {
		return null
	}
}

private Boolean secondsPast(timestamp, seconds) {
	if (!(timestamp instanceof Number)) {
		if (timestamp instanceof Date) {
			timestamp = timestamp.time
		} else if ((timestamp instanceof String) && timestamp.isNumber()) {
			timestamp = timestamp.toLong()
		} else {
			return true
		}
	}
	return (new Date().time - timestamp) > (seconds * 1000)
}

def refresh() {
	log.debug "sending battery refresh command"
	zwave.batteryV1.batteryGet().format()
}

I see I missed the fun here. Just wanted to say thanks for helping the new user here. It is one of the best things with ST is our user community.

Slight problem. It will not let me control the siren all the button says is alarm. I try to turn it off but it just resorts back to alarm. When it says alarm it never went off

Oops. Should have included a separate disarm button

Try this one… Pressing it on the things screen will send the off command. If you go into the device details, the big button should toggle between modes (siren,strobe,both). The top right is the disarm (same as the thing screen) and the one below it should allow you to test the siren (both on and off)

/*
 *  
 *
 *  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.
 *
 *  Linear Z-Wave Siren
 *
 *  Author: Kevin Tierney
 *  Date: 2015-07-30
 */

metadata {
	definition (name: "Linear Z-Wave Siren", namespace: "tierneykev", author: "Kevin Tierney") {
		capability "Actuator"
        capability "Alarm"
        capability "Battery"
        capability "Polling"
        capability "Refresh"
        capability "Sensor"
		capability "Switch"
        
        command "test"
        command "strobe"
        command "siren"
        command "both"

        //Supported Command Classes
        //0x20-Basic ,0x25-Binary Switch ,0x70-Configuration , 0x72-Manufacturer Specific ,0x86-Version
        fingerprint inClusters: "0x20,0x25,0x70,0x72,0x86,"
	}
   
	simulator {
		// reply messages
		reply "2001FF,2002": "command: 2003, payload: FF"
		reply "200100,2002": "command: 2003, payload: 00"
		reply "200121,2002": "command: 2003, payload: 21"
		reply "200142,2002": "command: 2003, payload: 42"
		reply "2001FF,delay 3000,200100,2002": "command: 2003, payload: 00"
	}

	tiles {
		standardTile("alarm", "device.alarm", width: 2, height: 2) {
			state "both", label:'alarm!', action:'alarm.siren', icon:"st.alarm.alarm.alarm", backgroundColor:"#e86d13"
            state "siren", label:'siren!', action:'alarm.strobe', icon:"st.alarm.alarm.alarm", backgroundColor:"#e86d13"
            state "strobe", label:'strobe!', action:'alarm.both', icon:"st.alarm.alarm.alarm", backgroundColor:"#e86d13"						
		}
 
        standardTile("test", "device.alarm", inactiveLabel: false) {
                state "off", label:'', action:"test", icon:"st.secondary.test"
                state "test", label:'', action:"alarm.off", icon:"st.secondary.test",backgroundColor:"#00CC99"
            }
        standardTile("off", "device.alarm", inactiveLabel: false) {
            state "default", label:'Disarm', action:"alarm.off", icon:"st.alarm.alarm.alarm"
        } 
         valueTile("battery", "device.battery", inactiveLabel: false, decoration: "flat") {
			state "battery", label:'${currentValue}% battery', unit:""
		}
        standardTile("refresh", "device.refresh", inactiveLabel: false, decoration: "flat") {
			state "default", label:'', action:"refresh.refresh", icon:"st.secondary.refresh"
		}

       
		main "off"
		//details(["alarm","off","test","battery","refresh"])
        details(["alarm","off","test","battery","refresh"])
	}

preferences {
    input "autoStopTime", "enum", title: "Disarm Time",required:true,displayDuringSetup:true, options: ["30","60","120","Infinite"],default:'30'
} 

	}

def updated() {
		def autoStopTimeParameter = 0
        if (autoStopTime == '30') {
        	autoStopTimeParameter = 0
        } else if( autoStopTime == '60'){
        	autoStopTimeParameter = 1
        } else if (autoStopTime == '120') {
        	autoStopTimeParameter = 2
        } else if (autoStopTime == 'Infinite') {
        	autoStopTimeParameter = 3
        }
        log.debug "AutoStopTime - ${autoStopTimeParameter}"
	    zwave.configurationV1.configurationSet(parameterNumber: 1, size: 1, configurationValue: [autoStopTimeParameter])
}

def strobe() {
	log.debug "Setting alarm to strobe."
    sendEvent(name: "alarm", value: "strobe")
    zwave.configurationV1.configurationSet(parameterNumber: 0, size: 1, configurationValue: [2])
}

def siren() {
	log.debug "Setting alarm to siren."
   sendEvent(name: "alarm", value: "siren")
   zwave.configurationV1.configurationSet(parameterNumber: 0, size: 1, configurationValue: [1])
}

def both() {
	log.debug "Setting alarm to both."
    sendEvent(name: "alarm", value: "both")
	zwave.configurationV1.configurationSet(parameterNumber: 0, size: 1, configurationValue: [0])

    
}
def off() {
	log.debug "Turning Alarm Off"
	[
		zwave.basicV1.basicSet(value: 0x00).format(),
		zwave.basicV1.basicGet().format()
	]
}
def test() {
	log.debug "testing siren"
[
		zwave.basicV1.basicSet(value: 0xFF).format(),
		"delay 3000",
		zwave.basicV1.basicSet(value: 0x00).format(),
		zwave.basicV1.basicGet()
	]
    
}

def parse(String description) {
	log.debug "parse($description)"
	def result = null
	def cmd = zwave.parse(description, [0x20: 1])
	if (cmd) {
		result = createEvents(cmd)
	}
	log.debug "Parse returned ${result?.descriptionText}"
	return result
}

def createEvents(physicalgraph.zwave.commands.basicv1.BasicReport cmd)
{
	def switchValue = cmd.value ? "on" : "off"
	def alarmValue
	if (cmd.value == 0) {
		alarmValue = "off"
	}
	else if (cmd.value <= 33) {
		alarmValue = "strobe"
	}
	else if (cmd.value <= 66) {
		alarmValue = "siren"
	}
	else {
		alarmValue = "both"
	}
	[
		createEvent([name: "switch", value: switchValue, type: "digital", displayed: false]),
		createEvent([name: "alarm", value: alarmValue, type: "digital"])
	]
}


def createEvents(physicalgraph.zwave.Command cmd) {
	log.warn "UNEXPECTED COMMAND: $cmd"
}


def createEvents(physicalgraph.zwave.commands.batteryv1.BatteryReport cmd) {
	def map = [ name: "battery", unit: "%" ]
	if (cmd.batteryLevel == 0xFF) {
		map.value = 1
		map.descriptionText = "$device.displayName has a low battery"
	} else {
		map.value = cmd.batteryLevel
	}
	state.lastbatt = new Date().time
	createEvent(map)
}

def poll() {
	if (secondsPast(state.lastbatt, 36*60*60)) {
		return zwave.batteryV1.batteryGet().format
	} else {
		return null
	}
}

private Boolean secondsPast(timestamp, seconds) {
	if (!(timestamp instanceof Number)) {
		if (timestamp instanceof Date) {
			timestamp = timestamp.time
		} else if ((timestamp instanceof String) && timestamp.isNumber()) {
			timestamp = timestamp.toLong()
		} else {
			return true
		}
	}
	return (new Date().time - timestamp) > (seconds * 1000)
}

def refresh() {
	log.debug "sending battery refresh command"
	zwave.batteryV1.batteryGet().format()
}

Still is not working.


Thanks, Brandon

Does any of it work? Or does it not work at all? Can you open up the live log and try to use the various functions, including triggering it, and post the logs. Without the device, it’s hard to know why it’s not working, but maybe the logs will shed some light

Should I send you the event list. Kinda confused.

Yes,

Log into the ide. Click on live logging. Open up the ST app on your phone and try the various alarm functions. After you try at least one action in the ST app, you should be able to filter to your alarm on the live log. Try each of the functions and post the log results here. You can copy/paste the text, or take a screenshot and post it here