Osram Lightify 4 Button Switch DTH & Binder [ALPHA]

Hi, sorry I’ve been quiet, I’m still alive and thinking about this topic. I’ve been distracted by the random zigbee\Osram power on issue documented in other threads.

I’ve got one switch in daily use, the others are sat idle so I’ll see if I can work in a reason to get them ‘in production’ and thus tested.

2 Likes

Hi Iandog,

Curious, which variant is/are your device(s)? Do you know if you have the EU variant? (Easiest to tell by, after it’s joined, going to your smart hub devices , click on the Osram Switch, and then view the “Model” info in the “Data” row:

“Switch 4x-LIGHTIFY”= US/Other
"Switch 4x EU-LIGHTIFY"= European variant
)

They’re all 4x EU-LIGHTIFY but interestingly, the two that don’t work properly list this as the first data item, and the one that does lists it as the last.

Could that make a difference?

**Actually, ignore that, the order of the data points is the same across all 3 devices. Maybe I’ll reload the DTH from vanilla, delete an offending Switch and try repairing it.

Ian, your B4 issue will almost certainly be binding. On my first attempt I handled events based on the command and data values being broadcast. I subsequently updated the code (see above) to get things working more reliably. The binding part of the config takes effect on the first join\configuration of a device.

Run a remove of the switch from the app. Do a reset on the switch (hold lower left and upper right for I think 5 seconds). Setup your DTH however you want it and rejoin. Once setup if you monitor live logging in the IDE you should see plenty of debug messages I’ve left active for each button press(or you can add your own).

The pertinent code for B4 is:
"zdo bind 0x${device.deviceNetworkId} 0x04 0x01 0x0006 {${device.zigbeeId}} {}",
"zdo bind 0x${device.deviceNetworkId} 0x04 0x01 0x0300 {${device.zigbeeId}} {}",

Other buttons are …NetworkId} 0x01 to 0x03.

I’m 51% certain that the behaviour changed massively on my first switch at some point, possibly a result of my pressing certain combinations of buttons. However the updated code quoted way up the thread has worked for me on three EU switches out of the box.

I’d like to see the binder updated to make it more flexible, to change the range of devices used or trigger colour changes.

Thanks for this, most helpful. I’ve copied and pasted your code from the post further up to make sure I’ve got the latest then dropped and re-joined the switch. It picks the DTH up straightaway and reports itself as the OSRAM 4x SWITCH. Button 4 still not registering though…

I’ll drop and re-join a couple more times to see if that helps. (Might be worth pointing out that I did have this one working fine until the DST problems over the weekend…)

Hi folks,

Tonight I decided to take a look at integrating the 4 button switch (EU version). I used your handler as a starting point but I made some heavy modifications as I preferred to parse the events directly as they are sent rather than as button presses.

What I mean by that is - the switch is not reporting ‘button 1 short press’, it reports specific states, as if it were controlling a bulb. The buttons map like this:

left pair short press - ‘on’ or ‘off’ (commands 0 and 1 in cluster 0x0006)
left pair long press - level control ‘up’ or ‘down’, and ‘stop’ on release (cluster 0x0008)
right pair short press - step colour temperature up and down (cluster 0x0300)
right pair long press - first it sets saturation to maximum, then moves hue up or down, and ‘hue stop’ on release (cluster 0x0300)

This is why you were perhaps struggling a bit to figure out why the left and right buttons didn’t work the same way.

What’s interesting is, this is the default behaviour of the switch after a reset. When you connect the switch to the lightify hub, you can configure the buttons to control different devices and do different things. It looks like this configuration is then sent to the switch via the 0004 and 0005 clusters. I’m not sure if it’s possible to change the events that the switch reports (e.g. change the right buttons so they work like the right buttons), it might be.

Code is here:

Also got battery and switch state reporting to the UI working.

Hi Andy,

Thank you for taking a look and reworking, I’m glad that I could at least provide a starting point. Not knowing much about cluster functions when I started out I aimed to handle it from the perspective of physical action.

The reset and button change is interesting and threw my first interpretation out completely. I think some playing with button combinations is needed. I just checked the docs again and it states a reset is performed with holding upper left and lower right together for 5 seconds. Having mistaken the combination I found you can get a series of events from holding lower left and upper right, sometimes with blue flashes and sometimes green. This also removes it from the hub. I expect this is where the change is occurring.

I didn’t know anything at all about ZigBee clusters until last night, I just read the spec (well, not all of it, it is massive!). If I get spare time I may look into how the configuration works via clusters 4 and 5, but it looks to me like this switch is designed simularly to the IKEA remote and not like the Philips dimmer. That is, the buttons directly trigger ZigBee scenes and groups, whereas the hue dimmer just sends button presses to the hub and all the logic is configured there using the Hue API. That’s not useful for smartthings really, except it might be necessary at some point to stop the switch sending both broadcasts and notifications to the hub. We’ll see how it behaves - I haven’t booked it up to any actions yet.

I added the DH, but it says “Tiles Missing”, and “No Installed Smart Apps”… Any tips?

EDIT: I added the Binder App from the top post, and @andyjenkinson’s DTH from 3 posts up. Still get the Tiles Missing message and unable to go anywhere from there.

OK, made a little progress. Set the type to OSRAM 4 Button Switch in the IDE, and config’d the SmartApp with assignments to 2 of my lights. The top-left button give me on, or brighten for a long press. The lower-left button works for off, or reduce brightness. The 2 right buttons don’t give any indication they’re doing anything. I do have the US version, so it looks like I’m getting the same behavior as the rest who have this one.

Hi @AnotherUser apols but having trouble adding through github integration.

In IDE i’m going to settings/add repository . How do i tell from what you’ve provided what the owner, name and branch are?

I guessed at AnotherUser17/SmartThingsPublic-1/master, went to update from repo, guessed which boxes from the list applied to this and checked them and i can now see the following

I then went to the smart apps tab and when i got to ‘update repository’ i saw ‘smartapps/AnotherUser/OsramLightify4xBinder.src/Osram_Lightify_4x_Binder.groovy’ at th top so i checked that, clicked publish and then 'execute update, but i got a message saying ‘Updated 0 and created 0 SmartApps, 0 published (1 skipped due to errors)’

Any help much appreciated!

Hi Milomolly,

Afraid I’ve not had much truck with IDE integration, the code published thus far is a first foray into ST, Groovy and GitHub. Andy above did some rework on pieces and may have a better steer on Git. I am currently travelling and so not really paying much attention to ST right now but I will probably revisit some of this over the Christmas break.

thanks @AnotherUser . @andyjenkinson can you help?

I didn’t do a smartapp to go with my device handler, I haven’t hooked the switch up to any actions yet, I’ve just been checking the logs to see what happens when the buttons are pressed, and the tiles in the ‘Things’ page for the switch update correctly.

I need to do some investigations into whether there are standard ways of binding buttons through other smart apps, or write my own.

One thing I will do though is update the device handler name to indicate EU version. I’m afraid I don’t have a US model to see what is happening when those buttons are pressed. I suggest to add some logging in the device handler and check the ZigBee spec to identify what is being sent. I did notice in AU’s handler not all of the supported clusters were bound, but I suspect the clusters are different for the US switch anyway. What is the fingerprint?

I’m not sure how to find the fingerprint, but I’d be happy to help dx the US version…

I currently get no response from buttons 3 or 4 in any of the logs in the IDE or the app. I’m currently running @andyjenkinson’s DTH from post #27, and @AnotherUser’s app from post #1.

My DTH is not designed to go with the smartapp, like i said I havent got that far. It likely doesnt send the events that the app is expecting.

The fingerprint is driven from the “raw description” in the device page in the IDE. Look in “My Devices”.

Yeah, I saw you mention that, but the button wouldn’t work at all (for me) w/o a smartapp, so I loaded that one up. I’m happy to pull it out if needed to do any testing.

Here’s what the raw description shows, if that’s helpful: 04 0104 0810 02 03 0000 1000 FD00 07 0003 0004 0005 0006 0008 0300 1000

OK looks like yours bound on endpoint 4, I would guess it’s not paired to my DTH as looking at doctor567’s post, the model name is different. I have added a fingerprint for it, so if your model name is “Switch 4x-LIGHTIFY” (in the device page ‘Data’ section), then I believe an update to the DTH (delete and re-add the device) may make it match. I’m afraid I don’t know if there are other differences in the way it behaves - it’s possible that it doesn’t send those hue and temperature events unless it is first configured in some way, for example. But at least you should be able to see events showing up in the live logs.

I have also updated the handler so that it should work with the Advanced Button Controller smartapp.

thanks. i guess i just need to check back later