SmartThings Community

RELEASE: OSRAM Lightify Smart Dimmer Switch (button controller device handler and smart app)

osram
dth_remotes
dth_lighting

(Michael) #126

Now that I think about it I wonder if this has something to do with the fix that was provided below for an issue I was having parsing the buttonNumber. I am currently using the workaround below in my smartapp to parse that since evt.data.buttonNumber was not working.


(Bruce) #127

You know, it’s going to be something lame like that. I’m already doing .toInteger() on it, which seems lame, but works for Minimote and ZWN-SC7.

What about evt.jsonData.buttonNumber? Is that being set correctly?

You should take a look at the Minimote and ZWN-SC7 device handlers, and see how they are doing this event. There is an outstanding issue with the ZWN wrt evt.value, but that’s separate from this issue, which is buttonNumber.

Incidentally, older code did not use the jsonData form from above. The older code uses evt.data, and had a comment about jsonData returning [:]. I guess the question is what method works for all button dh?


(Michael) #128

Hmm, I added that method and put a debug log in and this is what I get, looks exactly the same to me. newButtonNumber is the method you provided (without a ? at the end as that causes an error, I realize that was my copy mistake though) and oldButtonNumber is the way I was doing it.

newButtonNumber is 1 and oldbuttonNumber is 1


#129

Are there easy instructions on how to install this? I’m just wondering where to put the code from GitHub in SmartThings?


(Michael) #130

This is posted in various places around the forums but here you go.

Login to Web IDE and click on the "My Device Handlers" link on the top menu
Create a new Device Handler by  clicking on "Create New Device Handler" button in the upper-right  corner.
Click on "From Code" tab.
Copy code from Github, and paste it into the code section.
Click "Create" at the bottom of page
Click "Publish" at the top of pager and then select "For me"

Now new devices of this type will use the new code, the process is pretty much the same for smart apps but instead of selecting the “My Device Handlers” you would select “My SmartApps”.

Hope this helps.


(Jason) #131

@Motley This is a good guide to link in the OP imo

Another good resource is the community created Wiki: http://thingsthataresmart.wiki/


(Michael) #132

Thanks, I was in a bit of a hurry this morning and didn’t bother searching the forums myself. I am waiting until I get the issue resolved with using other smart apps with the device type and then I plan to put in a publication request to get this added so that adding the code is not necessary but not sure how long that process takes.

I will take your suggestion and update the first post with that link so that others that are wanting to use it don’t have to search the thread but honestly I feel that before people start adding custom code there are likely several Wikis that they would benefit from reading. Isn’t there a “Getting Started” guide that ST puts out on this stuff or is it up to the community to provide the info?


(Jason) #133

There is, but the last time I looked at it, it wasn’t great.

https://support.smartthings.com/hc/en-us/categories/200058800-Guide-to-SmartThings


(Michael) #134

Great news (I hope).

I have not done a lot of testing but I think I may have fixed the issue with the device handler not working with other apps. Basically it appears other apps are looking for a value of “pushed” for the button events and I was sending the value as “pressed”. I mentioned this a few posts back (and so did @bravenel although I missed it) and decided to try and switch that and see if that was the issue and it appears to have worked. I was able to setup Button Controller in addition to the smart app I created that is currently controlling a set of lights and I set the Button Controller app to control a different set of lights, when I pressed the button both sets of lights came on so it appears that now works. My guess is the “held” events have always worked since I didn’t have to change that part but it did work when I tested with Button Controller.

I don’t have a lot of time to test with all the various other apps at the moment but if someone waiting for this functionality wants to test it and provide feedback that would be great. Both the device handler and smart app were updated on the GitHub site in the first post.

Also, be warned that since the events my smart app subscribes to have changed if you are using my smart app you will need to trigger the configure function to reset the subscribed events. The easiest way to do this is just to open the smart app on your phone and then click “Done” which will basically re-save your current setup but with the new subscriptions in place.


(Rudi Prunzel) #135

Hi Michael (@Motley) , here is the “Button” capability “Attributes” sample/expected values reference:

http://docs.smartthings.com/en/latest/capabilities-reference.html?highlight=capabilities#button


(Michael) #136

Yeah, I must have missed that. Funny that “pressed” also works as long as the smart app is written to look for it, really the value can be anything you want but as long as the smart app is looking for it.


(Chick Webb) #137

Hey, this sounds like great news! Is there a DTH update in your repo, then? There’s no revision history in the header comments so it’s tough to tell. Might be a good thing to add?


(Michael) #138

Yes, I stated in my reply that I updated the GitHub site in the first post. I could keep a revision history in the first post but then again that is what git (or in this case GitHub) is for. I think in the last developer call they discussed better version control integration so maybe in the future GitHub links will have some kind of “last updated” indication which would be really nice.


(Chick Webb) #139

A lot of people, myself included, have long made a practice of putting a brief comment regarding updates in each revision of the code in the comments at the start of the source. See @bravenel’s comments in the source code for RM, for example. Since your code isn’t linked in a repo, this would be especially helpful as it would allow people a quick and easy way to assess if they had the latest version.


(Michael) #140

Geez, hard to keep people happy around here eh?

Not trying to be a pain but I am a developer in my day job and I do enough coding and documentation there to make anyone sick however I will see about adding comments to the top of the code. Really this is just a side project/hobby that I work on when I have time which is not a lot and to me the most important thing here is that it work. Not to sound selfish or anything like that but the switches already worked for my needs with my device handler and smart app so the extra work put in to research and fix the issue with support for other apps was a bonus and to make it more usable for the rest of the community.

Honestly I don’t see there being many more updates for the device handler anyway since it is a simple device that has 2 buttons that can report pushed or held state and I don’t see what else I would add to it. That is not to say that if some other function is supported and is needed that I wouldn’t try to add it by request and as long as I have the time. The smart app is a whole different story and based on the comments I have received I don’t even see that being used much since everyone would prefer to use one of the many more flexible smart apps that exist now that the device handler works with them.

To be honest the ST platform is already way more work than I bargained for when I set it up but since I am a developer and the platform is open it is hard for me to turn away an opportunity to make something work. The constant issues with ST make it hard for me to even want to do this development but I am trying to give ST some time to work out the major issues before I completely bail on the platform.


(Michael) #141

Regarding the GitHub linking, what is required for that? It seems to me that it is already setup to be compatible with that but I may be wrong. If you add my SmartThingsPublic repo to your list of repos does it not work? Is there a guide somewhere that says how to set things up to make that work?

I know that it works under my account as far as it being linked to my code in the IDE but that may just be because it is my account to begin with.


#142

http://docs.smartthings.com/en/latest/tools-and-ide/github-integration.html


(Michael) #143

I have been through all that, I guess that means that my code is linked to a repo.

Not sure what else to provide for someone to link that, as far as I know you just need the repo name and the namespace which I think everyone has.


#144

@jody.albritton might know more…


(Brian Salyer) #145

So since this device is just a cover to the actual switch and the switch is three way, one should cover both physically switches right? But thinking that is true, the two devices can technically be independent of each other. I can assign the short press on both devices to do the same thing as each other, but the long pressed could do different triggers from device one from device two. Am I thinking in the right way?