"New" SmartThings 2018 sensors

Official Hubitat Code!!

They don't publish anything else.

As to other examples.. they are all over this forum. There's a Category here called Code Share.. for just that purpose, to make community created code available to the community.
https://community.hubitat.com/c/basics/codeshare

1 Like

I'm really interested i the button. Gonna research the Xiaomi one though.

1 Like

Same here, I'm using Amazon IOT buttons but theres around a 8 second delay to connect to wifi, send the message, and hit my local network. Would love something with a quicker response time.

Looks like the Xiaomi slow ships from China.
I'll see how this plays out here and if it goes well maybe I'll pick up the ST model.

have you seen this?

I keep the amazon button in the car, so a battery and a small form factor are a must. The new button meets both of those and the price isn't bad, my only worry is range as my zigbee sensor in my mailbox is already at the edge of my network. I only have zigbee battery powered sensors so it would probably help to get some kind of repeater.

My SmartThings "2018" Button (IM6001-BTP01 on the device; GP-U999SJVLEAA on the website) arrived today! I was able to heavily pare down modify the SmartThingsPublic "ZigBee Button" DTH to work with this device on Hubitat. It supports push, doubleTap, and hold, just as it does on ST (does not appear to register separate release event, and by "on "ST I mean that the button model is completely different but this these are the effective capabilities of the device on both).

This will probably become a moot point after Mike gets his hand on one and supports it as part of the stock Hubitat driver store, but for now this is working for me:

/**
 *  SmartThings Button IM6001-BTP01
 *
 *  Loosely based on SmartThingsPublic ZigBee Button DTH copyright 2015 Mitch Pond
 *  Modified for SmartThings Button and adapted for Hubitat by Robert Morris
 *
 *  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.
 *
 */

import groovy.json.JsonOutput
import com.hubitat.zigbee.DataType

metadata {
    definition (name: "SmartThings Button", namespace: "RMoRobert", author: "Robert Morris, Mitch Pond") {
        capability "Actuator"
        capability "Battery"
        capability "PushableButton"
        capability "HoldableButton" 
        capability "DoubleTapableButton"        
        capability "Configuration"
        capability "Refresh"
        capability "Sensor"

        command "enrollResponse"
        
        fingerprint inClusters: "0000, 0001, 0003, 0020, 0402, 0500", outClusters: "0003, 0019", manufacturer: "Samjin", model: "button"
    }
}

def parse(String description) {
    log.debug "Running 'parse'; 'description' is: $description"
    def event = zigbee.getEvent(description)
    if (event) {
        sendEvent(event)
    }
    else {
        if ((description?.startsWith("catchall:")) || (description?.startsWith("read attr -"))) {
            def descMap = zigbee.parseDescriptionAsMap(description)
            if (descMap.clusterInt == 0x0001 && descMap.attrInt == 0x0020) {
                event = getBatteryResult(zigbee.convertHexToInt(descMap.value))
            }
            else if (descMap.clusterInt == 0x0006 || descMap.clusterInt == 0x0008) {
                // Not handled
            }
        }
        else if (description?.startsWith('zone status')) {
            event = parseIasButtonMessage(description)
        }
        log.debug "Parse returned $event"
        def result = event ? createEvent(event) : []
        if (description?.startsWith('enroll request')) {
            List cmds = zigbee.enrollResponse()
            result = cmds?.collect { new hubitat.device.HubAction(it) }
        }
        return result
    }
}

private Map parseIasButtonMessage(String description) {
    def zs = zigbee.parseZoneStatus(description)
    def eventType = "unknown"
    if (zs.isAlarm1Set()) { eventType = "pushed" }
    if (zs.isAlarm2Set()) { eventType = "doubleTapped" }
    if (zs.isAlarm1Set() && zs.isAlarm2Set()) { eventType = "held" }
    def descriptionText = "$device.displayName:  $eventType"
    if (eventType != "unknown") {
      return createEvent(
               name: eventType,
               value: 1,
               isStateChange: true,
               descriptionText: "Button 1 was $eventType"
			   )
	  }
}

private Map getBatteryResult(rawValue) {
    log.debug 'Battery'
    def volts = rawValue / 10
    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() {
    log.debug "Refreshing Battery"
    return zigbee.readAttribute(zigbee.POWER_CONFIGURATION_CLUSTER, 0x20) +
            zigbee.enrollResponse()
}

def configure() {
    log.debug "Configuring Reporting, IAS CIE, and Bindings."
    def cmds = []
    return zigbee.onOffConfig() +
            zigbee.levelConfig() +
            zigbee.configureReporting(zigbee.POWER_CONFIGURATION_CLUSTER, 0x20, DataType.UINT8, 30, 21600, 0x01) +
            zigbee.enrollResponse() +
            zigbee.readAttribute(zigbee.POWER_CONFIGURATION_CLUSTER, 0x20) +
            cmds
}

def installed() {
    initialize()
}

def updated() {
    initialize()
}

def initialize() {
    sendEvent(name: "numberOfButtons", value: 1)
}
4 Likes

Pressed the buy button. Of course it's backordered. Apple watch will keep working for now as my goodnight button. First world problems.

I just picked one up on Best Buy's website, they even had one at my local store! Might be worth a shot if you're still looking.

I thought about checking out that fire hazard of a store for it. Always feel like I'm walking around New York City in there.

Thanks for posting! I modified it to report temperature, and fix the battery reporting if you want to use that as well:

metadata {
    definition ( name : "Smartthings Button", namespace: "jp0550", author: "Robert Morris, Mitch Pond, jp0550" ) {
    	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"
    }
}

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){
     	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) + []
}

*I wasn't getting regular temperature updates with configureReporting so I updated it to "temperatureConfig" and it seems to have fixed the problem.

3 Likes

Thanks! I was so concerned with just the button pressed that I didn't even know it reported temperature and just kept the code for the battery from the ST buttons (which did not include this one, nor did I know how this one reported the values). I see you can also get rid of the imports at the top since they aren't needed with this simplified driver. Thanks again! :smiley:

3 Likes

Thanks @bertabcd1234 and @jp0550. Just picked up one these buttons at Best Buy and it works great with your driver.

1 Like

Finally got my 2018 ST Multisensor in the mail today. I can get it to report open/close, temperature, and (I think) battery with the SmartSense Multi driver. What I can't get working is vibration/movement with any of the stock drivers I tried. I did hastily port the SmartThingPublic multi driver (or everything I could--commented out a few parts where I wasn't sure), and it does work for acceleration and axis reporting now, too! I would share that code but it's in very poor shape, having been cobbled together embarassingly hastily. :slight_smile: Again, I'm sure these will be officially supported with native drivers as staff gets their hands on them and has time.

EDIT: Updated the above post to indicate I was eventually able to get movement/vibration/acceleration and axis reporting working (funny what happens when you start with a motion sensor driver but really wanted the multi sensor...).

Thanks for creating the driver for the SmartThings buttons! I just received three of them today (ordered from Amazon a week ago). They seem to be working well with this driver.

2 Likes

Hi Mike,

I will receive 5 2018 water sensors tomorrow, are they compatible? if this offer still available I can send you one if they are incompatible.

Thanks

i have one already, i have water, multi purpose motion, and the button isn't here yet.
hopefully I'll have these done for the next build,

2 Likes

2018 Water Sensors work fine with generic zigbee driver, not sure if @mike.maxwell has added the fingerprint data to the driver so that it is setup properly during pairing yet. I posted the fingerprint a while back so it's possible that he has.

Thanks

both the motion sensor and the moisture sensor fingerprints are in 1.1.4, the multipurpose sensor works with the generic zigbee contact sensor driver, that fingerprint will be in 1.1.5, still waiting for my button...

1 Like

Download the Hubitat app