I want to trigger an automation with a SINGLE virtual pushbutton, without selecting one of 5. Is there a way to force a SINGLE button, without requiring the user to select one thru five?
Maybe a virtual switch with auto off?
Did you set preference: “Number of physical buttons” to 1?
There is a Capability called Momentary. I was playing around with that for something once, so I have this virtual momentary button driver kicking around still.
/*
Virtual Momentary Button
2023 -> Chris B
*/
metadata {
definition (
name: "Virtual Momentary Button",
namespace: "hubitat",
author: "Chris B"
) {
capability "Actuator"
capability "Momentary"
command "push"
}
preferences {
input( name: "logEnable", type:"bool", title: "Enable debug logging",defaultValue: false)
input( name: "txtEnable", type:"bool", title: "Enable descriptionText logging", defaultValue: true)
}
}
def installed() {
log.warn "installed..."
device.updateSetting("txtEnable",[type:"bool",value:true])
initialize()
}
def updated() {
log.info "updated..."
log.warn "debug logging is: ${logEnable == true}"
log.warn "description logging is: ${txtEnable == true}"
if (logEnable) runIn(1800,logsOff)
initialize()
}
def initialize() {
}
def push() {
logDebug("Button Pushed")
sendEvent(name: "push", value: "pushed", descriptionText: getDescriptionText("button pushed"))
}
def logsOff(){
log.warn "debug logging disabled..."
device.updateSetting("logEnable",[value:"false",type:"bool"])
}
private logDebug(msg) {
if (settings?.logEnable) log.debug "${msg}"
}
private getDescriptionText(msg) {
def descriptionText = "${device.displayName} ${msg}"
if (settings?.txtEnable) log.info "${descriptionText}"
return descriptionText
}