Successfully paired Kudled Color Bulb (Chinese Hue A19 Bulb Copy Cat, $23) with Philips Hue Bridge

Thx for the links. Hope you can get this working. At $20 that’s a steal.

Hi @Kelvin_Kueh, do you mind sharing your code, for some reason I get below error when using the Zigbee Hue Bulb device handler. Thanks in advance.

Java.lang.IllegalArgumentException: Metadata definition not found

Hi Joe

Below is the Kudled color bulb device handler code

/**
 *  Copyright 2015 SmartThings
 *
 *  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.
 *
 */
/* Kudled (via Zigbee)

Capabilities:
  Actuator
  Color Control
  Configuration
  Polling
  Refresh
  Sensor
  Switch
  Switch Level
  
Custom Commands:
  setAdjustedColor
    
*/

metadata {
	definition (name: "Kudled Color Bulb", namespace: "KelvinKueh", author: "Kelvin.kueh@gmail.com") {
		capability "Switch Level"
		capability "Actuator"
		capability "Color Control"
		capability "Switch"
		capability "Configuration"
		capability "Polling"
		capability "Refresh"
		capability "Sensor"

		command "setAdjustedColor"

		fingerprint profileId: "C05E", inClusters: "0000,0003,0004,0005,0006,0008,0300,1000", outClusters: "0019"
	}

	// simulator metadata
	simulator {
		// status messages
		status "on": "on/off: 1"
		status "off": "on/off: 0"

		// reply messages
		reply "zcl on-off on": "on/off: 1"
		reply "zcl on-off off": "on/off: 0"
	}

	// UI tile definitions
	tiles {
		standardTile("switch", "device.switch", width: 1, height: 1, canChangeIcon: true) {
			state "on", label:'${name}', action:"switch.off", icon:"st.switches.switch.on", backgroundColor:"#79b821", nextState:"turningOff"
			state "off", label:'${name}', action:"switch.on", icon:"st.switches.switch.off", backgroundColor:"#ffffff", nextState:"turningOn"
			state "turningOn", label:'${name}', action:"switch.off", icon:"st.switches.switch.on", backgroundColor:"#79b821", nextState:"turningOff"
			state "turningOff", label:'${name}', action:"switch.on", icon:"st.switches.switch.off", backgroundColor:"#ffffff", nextState:"turningOn"
		}
		standardTile("refresh", "device.switch", inactiveLabel: false, decoration: "flat") {
			state "default", label:"", action:"refresh.refresh", icon:"st.secondary.refresh"
		}
		controlTile("rgbSelector", "device.color", "color", height: 3, width: 3, inactiveLabel: false) {
			state "color", action:"setAdjustedColor"
		}
		controlTile("levelSliderControl", "device.level", "slider", height: 1, width: 2, inactiveLabel: false) {
			state "level", action:"switch level.setLevel"
		}
		valueTile("level", "device.level", inactiveLabel: false, decoration: "flat") {
			state "level", label: 'Level ${currentValue}%'
		}
		controlTile("saturationSliderControl", "device.saturation", "slider", height: 1, width: 2, inactiveLabel: false) {
			state "saturation", action:"color control.setSaturation"
		}
		valueTile("saturation", "device.saturation", inactiveLabel: false, decoration: "flat") {
			state "saturation", label: 'Sat ${currentValue}    '
		}
		controlTile("hueSliderControl", "device.hue", "slider", height: 1, width: 2, inactiveLabel: false) {
			state "hue", action:"color control.setHue"
		}

		main(["switch"])
		details(["switch", "levelSliderControl", "rgbSelector", "refresh"])
	}
}

// Parse incoming device messages to generate events
def parse(String description) {
	//log.trace description
	if (description?.startsWith("catchall:")) {
		def msg = zigbee.parse(description)
		//log.trace msg
		//log.trace "data: $msg.data"
	}
	else {
		def name = description?.startsWith("on/off: ") ? "switch" : null
		def value = name == "switch" ? (description?.endsWith(" 1") ? "on" : "off") : null
		def result = createEvent(name: name, value: value)
		log.debug "Parse returned ${result?.descriptionText}"
		return result
	}
}

def on() {
	// just assume it works for now
	log.debug "on()"
	sendEvent(name: "switch", value: "on")
	"st cmd 0x${device.deviceNetworkId} 0x0B 6 1 {}"
}

def off() {
	// just assume it works for now
	log.debug "off()"
	sendEvent(name: "switch", value: "off")
	"st cmd 0x${device.deviceNetworkId} 0x0B 6 0 {}"
}

def setHue(value) {
	def max = 0xfe
	log.trace "setHue($value)"
	sendEvent(name: "hue", value: value)
	def scaledValue = Math.round(value * max / 100.0)
	def cmd = "st cmd 0x${device.deviceNetworkId} 0x0B 0x300 0x00 {${hex(scaledValue)} 00 0000}"
	//log.info cmd
	cmd
}

def setAdjustedColor(value) {
	log.debug "setAdjustedColor: ${value}"
	def adjusted = value + [:]
	adjusted.hue = adjustOutgoingHue(value.hue)
	adjusted.level = null // needed because color picker always sends 100
	setColor(adjusted)
}

def setColor(value){
	log.trace "setColor($value)"
	def max = 0xfe

	sendEvent(name: "hue", value: value.hue)
	sendEvent(name: "saturation", value: value.saturation)
	def scaledHueValue = Math.round(value.hue * max / 100.0)
	def scaledSatValue = Math.round(value.saturation * max / 100.0)

	def cmd = []
	if (value.switch != "off" && device.latestValue("switch") == "off") {
		cmd << "st cmd 0x${device.deviceNetworkId} 0x0B 6 1 {}"
		cmd << "delay 150"
	}

	cmd << "st cmd 0x${device.deviceNetworkId} 0x0B 0x300 0x00 {${hex(scaledHueValue)} 00 0000}"
	cmd << "delay 150"
	cmd << "st cmd 0x${device.deviceNetworkId} 0x0B 0x300 0x03 {${hex(scaledSatValue)} 0000}"

	if (value.level != null) {
		cmd << "delay 150"
		cmd.addAll(setLevel(value.level))
	}

	if (value.switch == "off") {
		cmd << "delay 150"
		cmd << off()
	}
	log.info cmd
	cmd
}

def setSaturation(value) {
	def max = 0xfe
	log.trace "setSaturation($value)"
	sendEvent(name: "saturation", value: value)
	def scaledValue = Math.round(value * max / 100.0)
	def cmd = "st cmd 0x${device.deviceNetworkId} 0x0B 0x300 0x03 {${hex(scaledValue)} 0000}"
	//log.info cmd
	cmd
}

def refresh() {
	"st rattr 0x${device.deviceNetworkId} 1 6 0"
}

def poll(){
	log.debug "Poll is calling refresh"
	refresh()
}

def setLevel(value) {
	log.trace "setLevel($value)"
	def cmds = []

	if (value == 0) {
		sendEvent(name: "switch", value: "off")
		cmds << "st cmd 0x${device.deviceNetworkId} 0x0B 6 0 {}"
	}
	else if (device.latestValue("switch") == "off") {
		sendEvent(name: "switch", value: "on")
	}

	sendEvent(name: "level", value: value)
    def level = hexString(Math.round(value * 255/100))
	cmds < 31) {
		if (percent < 63.0) {
			adjusted = percent + (7 * (percent -30 ) / 32)
		}
		else if (percent < 73.0) {
			adjusted = 69 + (5 * (percent - 62) / 10)
		}
		else {
			adjusted = percent + (2 * (100 - percent) / 28)
		}
	}
	log.info "percent: $percent, adjusted: $adjusted"
	adjusted
}
1 Like

Awesome! Thanks @Kelvin_Kueh, I let you know when it works out :slight_smile:

looking to get their zigbee wall switch next. To control the non smart ceiling lamps.

Pulling in a neutral will be a PITA tho. Will get an electrician to do the job

Not sure how it will work out.

1 Like

The $20 Kudled RGBW 9W bulb is able to pair with Philips hue bridge as extended color light !! :grinning:

2 Likes

Are these bulbs available in the states yet?

Can you share what you have to do to get the bulb to pair with the hue bridge?

It’s the same way you pair with hue bulb.

I am having trouble with pairing the RGB kunled bulb with either the hue bridge v1 or the smartthings v2 hub.

The bulb flashes red, green, blue, then back to red and repeat when power is applied. Does this indicate that the bulb is in paring mode?

No device was found when I tried to pair.

Thanks in advance,
Johnny

Try resetting the bulb, on/off, on/off, on/off, and it flashes a few times, then start detection.
I’m using hue bridge v2, ST v2, no issue with RGB.

@jakers102: My team just got off the phone with Kudled representatives and now we are being informed that the latest generation Kudled bulbs are compatible by default with the Philips Hue Bridges.

Background story:

I had bought a few Kudled bulbs in August 2015 and they were compatible with the Philips Hue Bridge 1.0, resulting in this original topic creation.

Then in November 2015 I had bought another batch of Kudled bulbs and they were NOT compatible with the Philips Hue Bridge 1.0.

We had connected with Kudled to ask for feedback and they indicated they were in discussions with Philips and were not allowed to produce compatible bulbs at the time.

Now (March 2016) they have informed us they are producing Kudled bulbs again which are by default compatible with Philips Hue Bridges 1.0 and 2.0…

As the ZigBee protocol is open, Kudled is to my understanding allowed to make bulbs which use the same frequency as original Philips Hue Bulbs, however Philips can still theoretically block syncing / pairing via their App and I believe Philips officially created a Friends of Hue program to properly integrate non-Hue bulbs with the Philips Hue Bridges.

Conclusion:
I think, but I am not sure that you @jakers102 may have a Kudled bulb from an older batch whereas @hongtat may have a Kudled bulb from a new batch…

1 Like

Thanks for the insight , Chun.
I am guessing there is no obvious way to tell if a kudled bulb is from the old or new batch. And am I safe to assume when the bulb is flashing red, green, blue, that the bulb is in paring mode already?

Johnny

Yes, when you turn the bulb on/off quickly several times it will go into the flashing red, green, blue mode which is it’s pairing mode, at least from my personal experience and I believe hongtat indicated the same.

I’m having the same problem as @jakers102 :(. I have a Hue Bridge V2 and Smartthings V2 hub.

Just bought one off of aliexpress for $25.50. I hope its compatible. It was listed as zigbee light link so I believe it will work.

Let us know us know how they work @2l82try1

I will for sure. Shipping is about 30 days to Canada. Stay tuned.

I bought 2 RGB Kudled from aliexpress for $18 each, both still won’t connect. Per @Chun I might have gotten a set that is not compatible with Hue Bridge V2.

I also got 2 Kudled soft white to daylight, one worked great the other one would not connect to my smartthings v2. :slight_smile:

you have to check carefully with the seller.

Kudled stocks two RGB bulbs.

One is Zigbee, the other is proprietary 2.4Ghz.

Same goes for the handheld remote. There are 2 variants.

1 Like