If you ask your question in the developer section of the forum, someone should be able to help.
https://community.smartthings.com/c/developers/writing-device-types
If you ask your question in the developer section of the forum, someone should be able to help.
https://community.smartthings.com/c/developers/writing-device-types
I got it working. I also discovered a new button, both pressed and held = button 3 pressed.
Both buttons held for over 3 seconds enters into Pairing mode
That’s great!!! What did you have to do?
No. Both buttons held for 1+seconds sends command 06 03. Which is actually a hidden button. The Lightify Hub detects that and responds with proper pairing commands. The fact is, you can actually use it to trigger anything you’d like.
def Map handleButtonPress(Map msg){
switch (msg.command){
case "01":
def returnval=on()
return returnval
break
case "03":
bothButtonsPressed()
break
case "00":
def returnval=off()
return returnval
break
default:
log.error("got unknown button press command: "+msg.command)
return "error"
break
}
}
I’m going to use this to call a 5-second delay and then a smart app or routine. EG. all lights on, all lights off, make toast… that sort of thing.
I’m using a recursive loop on a state, along with a timed brightness value
/**
* adjusts brightness up/down depending on the value of the up boolean true is up, false is down
* continues to adjust until state.dimming is changed
*/
def Map adjustBrightness(final boolean up,int level){
Map result
log.debug("adjusting brightness" + (up?"up":"down")+ " from current "+ state.brightness)
if ( state.dimming ){
//increase or decrease brightness
if (up){
state.brightening=true
} else {
state.brightening=false
}
state.brightness=level
executeBrightnessAdjustmentUntilButtonReleased()
} else {
log.debug("Final brightness adjusted to "+state.brightness)
}
sendEvent(name: "brightness", value: state.brightness)
return getStatus()
}
/**
* performs a recursive brightness adjustment based on state.brightening while state.dimming is true
*/
def executeBrightnessAdjustmentUntilButtonReleased(){
if (state.dimming){
if (state.brightening){
state.brightness=state.brightness+20
} else {
state.brightness=state.brightness-20
}
if (state.brightness>100) state.brightness=100
if (state.brightness<1) state.brightness=1
setLevel(1000,state.brightness)
reportOnState(true) //Manage and report states
runIn(1, executeBrightnessAdjustmentUntilButtonReleased)
}
}
So, brightness is set to current state.Brightness+20% with 1000 milisecond time-to-dim each second the button is pressed.
here’s my method to set level
/**
* handle level commands,
* level=desired level
* duration=desired time-to-level
*/
def setLevel(Double level, Double duration) {
log.info("Brightness commanded to "+level+"%")
state.brightness=level
def result=createStCommand(" 8 4 {"+getBrightnessHex()+" "+duration+"}")
fireCommands(result.command)//send it to the hub for processing
}
I’m also working on getting the in-app controls working properly. I am bad at UI work. I’m working on proper reporting, on-off toggle, level set, and a “special” button. I think everything else is almost in order.
Yes. Both buttons held for 3+ seconds enters the Pairing mode. (This is from the product manual).
I’ve also tested this a couple of weeks ago when a device was not connecting and it worked.
I never said that the device does not send a command when both buttons are pressed, and I’m glad that you’ve find a use for it, but I don’t think the manufacturer original design was to use both buttons pressed as a button command.
Also, I was just trying to help just in case somebody presses both buttons for over 3 seconds and the Blue light starts blinking
Pairing is handled in two stages on Smart Things.
This leaves the pairing button unused for SmartThings.
I’m sorry, I found this confusing. Smartthings uses a certified Zigbee coordinator, and pairing occurs exactly as it does with any other certified Zigbee Coordinator. Configuration is always a separate step.
Putting the device into pairing mode should mean it stays in pairing mode until either the join is complete or the device times out. So if you are manipulating the device such that the firmware goes into pairing mode, then isn’t the device unable to accept any other button presses until it times out? That would be different than using other button patterns.
It might still fit certain use cases, but it’s not just another button pattern.
What did you do to get the runIn() to work?
The difference here is the pairing appears to not operate in the expected manner. I couldn’t get any of my devices to get pair with the buttons. I had to remove the battery and replace it. It appears pairing mode is nothing more than an additional button here .
Well, I had a chance to finish my switches. The intent of this project is to replicate the functionality of the Osram Lightify System, in it’s entirety.
Source:
Replicated Lightify Device Features:
Additional Features:
SmartThings console features:
SmartThings app features:
Installation:
Device States:
In-App image:
Coming soon.
I haven’t figured out the best implementations yet. Any tips are appreciated.
I guess I should make a new thread for this.
Yep.
put the Github link in the first post of the new thread so it’s easy for people to always find the most current version.
First of thanks for your great work on this, I will have to give it a try at some point. I originally intended to do something similar but was told by community members that they would prefer a button device type that they can use with other devices (other than lights). You also implemented some features I had not thought of so thanks for that.
Sorry I have not been very active lately but I have had some other higher priority projects I have been working on. I have been lightly following this thread so have seen the progress/comments but just have not had a lot of time to respond. I have also been very disappointed in the ST system since they still have not solved the scheduling issues completely (still have routines that do not fire on occasion) nor have they solved the issues with SHM and the arming/disarming issues. I also still see devices that randomly stop communicating and need to be reconnected and this is mainly with the ST multi sensors so it is likely an issue with those devices.
Again, thanks for your hard work on this!
New topic created
Thanks @Motley. Since most of my work was based on yours and some from @jkrischt , it means a lot to hear positive things from you. I’m new around here and it’s nice to see this is a supportive community.
Your thread is the first one that comes up when you Google “Lightify Switch SmartThings”, so it’s very easy to find and I have done so repeatedly to come back here. Any chance of a “zigbee version link” in the first post?
Absolutely, I will add a link soon, I am mobile right now so it will probably be later today.
Just thought I’d check in. I switched over to a SmartThings recommended configuration routine as such:
fireCommands(zigbee.onOffConfig() + zigbee.levelConfig() + zigbee.onOffRefresh() + zigbee.levelRefresh() + zigbee.readAttribute(0x0001, 0x0020))
which translates to a set of commands as such:
commands:[zdo bind 0x4839 1 0x01 6 {8418260000E8CEF0} {}, delay 500, zcl global send-me-a-report 6 0 16 0 600 {}, delay 200, send 0x4839 0x01 1, delay 500, zdo bind 0x4839 1 0x01 8 {8418260000E8CEF0} {}, delay 500, zcl global send-me-a-report 8 0 32 1 3600 {01}, delay 200, send 0x4839 0x01 1, delay 500, st rattr 0x4839 1 6 0, delay 500, st rattr 0x4839 1 8 0, delay 500, st rattr 0x4839 1 1 32, delay 500]
I checked and all of the commands are present here which are present in the intialization section as per @Motley’s, and then a few more. This opened up several new things.
Which allowed me to handle those with states… state.networkBind=true, state.onOffBind=true, and state.dimmerBind=true. These states allowed me to set up a daemon with runIn(5, configure), which will run repeatedly until the configuration of all the states are detected as bound.
@adamoutler, sorry for the delay but I updated the first post with a link to your device type.