Battery Operated 3 Toggle Switch for wallmount or table top use (SmartenIT ZBWS3B) [DEPRECATED: STOPPED WORKING IN 2018]

I made some modifications from some shared code from the minimote.

/**
 *  3 button ZigBee switch ZBWS3  
 *
 *  Copyright 2014 John.Rucker@Solar-Current.com
 *
 *  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: "3 Button Controller (ZBWS3) with num of buttons", namespace: "thegilbertchan", author: "Gilbert Chan") {
        capability "Button"
        capability "Configuration"
                
        attribute "button2","ENUM",["released","pressed"]
        attribute "button3","ENUM",["released","pressed"]        

        fingerprint endpointId: "03", profileId: "0104", deviceId: "0000", deviceVersion: "00", inClusters: "03 0000 0003 0007", outClusters: "01 0006"
    
    }

    // simulator metadata
    simulator {
    }

    // UI tile definitions
    tiles {
        
        standardTile("button1", "device.button", width: 1, height: 1) {
            state("released", label:'${name}', icon:"st.button.button.released", backgroundColor:"#ffa81e")
            state("pressed", label:'${name}', icon:"st.button.button.pressed", backgroundColor:"#79b821")
        }
        
        standardTile("button2", "device.button2", width: 1, height: 1) {
            state("released", label:'${name}', icon:"st.button.button.released", backgroundColor:"#ffa81e")
            state("pressed", label:'${name}', icon:"st.button.button.pressed", backgroundColor:"#79b821")
        }        

        standardTile("button3", "device.button3", width: 1, height: 1) {
            state("released", label:'${name}', icon:"st.button.button.released", backgroundColor:"#ffa81e")
            state("pressed", label:'${name}', icon:"st.button.button.pressed", backgroundColor:"#79b821")
        }
        
    main (["button3", "button2", "button1"])
    details (["button3", "button2", "button1"])
    }
}

// Parse incoming device messages to generate events
def parse(String description) {
    log.debug "Parse description $description"
    def name = null
    def value = null              
    if (description?.startsWith("catchall: 0104 0006 01")) {
        name = "1"
        def currentST = device.currentState("button")?.value
        log.info "Button 1 pushed, current state = $currentST"

        if (currentST == "pressed"){
            log.trace "Changed to released"
            value = "released"
        } 
        else {
            log.trace "Changed to pressed"
            value = "pressed"
        }           
            
    } else if (description?.startsWith("catchall: 0104 0006 02")) {
        name = "2"
        def currentST = device.currentState("button2")?.value
        log.info "Button 2 pushed, current state = $currentST"        
        if (currentST == "pressed"){
            log.trace "Changed to released"
            value = "released"
        } 
        else {
            log.trace "Changed to pressed"
            value = "pressed"
        }   

    } else if (description?.startsWith("catchall: 0104 0006 03")) {
        name = "3"
        def currentST = device.currentState("button3")?.value
        log.info "Button 3 pushed, current state = $currentST"        
        if (currentST == "pressed"){
            log.trace "Changed to released"
            value = "released"
        } 
        else {
            log.trace "Changed to pressed"
            value = "pressed"
        }   
    } 
    def result = createEvent(name: "button", value: "pushed", data: [buttonNumber: name], descriptionText: "$device.displayName button $name was pushed", isStateChange: true)
    log.debug "Parse returned ${result?.descriptionText}"




    return result
}


def parseDescriptionAsMap(description) {
    (description - "read attr - ").split(",").inject([:]) { map, param ->
        def nameAndValue = param.split(":")
        map += [(nameAndValue[0].trim()):nameAndValue[1].trim()]
    }
}

private getFPoint(String FPointHex){                   // Parsh out hex string from Value: 4089999a
    Long i = Long.parseLong(FPointHex, 16)         // Convert Hex String to Long
    Float f = Float.intBitsToFloat(i.intValue())   // Convert IEEE 754 Single-Precison floating point
    log.debug "converted floating point value: ${f}"
    def result = f

    return result
}


// Commands to device

def configure() { 
    log.debug "Binding SEP 0x01 DEP 0x01 Cluster 0x0006 On/Off cluster to hub"         
        def configCmds = [

        "zdo bind 0x${device.deviceNetworkId} 0x01 0x01 0x0006 {${device.zigbeeId}} {}", "delay 500",
        "zdo bind 0x${device.deviceNetworkId} 0x02 0x01 0x0006 {${device.zigbeeId}} {}", "delay 500",        
        "zdo bind 0x${device.deviceNetworkId} 0x03 0x01 0x0006 {${device.zigbeeId}} {}", "delay 1500",        
        ]
    log.info "Sending ZigBee Bind commands to 3 Button Switch"
    return configCmds
    }
def installed() {
    initialize()
    createChildDevices()
}

def updated() {
    initialize()
    if (!childDevices) {
        createChildDevices()
    }
    else if (device.label != state.oldLabel) {
        childDevices.each {
            def segs = it.deviceNetworkId.split("/")
            def newLabel = "${device.displayName} button ${segs[-1]}"
            it.setLabel(newLabel)
        }
        state.oldLabel = device.label
    }
}


def initialize() {
    sendEvent(name: "numberOfButtons", value: 3)
    sendEvent(name: "DeviceWatch-Enroll", value: JsonOutput.toJson([protocol: "zigbee", scheme:"untracked"]), displayed: false)
}

private void createChildDevices() {
    state.oldLabel = device.label
    for (i in 1..4) {
        addChildDevice("Child Button", "${device.deviceNetworkId}/${i}", null,
                [completedSetup: true, label: "${device.displayName} button ${i}",
                 isComponent: true, componentName: "button$i", componentLabel: "Button $i"])
    }
}
3 Likes

Hi JD, I was following your instructions to make this device work, but my dashboard, or page display when Im logged onto my hub doesnt have a link titled “my device types”. (instruction step # 14). am I doing something wrong? Thanks for your info!!

See the custom code FAQ: the terms have changed multiple times over the years:

They are now called “device handlers.” :sunglasses:

when I click on my device handlers, it says I have none. I can only see the custom handler if I follow location and then click on the various devices and handlers there. I can see the custom handler there but there is no options that I can see anything that says device to test with.

JD, I think I figured it out, it is now listed under the simulation button. thank you again for posting these instructions and your patience with us “newbies”!!

1 Like

Will this work with the new SmartThings hub, ver 3?

it’s a custom device handler, not by samsung, so probably never.

1 Like

So does that mean the custom device handler does Not work with the latest SmartThings hub?

1 Like

At the Moment YES.

It should work with the new hub, but not with the new app. You would have to install the classic app to make it work.

A lot of people are using both apps for just this reason. But you do run the risk that once the classic app goes away, the device might no longer work. :disappointed_relieved:

1 Like

a better choice might be Sylvania 73743a which is standard? device type “Zigbee Button” - I think you get battery monitoring and 2 buttons combination of press, hold etc.

2 Likes

Agreed. It’s only two buttons instead of three, but it now has a stock DTH and would be a much easier install. :sunglasses:

https://support.smartthings.com/hc/en-us/articles/115000236823-SYLVANIA-Dimming-Switch

Will this work with the classic app, it seems like it should,
Sylvania Smart Home 74099 Sylvania LIGHTIFY Smart Switch 8 Functions/ 4 Buttons, White

Some people have been able to get the European version of that to work, but people with US version have only been able to get the two buttons on the left side to work. ( they are the same frequency, but the firmware is different.) Much discussion and lots of details in the following thread:

People have been working on this for over a year but the short answer is that the US version just doesn’t work with smartthings at the present time. :disappointed_relieved:

Please take any further discussion of this device to the thread I’ve just linked to, as it’s way off topic for the thread we are in now. Thanks.

1 Like

I recently purchased the ZBWS3B and followed the directions here to set up the device handler. While i was able to install, the device shown in the app only shows 1 button and it’s not even configurable for an action.

My guess is that the existing handler isn’t supported on the current app version, but wanted to confirm here if at all possible. If so I guess I’m returning the device and giving up on having a 3 button switch that works with SmartThings. Thoughts?

You are responding to a thread which is four years old, and following instructions which are older than that. It just doesn’t work now, unfortunately. :disappointed_relieved:

SmartThings Is in the middle of a huge transition right now, from Groovy device type handlers that run in a cloud to Lua edge drivers that will run on your own hub. So even if the code had worked for you, it would only have worked for a few more weeks.

I think it’s possible that once matter is supported, you will have a lot more options for three button devices. For example, I think it’s entirely possible that the Wemo 3 button scene controller will eventually work with Matter. but we don’t yet know for sure, and we don’t yet know what the smartthings implementation will be. There may also be multiple inexpensive devices from other brands available later.

If you’re OK with waiting a few months, I think we will know a lot more then. The smartthings transition to their new architecture should be complete, and matter should be live.

Here’s the community FAQ on edge if you want to read more about the transition:

FAQ: I have no idea what Edge is. Is that a new developer tool? (2022)

I know it’s only been a few months, but Matter is here! Silly me never returned my device so I figured Inwould mess around with it. Alas, it does not work by default and changing the Type to something standard doesn’t work either.

The hardware itself seems simple and robust so I’m hoping someone still has some interest in getting the local driver to work.

Matter won’t make any difference to this device one way or another unless you find a way to connect it to a different Zigbee hub, which is also a “matter bridge.” But it’s very early days for matter yet, hardly any devices are available to ship so far.

The specific model device does work with both home assistant and Hubitat, the problem is that smartthings has always handled buttons with its own overlay architecture (which they have changed multiple times), and that can make devices with multiple endpoints very tricky. So I honestly don’t know if we’ll ever see an edge driver for this or not. :thinking:

So just to keep this thread updated, I found a switch that does exactly what I need and that is fully supported in SmartThings.

The Minoston MR40Z is a Z Wave switch and has a supported edge driver provided by the manufacturer. It showed up initially as an Aeotec button and was installed through the QR code on the device.

It’s crazy how much money I have spent trying to find the right button! Here’s hoping I can sell some of this and get a few bucks back. While the SmartenIt button is definitely more robust (albeit industrial looking) it doesn’t look like I will be using it. This Minoston fits right in to the look of any room.