Solved: osram lightify plug (switch) working (zigbee, non dimmable) [ALPHA]

Bought the OSRAM LIGHTIFY SWITCH on Amazon in Germany to use with ST. Didn’t work, just shows up as a greyed out “Thing”. Community said it probably couldn’t be done.

I grabbed a Zigbee example code from ST and tweaked it just a little bit and now my switch works. Wanted to share. Disclaimer: I have not coded in 20 years, I have no idea how the Zigbee protocol works, and I have no clue about the ST API. So I have no doubt that the code here is bonkers. Maybe someone who actually knows this stuff should clean it up :slight_smile:

/**
*  Copyright 2015 SmartThings
*  Adapted by Michael Seifert for the Osram Switch (NOT the dimmer).
*
*  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: "ZigBee Dimmer", namespace: "smartthings", author: "SmartThings") {
definition (name: "ZigBee Switch", namespace: "smartthings", author: "Seifert") {
        capability "Actuator"
        capability "Configuration"
        capability "Refresh"
        capability "Switch"

        fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008"
        fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0B04, FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY SWITCH ON/OFF", deviceJoinName: "OSRAM LIGHTIFY SWITCH"
        fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, FF00", outClusters: "0019", manufacturer: "MRVL", model: "MZ100", deviceJoinName: "Wemo Bulb"
        fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0B05", outClusters: "0019", manufacturer: "OSRAM SYLVANIA", model: "iQBR30", deviceJoinName: "Sylvania Ultra iQ"
    }

    tiles(scale: 2) {
        multiAttributeTile(name:"switch", type: "lighting", width: 6, height: 4, canChangeIcon: true){
            tileAttribute ("device.switch", key: "PRIMARY_CONTROL") {
                attributeState "on", label:'${name}', action:"switch.off", icon:"st.switches.light.on", backgroundColor:"#79b821", nextState:"turningOff"
                attributeState "off", label:'${name}', action:"switch.on", icon:"st.switches.light.off", backgroundColor:"#ffffff", nextState:"turningOn"
                attributeState "turningOn", label:'${name}', action:"switch.off", icon:"st.switches.light.on", backgroundColor:"#79b821", nextState:"turningOff"
                attributeState "turningOff", label:'${name}', action:"switch.on", icon:"st.switches.light.off", backgroundColor:"#ffffff", nextState:"turningOn"
            }
        }
        standardTile("refresh", "device.switch", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
            state "default", label:"", action:"refresh.refresh", icon:"st.secondary.refresh"
        }
        main "switch"
        details(["switch", "refresh"])
    }
}

// Parse incoming device messages to generate events
def parse(String description) {
    log.debug "description is $description"

    def event = zigbee.getEvent(description)
    if (event) {
        sendEvent(event)
    }
    else {
        log.warn "DID NOT PARSE MESSAGE for description : $description"
        log.debug zigbee.parseDescriptionAsMap(description)
    }
}

def off() {
    zigbee.off()
}

def on() {
    zigbee.on()
}

def refresh() {
    return zigbee.readAttribute(0x0006, 0x0000) +
        zigbee.readAttribute(0x0008, 0x0000) +
        zigbee.configureReporting(0x0006, 0x0000, 0x10, 0, 600, null) +
        zigbee.configureReporting(0x0008, 0x0000, 0x20, 1, 3600, 0x01)
}

def configure() {
    log.debug "Configuring Reporting and Bindings."

    return zigbee.configureReporting(0x0006, 0x0000, 0x10, 0, 600, null) +
        zigbee.configureReporting(0x0008, 0x0000, 0x20, 1, 3600, 0x01) +
        zigbee.readAttribute(0x0006, 0x0000) +
        zigbee.readAttribute(0x0008, 0x0000)
}
2 Likes

Could you provide a link to the Amazon page for the switch so people can see which model it is? I believe the four button model is only available in Europe, while the two button dimmer switch ( for which there are several existing device type handlers) is available in the US.

http://www.zigbee.org/osram-sylvania-continues-to-lead-smart-home-market-with-industry-first-lightify-solutions-at-ces/

Here it is (had to buy it on Amazon in Germany to fit with normal Europe style plugs - the UK ones dont match…)

1 Like

That explains it, they’ve changed the name to plug instead of switch. Some community members were able to get it working with the generic zigbee DTH.

Hi Michael

thanks for sharing your DTH. I bought an Osram Plug which was recognized as an unknown device. Changed the device type to generic “ZigBee Switch” and it just works.

Could you explain what’s different/better when using your custom DTH?

Thanks,
Jan

Be aware that this plug is a horrible repeater. Hopefully you have a newer firmware which might have fixed this issue.
As a switch/plug it works flawlessly though.
You can also try the “Zigbee Switch Power” type.

“Zigbee Switch Power” doesn’t seem to report correct values for power usage - “2800 W” when turned of and “40 W” when turned on (which is definitely not correct).

I also tried the custom DTH from mseifert. Doesn’t seem different compared to the generic DTH.

@Rinke: SmartThings reports the following firmware version for the plug: 0x01020412 - which one do you have?

I have the same firmware. I know there is a newer version, seems to be a bit better of what i’ve heard. But i don’t want to buy an Osram Hub just to test this.
The issue starts after a day of rest. It seems to be in a state of sleep. It receives messages but not forward them anymore.
I have abandoned the Osram plugs because of its bad repeating.

I have one of these switches, but it’s only been running for less than 24 hours. Haven’t had any issues (yet). I don’t have a Lightify bridge either, so I can’t do a firmware update.

Does this mean that the Osram ZigBee Plug will become some kind of “death thrap” for commands directed to other devices, so these command will just disappear and never get delivered?

I still have a couple of days to return the plug.

Basically yes, in my experience.It doesn’t happen strait away, but after some time of silence, a day or so. I haven’t found the exact moment when it stops sending. It still responds to the messages which are sent from the hub. It simply stops sending messages received from a sensor.
I have only tested this with small battery operated devices like sensors though.

It’s a shame though, because i really liked this Plug. It’s well built and looks nice.

I bought two Osram Lightify Plugs from Amazon DE this week, and was expecting to get them working with the device handlers on this page (and others), but it was not so easy.

The first Plug I connected to my Hue hub, and I can control it just fine with the Hue app and other Hue hardware, but I cannot import the device into SmartThings because the Hue Connect SmartApp does not recognize the On/Off Switch device as a valid Hue bulb. So I need to do some more digging in getting that working.

The second plug I decided to connect directly to the ST hub, and after quite a bit of reading up on Zigbee device fingerprinting, I got it working with an edited version of the code above. The thing was indeed that my Plug is configured as a Zigbee LightLink (ZLL) switch, and not the ZHA version for which the code above was written. A bit confusing since Michael also fairly recently bought the Plug from Amazon DE.

My Plugs were already at the most recent firmware version out of the box, so they are pretty recently produced.

To help other people out, here is the slightly edited version of the sample code @mseifert wrote earlier:

/**
*  Copyright 2015 SmartThings
*  Adapted by Arnoud Helmantel (original by Michael Seifert) for the Osram Lightify Plug (EU version, Zigbee LightLink version).
*
*  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: "OSRAM Lightify Plug EU", namespace: "", author: "Arnoud Helmantel") {
        capability "Actuator"
        capability "Configuration"
        capability "Refresh"
        capability "Switch"

        fingerprint profileId: "C05E", inClusters: "0000, 0003, 0004, 0005, 0006, 0B04, FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "Plug 01", deviceJoinName: "OSRAM Lightify Plug"
     }

    tiles(scale: 2) {
        multiAttributeTile(name:"switch", type: "lighting", width: 6, height: 4, canChangeIcon: true){
            tileAttribute ("device.switch", key: "PRIMARY_CONTROL") {
                attributeState "on", label:'${name}', action:"switch.off", icon:"st.Appliances.appliances17-icn", backgroundColor:"#79b821", nextState:"turningOff"
                attributeState "off", label:'${name}', action:"switch.on", icon:"st.Appliances.appliances17-icn", backgroundColor:"#ffffff", nextState:"turningOn"
                attributeState "turningOn", label:'${name}', action:"switch.off", icon:"st.Appliances.appliances17-icn", backgroundColor:"#79b821", nextState:"turningOff"
                attributeState "turningOff", label:'${name}', action:"switch.on", icon:"st.Appliances.appliances17-icn", backgroundColor:"#ffffff", nextState:"turningOn"
            }
        }
        standardTile("refresh", "device.switch", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
            state "default", label:"", action:"refresh.refresh", icon:"st.secondary.refresh"
        }
        main "switch"
        details(["switch", "refresh"])
    }
}

// Parse incoming device messages to generate events
def parse(String description) {
    log.debug "description is $description"

    def event = zigbee.getEvent(description)
    if (event) {
        sendEvent(event)
    }
    else {
        log.warn "DID NOT PARSE MESSAGE for description : $description"
        log.debug zigbee.parseDescriptionAsMap(description)
    }
}

def off() {
    zigbee.off()
}

def on() {
    zigbee.on()
}

def refresh() {
    return zigbee.readAttribute(0x0006, 0x0000) +
        zigbee.readAttribute(0x0008, 0x0000) +
        zigbee.configureReporting(0x0006, 0x0000, 0x10, 0, 600, null) +
        zigbee.configureReporting(0x0008, 0x0000, 0x20, 1, 3600, 0x01)
}

def configure() {
    log.debug "Configuring Reporting and Bindings."

    return zigbee.configureReporting(0x0006, 0x0000, 0x10, 0, 600, null) +
        zigbee.configureReporting(0x0008, 0x0000, 0x20, 1, 3600, 0x01) +
        zigbee.readAttribute(0x0006, 0x0000) +
        zigbee.readAttribute(0x0008, 0x0000)
}

The biggest change are the change of the fingerprint part and I changed the default icon to a wall socket. And provided with the same caveat as Michael did: the code is probably not pretty, but it works for me, and I hope it helps someone to get these plugs working.

1 Like

How do I get this code connected? My smart things hub can’t find the switch