perfect thanks, I've added that
I have made a mod to @jp0550's mod for this driver. This will be my interim driver till Hubitat/Samsung resolve the duplicate events that occur after these button devices have been unused for a period of time. Essentially it will ignore multiple button press events that occur with a specified timeframe. When I receive duplicates my logs show that they occur within 2 seconds of each other. I have found that 2500ms to be the sweet spot for me. Your mileage may vary and so I made this an adjustable option in the driver preferences.
Hopefully I won't need this driver for much longer.
And, yes, I know everyone does not experience this issue even with the same firmware. This driver is for those that do.
/*
* 12/30/18 Edited by Stephan Hackett
* - added option to ignore duplicate events received within adjustable timeframe (2500ms/2.5s worked for me). Tweak this preference to fit your scenario.
*/
metadata {
definition ( name : "Smartthings Button", namespace: "stephack", author: "Robert Morris, Mitch Pond, jp0550, Stephan Hackett" ) {
capability "Holdable Button"
capability "Battery"
capability "Refresh"
capability "Double Tapable Button"
capability "Pushable Button"
capability "Temperature Measurement"
capability "Sensor"
capability "Actuator"
capability "Configuration"
fingerprint inClusters: "0000,0001,0003,0020,0402,0500", outClusters: "0003,0019", manufacturer: "Samjin", model: "button"
}
}
preferences {
input("debounce", "number", title: "Ignore multiple events received within this timeframe (ms):")
}
def parse(description){
log.debug "Received message: $description"
def event = zigbee.getEvent(description)
if( description?.startsWith("catchall:") || description?.startsWith("read attr -") ){
def descMap = zigbee.parseDescriptionAsMap(description)
log.debug "Desc map: $descMap"
if(descMap.clusterInt == 0x0001 && descMap.attrInt == 0x0020){ //battery
event = getBatteryResult(zigbee.convertHexToInt(descMap.value))
}
}
else if( description?.startsWith("zone status") ){
event = parseIasButtonMessage(description)
}
log.debug "Parsed event $event"
def result = event ? createEvent(event) : []
if (description?.startsWith('enroll request')) {
List cmds = zigbee.enrollResponse()
log.debug "enroll response: ${cmds}"
result = cmds?.collect { new hubitat.device.HubAction(it) }
}
result
}
def parseIasButtonMessage(description){
def zs = zigbee.parseZoneStatus(description)
def eventType
if(zs.isAlarm1Set()) eventType = "pushed"
if(zs.isAlarm2Set()) eventType = "doubleTapped"
if(zs.isAlarm1Set() && zs.isAlarm2Set()) eventType = "held"
if(eventType){
def rejectTime = 0
if(debounce) rejectTime = debounce
def recentEvents = device.eventsSince(new Date(now() - rejectTime)).findAll{it.name == eventType}
log.info "Duplicate event rejected"
if(recentEvents.size == 0){
return [ name: eventType, value: 1, isStateChange: true, descriptionText: "Button 1 was $eventType" ]
}
}
}
def getBatteryResult(rawValue){
log.debug "Parse battery: $rawValue"
def volts = rawValue / 10.0
if(volts > 3.0 || volts == 0 || rawValue == 0xFF){
return [:]
}
else {
def result = [ name : 'battery' ]
def minVolts = 2.1
def maxVolts = 3.0
def pct = (volts - minVolts) / (maxVolts - minVolts)
result.value = Math.min(100, (int)(pct * 100))
def linkText = getLinkText(device)
result.descriptionText = "$linkText battery was ${result.value}%"
return result
}
}
def refresh(){
zigbee.readAttribute(zigbee.POWER_CONFIGURATION_CLUSTER, 0x20) + zigbee.readAttribute(zigbee.TEMPERATURE_MEASUREMENT_CLUSTER, 0x0) + zigbee.enrollResponse()
}
def configure(){
log.debug "Configure"
sendEvent(name: 'numberOfButtons', value: 1)
zigbee.onOffConfig() +
zigbee.levelConfig() +
zigbee.configureReporting(zigbee.POWER_CONFIGURATION_CLUSTER, 0x20, DataType.UINT8, 30, 21600, 0x01) +
zigbee.temperatureConfig(30, 3600) +
zigbee.enrollResponse() +
zigbee.readAttribute(zigbee.POWER_CONFIGURATION_CLUSTER, 0x20) +
zigbee.readAttribute(zigbee.TEMPERATURE_MEASUREMENT_CLUSTER, 0x0) + []
}
@mike.maxwell any update on the native driver for this button? another year is almost about to go by …
The native driver was actually released a while back. My workaround above is to correct an issue with the button itself sending multiple events when awoken from sleep.
i just added one of the buttons today and it got identified as a moisture sensor … havent seen that happen when there are native drivers. on 2.0.1.117.
Same thing happened to me. Apparently new firmware changes some things on the Samjin (most/all 2018 Samsung/ST) devices so the fingerprint-matching doesn't work. You might be able to help them. See: Samsung Buttons
now i know why i couldnt find the driver for a smartthings button
.
thank you.
Samsung's newer firmware has a different fingerprint than the older firmware, so its fingerprint catchup again...
In any event, 2.0.4 has the new fp for the button...
Hopefully you can find it and it just didn't automatically select it--assuming you've upgraded your firmware since September or so, it's there as "Samsung ZigBee Button."
thanks … changed it manually.
the native driver does not seem to set the numberOfButtons attribute … would be great if you can add that also please.
thank you.
Did you press "Configure" after you switched drivers? (The common ZigBee, if not Hubitat, theme. ) Mine set the attribute and I didn't do anything special, so I assume that was it.
it sets that on install, which of course doesn't run when you manually replace a driver.
once you get a device wrapper in an app, you can send that event on the devices behalf...
Sorry if I missed this somewhere. I see a lot of talk about the new SmartThings button, but has support for the acceleration feature of the 2018 SmartThings Multipurpose sensor been added? If so, which driver is it in?
Wondering this myself as well.
Also, can we get a confirmation that the new motion sensor is staying connected and responding properly? Are they fast? Slow? Meh?
I have several of these, no problem with staying connected, quick response time (maybe not as quick as the beloved iris, but much faster than z-wave). I really like the mount, gives lots of flexibility (although it only attaches to wall via adhesive, no screw option).
Battery lifes seems good after several months in high-traffic areas, and as a bonus the batteries are readily available, unlike previous generation model.
Thanks Mark. Have you done any tests with their response when ceiling mounting them? Seems like the wide detection field would work well for that.
I have two ceiling mounted, they work very well this way, the ability to adjust them minutely in any direction is a huge plus for finding the "sweet spot".
Again, not quite as sensitive as the Iris sensors but easier to mount and quicker motion reset times which I consider a plus.
I'm planning to get several more soon.
quote="halfrican.ak, post:80, topic:3264"]
quicker motion reset times
[/quote]
Oh, nice. How fast do they reset?
15 seconds in my testing, versus 45 seconds for the iris sensors.
Is there any way to adjust the sensitivity of these motion sensors? I find them very fast and, if anything, a bit too sensitive, id really like to be able to fine tune them to prevent cats from triggering the ML all the time