[UPDATED] Osram Lightify RGBW A19/BR30 US version (HA) DTH

@gkl_sf
I have been playing around with the DTH trying to see if I can set the default values. I am able to successfully set the startup default color to Daylight (my preferred 5000K) for 4 bulbs, but when I am trying to set it for 2 more, I havent been able to replicate the same. While I am trying to debug, I noticed that there are few warning messages in the log:

Received invalid data for type. AttrId: 0x0000, Type: 20, Value: ff
Parse description read attr - raw: 091103000808000020FF, dni: 0911, endpoint: 03, cluster: 0008, size: 08, attrId: 0000, encoding: 20, value: ff

I am not sure at this point in time if that is causing an issue or not, but I thought I could see if you have any insight into this error. This happens only when restarting from the switch. I tried to remove and re-add the bulbs but the issue remained, Don’t see the same with the other bulbs. Any help would be appreciated.

Update:

I reset the 2 bulbs I was having trouble with, connected them to Osram Gateway, but even Osram cant set the default start up color for these 2 bulbs. :frowning: Sent a request to Osram support and hoping to get it resolved by them.

I am able to test 2 A19 bulbs and am able to set the default values. So, both A19 & BR30 are tested to be working.

If anyone is interested in testing the code for me, please let me know and I will provide instructions.

So what is the “configure” button for? It appears to do nothing when I tap it.

As in most DTHs, “Configure” sets up the device to report its status to ST/DTH. If the device is reset, “Configure” needs to be tapped to set-up the status reporting.

I’ve had that problem with a few bulbs. They are on the latest firmware, but they act like they’re not. Osram warrantied them and sent replacements. I’ll be happy to test your code! I switched from the Osram hub to ST and really miss the default settings :slight_smile: Thanks!

@neod192

Please try this handler and let me know if this works for you.

Just update the handler for the device, set the color/brightness to what ever you want, wait for few seconds, then hit the set default button.

I have a 3 min delay for the set default as it seems to take quite a bit of time to set it. Do not switch off or try to use the bulbs for 5 mins after pushing the set default button.

After that, you can try switching on and off to see if the behavior worked. You may revert back to any handler you were using previously.

import physicalgraph.zigbee.zcl.DataType

metadata {
    definition (name: "Yet Another Osram RGBW", namespace: "ranga", author: "Ranga Pedamallu") {

        capability "Actuator"
        capability "Color Control"
        capability "Color Temperature"
        capability "Configuration"
        capability "Polling"
        capability "Refresh"
        capability "Switch"
        capability "Switch Level"
        capability "Health Check"
        capability "Light"

        attribute "colorName", "string"
        command "setGenericName"
        command "defaultColor"

        fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0008,0300,0B04,FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY Flex RGBW", deviceJoinName: "SYLVANIA Smart Flex RGBW"
        fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0008,0300,0B04,FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "Flex RGBW", deviceJoinName: "OSRAM LIGHTIFY Flex RGBW"
        fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0008,0300,0B04,FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY A19 RGBW", deviceJoinName: "SYLVANIA Smart A19 RGBW"
        fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0008,0300,0B04,FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY BR RGBW", deviceJoinName: "SYLVANIA Smart BR30 RGBW"
        fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0008,0300,0B04,FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY RT RGBW", deviceJoinName: "SYLVANIA Smart RT5/6 RGBW"
        fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0008,0300,0B04,FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY FLEX OUTDOOR RGBW", deviceJoinName: "SYLVANIA Smart Outdoor RGBW Flex"
    }

    // UI tile definitions
    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.lights.philips.hue-single", backgroundColor:"#79b821", nextState:"turningOff"
                attributeState "off", label:'${name}', action:"switch.on", icon:"st.lights.philips.hue-single", backgroundColor:"#ffffff", nextState:"turningOn"
                attributeState "turningOn", label:'${name}', action:"switch.off", icon:"st.lights.philips.hue-single", backgroundColor:"#79b821", nextState:"turningOff"
                attributeState "turningOff", label:'${name}', action:"switch.on", icon:"st.lights.philips.hue-single", backgroundColor:"#ffffff", nextState:"turningOn"
            }
            tileAttribute ("device.level", key: "SLIDER_CONTROL") {
                attributeState "level", action:"switch level.setLevel"
            }
            tileAttribute ("device.color", key: "COLOR_CONTROL") {
                attributeState "color", action:"color control.setColor"
            }
        }
        controlTile("colorTempSliderControl", "device.colorTemperature", "slider", width: 4, height: 2, inactiveLabel: false, range:"(2700..6500)") {
            state "colorTemperature", action:"color temperature.setColorTemperature"
        }
        valueTile("colorName", "device.colorName", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
            state "colorName", label: '${currentValue}'
        }
        standardTile("refresh", "device.refresh", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
            state "default", label:"", action:"refresh.refresh", icon:"st.secondary.refresh"
        }
        standardTile("setDefaultColor", "device.defaultColorVal", decoration: "flat", width: 2, height: 2) {
            state "default", label:'Set Default', action: "defaultColor", icon: "st.Lighting.light13"
        }

        main(["switch"])
        details(["switch", "colorTempSliderControl", "colorName", "refresh", "setDefaultColor"])
    }
}

//Globals
private getATTRIBUTE_HUE() { 0x0000 }
private getATTRIBUTE_SATURATION() { 0x0001 }
private getHUE_COMMAND() { 0x00 }
private getSATURATION_COMMAND() { 0x03 }
private getCOLOR_CONTROL_CLUSTER() { 0x0300 }
private getATTRIBUTE_COLOR_TEMPERATURE() { 0x0007 }

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

    def event = zigbee.getEvent(description)
    if (event) {
        log.debug event
        if (event.name=="level" && event.value==0) {}
        else {
            if (event.name=="colorTemperature") {
                setGenericName(event.value)
            }
            sendEvent(event)
        }
    }
    else {
        def zigbeeMap = zigbee.parseDescriptionAsMap(description)
        def cluster = zigbee.parse(description)

        if (zigbeeMap?.clusterInt == COLOR_CONTROL_CLUSTER) {
            if(zigbeeMap.attrInt == ATTRIBUTE_HUE){  //Hue Attribute
                def hueValue = Math.round(zigbee.convertHexToInt(zigbeeMap.value) / 255 * 100)
                sendEvent(name: "hue", value: hueValue, descriptionText: "Color has changed")
            }
            else if(zigbeeMap.attrInt == ATTRIBUTE_SATURATION){ //Saturation Attribute
                def saturationValue = Math.round(zigbee.convertHexToInt(zigbeeMap.value) / 255 * 100)
                sendEvent(name: "saturation", value: saturationValue, descriptionText: "Color has changed", displayed: false)
            }
        }
        else if (cluster && cluster.clusterId == 0x0006 && cluster.command == 0x07) {
            if (cluster.data[0] == 0x00){
                log.debug "ON/OFF REPORTING CONFIG RESPONSE: " + cluster
                sendEvent(name: "checkInterval", value: 60 * 12, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID])
            }
            else {
                log.warn "ON/OFF REPORTING CONFIG FAILED- error code:${cluster.data[0]}"
            }
        }
        else {
            log.info "DID NOT PARSE MESSAGE for description : $description"
            log.debug zigbeeMap
        }
    }
}

def on() {
    zigbee.on()
}

def off() {
    zigbee.off()
}
/**
 * PING is used by Device-Watch in attempt to reach the Device
 * */
def ping() {
    return zigbee.onOffRefresh()
}

def refresh() {
    zigbee.onOffRefresh() + zigbee.levelRefresh() + zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_COLOR_TEMPERATURE) + zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_HUE) + zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_SATURATION) + zigbee.onOffConfig(0, 300) + zigbee.levelConfig() + zigbee.colorTemperatureConfig() + zigbee.configureReporting(COLOR_CONTROL_CLUSTER, ATTRIBUTE_HUE, DataType.UINT8, 1, 3600, 0x01) + zigbee.configureReporting(COLOR_CONTROL_CLUSTER, ATTRIBUTE_SATURATION, DataType.UINT8, 1, 3600, 0x01)
}

def configure() {
    log.debug "Configuring Reporting and Bindings."
    // Device-Watch allows 2 check-in misses from device + ping (plus 1 min lag time)
    // enrolls with default periodic reporting until newer 5 min interval is confirmed
    sendEvent(name: "checkInterval", value: 2 * 10 * 60 + 1 * 60, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID])

    // OnOff minReportTime 0 seconds, maxReportTime 5 min. Reporting interval if no activity
    refresh()
}

def setColorTemperature(value) {
    setGenericName(value)
    zigbee.setColorTemperature(value)
}

//Naming based on the wiki article here: http://en.wikipedia.org/wiki/Color_temperature
def setGenericName(value){
    if (value != null) {
        def genericName = "White"
        if (value < 3300) {
            genericName = "Soft White"
        } else if (value < 4150) {
            genericName = "Moonlight"
        } else if (value <= 5000) {
            genericName = "Cool White"
        } else if (value >= 5000) {
            genericName = "Daylight"
        }
        sendEvent(name: "colorName", value: genericName)
    }
}

def setLevel(value) {
    zigbee.setLevel(value)
}

def setColor(value){
    log.trace "setColor($value)"
    zigbee.on() + setHue(value.hue) + "delay 300" + setSaturation(value.saturation)
}

def setHue(value) {
    def scaledHueValue = zigbee.convertToHexString(Math.round(value * 0xfe / 100.0), 2)
    zigbee.command(COLOR_CONTROL_CLUSTER, HUE_COMMAND, scaledHueValue, "00", "0500")       //payload-> hue value, direction (00-> shortest distance), transition time (1/10th second) (0500 in U16 reads 5)
}

def setSaturation(value) {
    def scaledSatValue = zigbee.convertToHexString(Math.round(value * 0xfe / 100.0), 2)
    zigbee.command(COLOR_CONTROL_CLUSTER, SATURATION_COMMAND, scaledSatValue, "0500") + "delay 1000" + zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_SATURATION)
}

def installed() {
    if (((device.getDataValue("manufacturer") == "MRVL") && (device.getDataValue("model") == "MZ100")) || (device.getDataValue("manufacturer") == "OSRAM SYLVANIA") || (device.getDataValue("manufacturer") == "OSRAM")) {
        if ((device.currentState("level")?.value == null) || (device.currentState("level")?.value == 0)) {
            sendEvent(name: "level", value: 100)
        }
    }
}

def defaultColor() {
	log.info "Setting default color"
    def cmds = 
    [
    "st cmd 0x${device.deviceNetworkId} ${device.endpointId} 0xFC0F 0x01 {}", "delay 180000"
    ]
    return cmds + refresh()
}
2 Likes

Wow thank you for this. It worked great! I changed all 6 if my bulbs over to it and then changed their default on color to daylight (6500K), waited a few minutes, then switched the handlers back to the built-in zigbee RGBW bulb device handler.

Now they all turn right on to a nice proper white when I use the switch, no more of the ugly incandescent yellow they have by default.

Curious, this device handler is very different than the one in the OP. What did you base it off of?

Good to hear it works for you. I used the built-in zigbee device handler as the base.

Once the defaults are set, you can use any device handler.

@gkl_sf, let me know if you are interested in adding this to your DTH as well, so there’s no need to switch device handlers.

I can add the defaultColor() method and a standardTile for it. Are there any other changes required to implement it?

Thank you.

That is all needed at this point. And please mention the steps as the process takes time and any interruptions may cause it to fail for future tries as well. Thanks!

All set. (Had to update my bulb firmware for it to work.)

Default settings worked like a charm. Thanks guys !!!

I can’t seem to get GH to change my A19 Tunable White from Daylight to Soft White or vice a versa. GH complains"Looks like that device hasn’t been set up yet in Home". The bulb is set up in Home Control. Alexa doesn’t have a problem changing color temperature. I have to say "Alexa change Office Light to Daylight,Soft White…

I also have the Osram Lightify RGBW BR30, not an issue with GH or Alexa changing color or temperature.

I tried removing and readding the A19 from SMH and Home, same results.

@gkl_sf, I’m trying to enable the GitHub integration for your Osram device handler, I added the repository, but it can’t seem to find the handler in the repository. Here’s what I see under My Device Handlers

It’s acting as if the repository isn’t available, but I can see it here: https://github.com/gkl-sf/SmartThings. I’m probably doing something wrong (but the same steps worked with other device handlers). Any ideas?

PS. I’m looking for an app/handler to group Osram bulbs and still have the same controls as your handler - does anything like that exist?

1 Like

He doesn’t have it in the correct GitHub structure required for integration, so you can’t use the integration feature.

The best thing I have found for grouping bulbs is trendsetter. The author of that doesn’t have it in the correct GitHub structure so don’t expect integration to work their either.

Just realize a lot of these device handler authors do not use the integration so they have no interest in following the smartthings rules in that regard. You will just have to update those manually.

1 Like

@jbeck21, Any pointers? I just went into Core to try.
First choice, on Any change of Color Control, <can’t set that>.
Second choice, on any change of Color Temp,
I bet I am missing something easy, I searched, but still no clue.
Is there a search term I should use? Particular thread?

Thanks for a great DH! Works pretty well “for ME” except for the Defaults.

I appreciate that the DH is not written for the EU bulbs so please tell me to do one however any advice is appreciated…
Has anyone managed to get the EU bulbs to set Default please? namely, the A60 RGBW bulbs. I have tried pretty much everything. Had a good search but cannot find any other DH’s specifically for the EU bulbs that allow Defaults to be set so perhaps it is not possible of course. I have also tried @ranga’s code listed above without success.

Strangely, when turning the bulb on and off within ST, I get absolutely nothing in the log yet it does as requested. Changing brightness etc. does show up in the log.

When hitting the default button I get the below in the log;

xxxxxxxxx 19:48:33: debug *** unparsed response: [raw:0104 0008 03 01 0040 00 836E 00 00 0000 04 01 00, profileId:0104, clusterId:0008, sourceEndpoint:03, destinationEndpoint:01, options:0040, messageType:00, dni:836E, isClusterSpecific:false, isManufacturerSpecific:false, manufacturerId:0000, command:04, direction:01, data:[00], clusterInt:8, commandInt:4]
xxxxxxxxx 19:48:32: debug *** received Configure Reporting response: [34, 00]
xxxxxxxxx 19:48:25: debug *** unparsed response: [raw:0104 0300 03 01 0040 00 836E 00 00 0000 07 01 89000700, profileId:0104, clusterId:0300, sourceEndpoint:03, destinationEndpoint:01, options:0040, messageType:00, dni:836E, isClusterSpecific:false, isManufacturerSpecific:false, manufacturerId:0000, command:07, direction:01, data:[89, 00, 07, 00], clusterInt:768, commandInt:7]
xxxxxxxxx 19:48:23: debug *** unparsed response: [raw:0104 FC0F 03 01 0040 00 836E 00 00 0000 0B 01 0481, profileId:0104, clusterId:FC0F, sourceEndpoint:03, destinationEndpoint:01, options:0040, messageType:00, dni:836E, isClusterSpecific:false, isManufacturerSpecific:false, manufacturerId:0000, command:0B, direction:01, data:[04, 81], clusterInt:64527, commandInt:11]
xxxxxxxxx 19:48:23: info Setting default color.

Thanks!

@chippie,

You may already know this, but Osram uses a different firmware for EU bulbs. It is Zigbee HLL & not Zigbee HA. I dont have access to one and so I probably cant help much. But can you send me the fingerprint data for the bulb and I will try to see if there is something obvious.

@ranga

Thanks for the reply!

I was not aware of this so thank you, admittedly I purchased the bulb and hub about a year ago if not longer (when they were released here) used it once and back in the box forgotten. Just dug it out and updated the f/w etc. to make use of it in a side lamp. I even forgot it was RGBW lol so that was a nice surprise. Anyway, enough babble and please excuse my ignorance but what is the fingerprint data? Thanks again!

i’ve added custom code to my dashboard before but for some reason when i go to

my smartapps
new smartapp
from code - then paste the raw code

i get the following error:

No signature of method: script1500079830306461706260.metadata() is applicable for argument types: (script1500079830306461706260$_run_closure1) values: [script1500079830306461706260$_run_closure1@5f2ec581] Possible solutions: getMetadata(), getState(), setState(java.lang.Object), metaClass(groovy.lang.Closure)

any idea what i’m doing wrong?