Hi,
I’ve got a ThingShield hooked up to a 2 channel relay for my two garage door buttons (one for each door). I’ve made a simple device type, code follows:
metadata {
// simulator metadata
simulator {
}
// UI tile definitions
tiles {
standardTile("switch", "device.switch") {
state "off", label: 'Button 1', action: "switch.push1", backgroundColor: "#ffffff", icon:"st.doors.garage.garage-open", nextState: "on"
state "on", label: 'Button 1', action: "switch.push1", backgroundColor: "#53a7c0", icon:"st.doors.garage.garage-open", nextState: "off"
}
standardTile("switch2", "device.switch") {
state "off", label: 'Button 2', action: "switch.push2", backgroundColor: "#ffffff", icon:"st.doors.garage.garage-open", nextState: "on"
state "on", label: 'Button 2', action: "switch.push2", backgroundColor: "#53a7c0", icon:"st.doors.garage.garage-open", nextState: "off"
}
main "switch"
details (["switch","switch2"])
}
}
def parse(String description) {
def value = zigbee.parse(description)?.text
def name = value in ["on","off"] ? "switch" : null
def result = createEvent(name: name, value: value)
log.debug "Parse returned ${result?.descriptionText}"
return result
}
def push1(){
zigbee.smartShield(text: "toggle1").format()
sendEvent(name: "Button 1", value:" has been triggered")
}
def push2(){
zigbee.smartShield(text: "toggle2").format()
sendEvent(name: "Button 1", value:" has been triggered")
}
This works perfectly when I debug with the IDE pointing to my actual thingShield. Hitting the buttons toggles the relay on the arduino and things look good. So I went to “My Devices” and changed the type of the device to my newly created type. It shows up on my phone just fine, but when I try to execute any of the actions, nothing happens. No events seem to get triggered. Am I missing something? Any help would be greatly appreciated!
Mike