Sreekumar,
Just about anything is possible. All of the code you would need to modify is in the Arduino sketch (.ino) file. Read through it carefully and you will see all of the logic regarding the pushbuttons inputs.
Sreekumar,
Just about anything is possible. All of the code you would need to modify is in the Arduino sketch (.ino) file. Read through it carefully and you will see all of the logic regarding the pushbuttons inputs.
Hi All,
New to home automation but I have experience with Arduino. I am trying to use this code to trigger a relay and open the garage door. I have an Arduino Uno and thing shield that I have successfully uploaded the modified code to only using 2 push buttons. When uploading the device handler to the cloud I use the following code.
I can get the switches to turn off but not back on (Arduino is not hooked up to anything yet, just testing code). Please tell me what I am doing wrong. Thanks in advance!
/**
http://www.apache.org/licenses/LICENSE-2.0
*/
metadata {
definition (name: âST_Anything_Relaysâ, namespace: âogiewonâ, author: âDaniel Ogorchockâ) {
capability "Actuator"
capability âSwitchâ
attribute "switch1", "string"
attribute "switch2", "string"
command "switch1on"
command "switch1off"
command "switch2on"
command "switch2off"
}
simulator {
}
// tile definitions
tiles {
standardTile("switch1", "device.switch1", width: 1, height: 1, canChangeIcon: true) {
state "off", label: '${name}', action: "switch1on", icon: "st.switches.switch.off", backgroundColor: "#ffffff"
state "on", label: '${name}', action: "switch1off", icon: "st.switches.switch.on", backgroundColor: "#79b821"
}
standardTile("switch2", "device.switch2", width: 1, height: 1, canChangeIcon: true) {
state "off", label: '${name}', action: "switch2on", icon: "st.switches.switch.off", backgroundColor: "#ffffff"
state "on", label: '${name}', action: "switch2off", icon: "st.switches.switch.on", backgroundColor: "#79b821"
}
main (["switch1"])
details (["switch1","switch2"])
}
}
//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, isStateChange: true)
log.debug result
return result
}
def switch1on() {
log.debug "Executing âswitch1onâ = âswitch1 onâ"
zigbee.smartShield(text: âswitch1 onâ).format()
}
def switch1off() {
log.debug "Executing âswitch1offâ = âswitch1 offâ"
zigbee.smartShield(text: âswitch1 offâ).format()
}
def switch2on() {
log.debug "Executing âswitch2onâ = âswitch2 onâ"
zigbee.smartShield(text: âswitch2 onâ).format()
}
def switch2off() {
log.debug "Executing âswitch2offâ = âswitch2 offâ"
zigbee.smartShield(text: âswitch2 offâ).format()
}
If your goal is garage door automation, please just use my ST_Anything_Doors example code from my GitHub repository. It already implements full garage door logic, including automagically firing the relay to either open or close the garage door for 1 second.
Here some more information on it
Very nice! Did not even notice this code. I tried to use the âconfigureâ tile and nothing happens, am I doing something wrong?
Also, I have a smartthings door sensor that is attached to the garage door, can I use this to give status on the garage door? If so how do I implement this?
Take a look at the Device Handler code to see exactly how the configure tile works. It is used to transfer configuration data from the ST Cloud to the Arduino. The data, in this case, is the polling interval for the temp/humidity sensor, IIRC. It basically allows you to override the hard-coded poling interval in the Arduino temporarily. To set the interval, hit the configure gear icon in the phone app when you have the Arduino Device selected.
As for using the ST Door Sensor, youâre somewhat on your own. My garage door control solution does expect you to use a standard magnetic contact sensor to sense the door position.
You could just use my TimedRelay example code, if all you want is something to simulate a momentary button press.
Dan
Thanks for the reply. I got that to work I am now working on integrating the smartsense sensor so that it will only trigger if the garage door is down. Thanks again!