ThingShield - ST Anything not working


(Michael Catalan) #1

Hi, I have used the ST_Anything_Alarm code to customize a device handler for my ThingShield. The code is below. When I run it in simulator mode with the hardware I get the proper responses for the individual sensors. However, on the APP all 9 sensors never change state. What am I doing wrong?
Thanks,
–Michael

/**

  • ST_Anything_Alarm_Panel Device Type - ST_Anything_Alarm_Panel.device.groovy
  • Copyright 2015 Daniel Ogorchock
  • 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.
  • Change History:
  • Date Who What

  • 2015-12-06 Dan Ogorchock Original Creation

*/

metadata {
definition (name: “ST_Anything_Alarm_Panel”, namespace: “ogiewon”, author: “Daniel Ogorchock”) {
capability “Contact Sensor”

    attribute "sensor1", "string"
	attribute "sensor2", "string"
	attribute "sensor3", "string"
	attribute "sensor4", "string"
	attribute "sensor5", "string"
	attribute "sensor6", "string"
	attribute "sensor7", "string"
	attribute "sensor8", "string"       
	attribute "sensor9", "string"       
}

simulator {

}

// Preferences

// tile definitions
tiles {
     standardTile("sensor1", "device.sensor1", width: 1, height: 1, canChangeIcon: true, canChangeBackground: true) {
		state("open", label:'CS1 ${name}', icon:"st.contact.contact.open", backgroundColor:"#ffa81e")
		state("closed", label:'CS1 ${name}', icon:"st.contact.contact.closed", backgroundColor:"#79b821")
	}
    standardTile("sensor2", "device.sensor2", width: 1, height: 1, canChangeIcon: true, canChangeBackground: true) {
		state("open", label:'CS2 ${name}', icon:"st.contact.contact.open", backgroundColor:"#ffa81e")
		state("closed", label:'CS2 ${name}', icon:"st.contact.contact.closed", backgroundColor:"#79b821")
	}
    standardTile("sensor3", "device.sensor3", width: 1, height: 1, canChangeIcon: true, canChangeBackground: true) {
		state("open", label:'CS3 ${name}', icon:"st.contact.contact.open", backgroundColor:"#ffa81e")
		state("closed", label:'CS3 ${name}', icon:"st.contact.contact.closed", backgroundColor:"#79b821")
	}
    standardTile("sensor4", "device.sensor4", width: 1, height: 1, canChangeIcon: true, canChangeBackground: true) {
		state("open", label:'CS4 ${name}', icon:"st.contact.contact.open", backgroundColor:"#ffa81e")
		state("closed", label:'CS4 ${name}', icon:"st.contact.contact.closed", backgroundColor:"#79b821")
	}
    standardTile("sensor5", "device.sensor5", width: 1, height: 1, canChangeIcon: true, canChangeBackground: true) {
		state("open", label:'CS5 ${name}', icon:"st.contact.contact.open", backgroundColor:"#ffa81e")
		state("closed", label:'CS5 ${name}', icon:"st.contact.contact.closed", backgroundColor:"#79b821")
	}
    standardTile("sensor6", "device.sensor6", width: 1, height: 1, canChangeIcon: true, canChangeBackground: true) {
		state("open", label:'CS6 ${name}', icon:"st.contact.contact.open", backgroundColor:"#ffa81e")
		state("closed", label:'CS6 ${name}', icon:"st.contact.contact.closed", backgroundColor:"#79b821")
	}
    standardTile("sensor7", "device.sensor7", width: 1, height: 1, canChangeIcon: true, canChangeBackground: true) {
		state("open", label:'CS7 ${name}', icon:"st.contact.contact.open", backgroundColor:"#ffa81e")
		state("closed", label:'CS7 ${name}', icon:"st.contact.contact.closed", backgroundColor:"#79b821")
	}
    standardTile("sensor8", "device.sensor8", width: 1, height: 1, canChangeIcon: true, canChangeBackground: true) {
		state("open", label:'CS8 ${name}', icon:"st.contact.contact.open", backgroundColor:"#ffa81e")
		state("closed", label:'CS8 ${name}', icon:"st.contact.contact.closed", backgroundColor:"#79b821")
	}
    standardTile("sensor9", "device.sensor9", width: 1, height: 1, canChangeIcon: true, canChangeBackground: true) {
		state("open", label:'CS9 ${name}', icon:"st.contact.contact.open", backgroundColor:"#ffa81e")
		state("closed", label:'CS9 ${name}', icon:"st.contact.contact.closed", backgroundColor:"#79b821")
	}
       
	main (["sensor1"])
    details(["sensor1","sensor2","sensor3","sensor4","sensor5","sensor6","sensor7","sensor8","sensor9"])
}

}

//Map parse(String description) {
def parse(String description) {
def msg = zigbee.parse(description)?.text
log.debug “Parse got ‘${msg}’”

def parts = msg.split(" ")
def name  = parts.length>0?parts[0].trim():null
def value = parts.length>1?parts[1].trim():null

name = value != "ping" ? name : null
    
def result = createEvent(name: name, value: value, state: state, isStateChange: true)

log.debug result

return result

}