[OBSOLETE] Osram Lightify 4 Button Switch DTH & Binder []

I’m confused by something, which you may know the answer to. Suppose I want to control something according to how long a button is held, for example using webCoRE… Think of a dimmer as a simple example, but my issue is more general. Then I need to be able to detect when the ‘held’ state ends. I assume this would require either a ‘button released’ event to be sent or for some sort of regular polling of the state of the button. I note that the ‘button’ capability allows for ‘pushed’ and ‘held’ states, but no released, and your DTH doesn’t send any ‘button’ event when the button is released. Do you happen to know the ‘official’ solution to this dilemma?

Hi,

I chose to implement the DTH to give the maximum native capabilities of the device rather than only constrained to the ‘button’ behaviour. This means it sends two types of event: the ZigBee commands (which are hardwired, and different events for each button - things like ‘set saturation’) and a standard button event.

As you say, the button capability has no ‘released’ event, but I do send custom events for when those things happen - the event type depends on which button it is. I’m afraid I don’t really know what the ‘otficial’ way to implement this is. Probably there is a dimming capability that handles it differently. However I guess if you had some sort of app that is listening for ‘held’ events, you could program it so that it keeps dimming (or whatever) for a period of time until it stops receiving those events.

I’ve found another bug in your Osram 4 button switch DTH: in the getBatteryResult function (int) pct * 100 should be (int) ( pct * 100 ). Otherwise whenever pct falls below 1, (int) pct is zero and 0 * 100 = 0. I was wondering why my device was still working even though the battery had apparently died :slight_smile:

I bought one a while ago and used it with another DTH and thought give yours a try as it can control particular bulbs

However like before it seems to control (or at least turn off) all my Lightify bulbs? I never even paired directly with any of them and I specified the two lights on the app. So not sure what I have done wrong and even reset the switch and paired up on ST again. Any suggestions?

Thanks and any advice will be appreciated.

I’ve committed a fix.

As you can see from the comments, all that code is carried forward from the old handler, so it’s quite likely there are other bugs. The battery % reporting message parsing for instance (the subject of the previous bug) doesn’t look like it’s expected to ever be called for this device (the comments indicate the device doesn’t send this message)

I can report success with the EU version and Andy’s code, with all four buttons working and usable. I used Andy’s code as the device handler, and then the in-built “Smart Lighting” SmartApp to turn off and on lights. I haven’t used any colour temperature changes or dimming, because I want the buttons to replicate the switches they are replacing. Full write up coming. In the mean time, I hope these two images will help those confused about resetting vs. pairing.

Factory reset (10 green slow flashes followed by three green fast ones):

Pairing mode (3 blue slow flashes followed by three blue fast ones):

Hi all,
I’ve not developed on ST before but want to have a go installing this device handler for the OSRAM Lightify 4-button switch. I see from Andy’s post that he has the code on gitHub. Would it be possible for me to gain access to this code in some way?
regards, Tim.

I thought I’d pass on my recent experience with this switch.
Starting form Andy’s DTH I’ve now put together a WebCoRE script which enables me to use this switch to control 4 (groups of) lights. Simple ‘push’ toggles the on/off state, whereas ‘hold’ controls brightness, temperature, hue and saturation respectively.
To do this I had to tweak Andy’s code to return an event when a button is released. I found that the obvious alternative of regularly checking the state of the switch didn’t work for 2 reasons. The first was high latency: the response was too slow. The 2nd is that webCoRE returned ‘held’ even after the button had been released until another event occurred.
I also found I had to dispense with attempting to monitor the state of the bulbs, because of the latency, and simply send the appropriate command to the bulbs at the required time.
I had to teach my family to be patient. When the bulbs didn’t respond instantly to a short push, they tended to either push again or hold the button for longer, messing up the logic of the script. Part of this was overcome by interpreting a ‘hold’ as a ‘push’ if all the bulbs are off, but the underlying issue remains.

hi all, firstly thanks for all your efforts on this, i just bought this switch on amazon and nearly have it working. everything is fine, using the DTH and binder then configured through the smart app, but i find the thing works maybe twice for an on/off test of each group and then just stops working.

does anyone else find it goes to sleep or only works once or twice before removing battery and trying again? the lights flash it just does nothing

cheers
dan

How were you able to get WebCore to identify the button which was pressed?

I have an OnAction monitoring my Osram 4x, but have not found the string to compare which buttonNumber was actually pressed from there.

After the button event is triggered, the variable $currentEventDeviceIndex contains the button number and $currentEventValue contains ‘pushed’ or ‘held’ (or ‘released’, if you tweak Andy’s DTH). That was not obvious to me either. I had to log the values of all the $currentEvent… variables in order to identify the ones I needed.

Can you see anything in the SmartThings logs? Is the button press not being received at all or is the logic getting stuck somewhere?

Thanks! The index was what I needed. Now it’s working really well. I just wish I had the UK version because buttons 3&4 just won’t work.

Any idea if I can get an osram hub and update/flash UK firmware?

If you are able to post what appears in the Smartthings logs when these buttons are pressed, I (we) might be able to deduce how the DH should be tweaked to make these buttons work.

Unfortunately there is nothing logged at all when they are pressed. Others above have deduced that it’s some non-standard stuff Osram is doing with the US version which the UK firmware has changed/corrected. I have reached out to their support team to see if there is anything I can do like flash new firmware using the Osram hub or something.

Has anyone been able to get all 4 buttons working with ST? Does it look like it might be possible, or is it a lost cause?

Switch is on sale on Amazon now…

https://www.amazon.com/dp/B01M3OK6J7

$11.99

That’s where I got it, but it seems pretty useless for ST, as only 2 buttons work and not very reliably.

Ugh, I cannot for the life of me get Smartthings to recognize this device as anything other than “Thing”. I made a custom device handler with Andy’s code, and I tried it with EU and without the EU. Still no dice. I can make it use the handler after it joins as a “Thing”, but it turns all my bulbs on and off… Any suggestions?

I got the two buttons to work by using the “OSRAM 4 Button Switch” custom device handler and the OSRAM Lightify 4x Switch Binder. If it adds as a “thing”, go into IDE and change the device type to the OSRAM.