Wireless, Battery Operated Wall Switch

There are rumors that the Iris Smart Button might work with ST. It’s wireless…

Not sure how well it can be tied to actions though. Might require SmartApps

Have you looked at this ZigBee based 3-button Switch http://smartenit.com/product/zbws3b/? I have other SmartenIT ZigBee devices working with SmartThings and a custom device profile for this switch is on my to do list. Maybe somebody already has it working.

1 Like

Hi John,

Did you manage to write a custom profile for this switch? It would help me a lot!

Nope not yet but i have one here and it is on my to do list. I will sure let you know when I get to it. Do you have one? Have you got it to join the SmartThings hub?

Yes I just got two of those.
I managed to get them join the hub, but I’m a bit stuck at writing the device profile with all the zigbee specific codes, cluster and so on.
If you have already a bit of code, it would probably help me a lot to get started!

Here you go Oliver I wrote this custom device driver from scratch this morning. It works with my switch. Your going to have to do some work to get it assigned to you actual device. I couldn’t get the foot printing process to work reliably but you can work around that by manual assigning it to the device by editing the device and picking the driver.

Code Follows:

/**
 *  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 ZigBee Toggle (ZBWS3)", namespace: "JohnRucker", author: "John.Rucker@Solar-Current.com") {
        capability "Sensor"
        capability "Configuration"
        capability "Contact Sensor"
        
        attribute "contact2","ENUM",["open","closed"]
        attribute "contact3","ENUM",["open","closed"]        

    	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("contact1", "device.contact", width: 1, height: 1) {
			state("open", label:'${name}', icon:"st.contact.contact.open", backgroundColor:"#ffa81e")
			state("closed", label:'${name}', icon:"st.contact.contact.closed", backgroundColor:"#79b821")
		}
        
        standardTile("contact2", "device.contact2", width: 1, height: 1) {
			state("open", label:'${name}', icon:"st.contact.contact.open", backgroundColor:"#ffa81e")
			state("closed", label:'${name}', icon:"st.contact.contact.closed", backgroundColor:"#79b821")
		}        

        standardTile("contact3", "device.contact3", width: 1, height: 1) {
			state("open", label:'${name}', icon:"st.contact.contact.open", backgroundColor:"#ffa81e")
			state("closed", label:'${name}', icon:"st.contact.contact.closed", backgroundColor:"#79b821")
		}
        
	main (["contact3", "contact2", "contact1"])
	details (["contact3", "contact2", "contact1"])
    }
}

// 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 = "contact"
    	def currentST = device.currentState("contact")?.value
    	log.debug "Button 1 pushed, current state = $currentST"        
        if (currentST == "closed"){
        	log.debug "Changed to Open"
        	value = "open"
        } 
        else {
        	log.debug "Changed to Closed"
        	value = "closed"
        }         	
            
    } else if (description?.startsWith("catchall: 0104 0006 02")) {
    	name = "contact2"
    	def currentST = device.currentState("contact2")?.value
    	log.debug "Button 2 pushed, current state = $currentST"        
        if (currentST == "closed"){
        	log.debug "Changed to Open"
        	value = "open"
        } 
        else {
        	log.debug "Changed to Closed"
        	value = "closed"
        }   

    } else if (description?.startsWith("catchall: 0104 0006 03")) {
    	name = "contact3"
    	def currentST = device.currentState("contact3")?.value
    	log.debug "Button 3 pushed, current state = $currentST"        
        if (currentST == "closed"){
        	log.debug "Changed to Open"
        	value = "open"
        } 
        else {
        	log.debug "Changed to Closed"
        	value = "closed"
        }   
    } 
    
    def result = createEvent(name: name, value: value)
    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
	}
2 Likes

Works like a charm! Thanks a lot!

How did you figure out the correct binding clusters and code?
From experience or using debug messages?

ZigBee devices have the ability to report their capabilities. I first use the report end points command and then i ask for a simple description of each end point. The devices will report back a set of clusters they support on each end point. From there its a matter of looking up those clusters in the ZigBee documentation to figure out how to communicate with them.

Glad it worked keep us posted on what you do with it!

1 Like

Sweet Jesus this is a dream come true, thank you JohnR! Perfect for bedside control, adding a switch by the couch or for guests, these will also be great for all the TCP and GE bulbs I’ve been picking up. They seem to have changed somethings on the website so the link above is now broken, so here is the new link.

http://smartenit.com/product/zbws3b/

4 Likes

This is great. Is there a guide or helpful steps for somebody who doesn’t understand how to install this code into the ST system? Would love to implement this solution but not really sure where to start.

@sgord I totally understand I have been pushing for some type of API to allow developers to install custom device types. Right now you have to cut and past the custom device driver into the IDE and publish it locally. Not that big of a deal for someone who does it every day but for a guy or gal who just wants a cool device to work it is bit of an undertaking. What we need is an install process developers can include in their custom device type allowing users to easily install new device types. SmartThings has a way of publishing them internally but that process is more for manufactures and builders not to mention it has a good size backlog right now. I understand why they have this process and this is a good example of a device that isn’t a good fit. I don’t make these devices I just simply helped a guy out by writing a custom device type for one. To get it certified I would need to send a device into SmartThings with documentation and basically sponsor the device. All to just get a custom device type pushed though so it would show up in your device list.

It took me maybe an hour to write the device type for this three button ZigBee switch If I had a way to zip it up with a install process you could just click on to install it into you IDE I would be happy to spend the extra time and package it up that way. But that doesn’t exist and that is what I very much would like to see the SmartThings people add! I will bring in two SmartThings people into this conversation @Ben, and @urman who i know care a great deal about customer request. They may have a way to do this I just don’t know about.

1 Like

When I use SmartApps with this switch I’m only able to connect to one of the three contacts. How do I gain access to the the other two contacts?

I was successful installing the Device Type above, thanks @JohnR, and I can see responses from all three contacts in the Things section.

1 Like

I just picked up a couple of these switches and have them connected to the hub as well as setup the device type supplied by @JohnR, I would like the buttons to control my smart switches not contact sensors. How would I finish my setup? Thanks

Can you give me an example of what you would like to turn on or off? Is it a light or a smart plug??

It would like to be able to turn on and off a smart plug or a smart light switch. Thanks

Is this doable? Right now on the app it shows 3 contact sensors.

From your smart phone tap on Lights & Switches, then on the little gear icon. Now click on Add new light/switch, give it a name and tap on next, choose the light or switch you want to control and then click next, pick an icon or just tap on next, now you need to tap on “Turn on when a door or windows is opend” and then on “Choose a contact sensor(s)”

Thanks for the instructions.

When I open the Things menu I only see one contact sensor, when I tap the gear it now shows 3 contact sensors. When I follow your instructions how do I select an individual contact sensor?

Thanks

Thanks for posting JohnR. I havent gotten this to work though. I paired the device (or at least it showed up in my smartthings app and I installed your device type and associated with this device but none of the buttons on the device do anything. What do you mean by “manual assigning it to the device”?

@JohnR, I think I’m having a similar issue as @cassmie. When I go to assign the contact sensor(s) there is only one in the list for the 3-button switch. I’ve been able to assign that single button, and it works, but the other two aren’t listed with the contact sensor(s).

When I tap the gear for the buttons in the Things menu I can see all three contacts and they all actuate properly.