I am probably posting in the wrong forum, I couldn’t find the developer forum.
I created a device type for my smart things shield. I am using a regular button, but now I want to add another button doing the same exact thing. (It is sending a signal to an arduino pin, and I want to target another pin).
So I need help with how to create a custom action. I assume I need to declare something somewhere. (The documentation mentions that you can create custom capabilities, but I couldn’t find any documentation on that, which I assume if I could do that, I could define more actions. Barring that, is there any way to pass a value into a normal action?
For example, I am using the “push” action, but if I could pass in a value to that, I wouldn’t need a custom action. Maybe someone should overload the push action to accept a string. Does the smartthings language support overloads? If it is based on java it should.
I’m open to any other ideas on how to accomplish this or any critique of what I have done. Here is what I have at the moment:
/**
* Momentary Arduino
*
* Copyright 2014 Jason Loucks
*
* 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: "test3", namespace: "loucks1", author: "Jason Loucks") {
capability "Momentary"
}
simulator {
// TODO: define status and reply messages here
}
tiles {
standardTile("button", "device.button", width: 2, height: 2) {
state "default", label: '', action: "push", icon: "st.doors.garage.garage-closing", backgroundColor: "#d6f4f4"
}
standardTile("button2", "device.button", width: 1, height: 1) {
state "default", label: '', action: "push1", icon: "st.doors.garage.garage-closing", backgroundColor: "#d6f400"
}
main "button"
details(["button", "button2"])
}
}
// parse events into attributes
def parse(String description) {
log.debug "Parsing '${description}'"
}
// handle commands
def push() {
log.debug "Executing 'push'"
zigbee.smartShield(text: "push").format()
}
def push1() {
log.debug "Executing 'push1'"
zigbee.smartShield(text: "push1").format()
}