Hi Armin (Cleo) & All,
I was struggling with exactly the same problem with a Philips Hue bulb in the last 2 days and it took me some time to sort out the workaround, that’s why I profit from this thread to share what I did as workaround as well as my concern that there may be a more fundamental bug somewhere.
My Hue bulb of model 929002469202 (No color - only dimmer) is correctly recognized in Zigbee2mqtt and works, but openhab 3.4 also only discovers the channels of limited use (Link quality, Last seen, update …) but nothing to control the bulb. For test purposes I tested with version 3.3 … and there it discovers additionally a color channel but as trigger (as the title of this thread suggests) - hence also useless as there can be no item created from this. The latest 4.0 snapshot behaves by the way the same as 3.4.
Reading around I found a couple of threads which all stalled with the same conclusion (or workaround) “configure all channels manually” what is however not trivial for a newcomer, especially as some of the procedures are related to the file-based configuration.
What helped me most was finally the article HomeAssistant MQTT Component: RGBW Color channel set to trigger and especially the YAML code in the article. Based on this did the following:
- I created a generic MQTT thing via the web interface
- Went to the code tab of the thing and added channels based on the template in the article
Critical is to go in and edit manually the “commandTopic” and “stateTopic” to fit the own installation but to honor the bridge and to adopt the code the kind of bulb - in my case I did not even need javascript code as this bulb has a fixed color. I ended up with the following code:
UID: mqtt:topic:cad71c3aff:aabdc659aa
label: LED Salle à manger
thingTypeUID: mqtt:topic
configuration:
payloadNotAvailable: offline
payloadAvailable: online
transformationPattern: JSONPATH:$.state
availabilityTopic: zigbee2mqtt/LED SaM/availability
bridgeUID: mqtt:broker:cad71c3aff
channels:
- id: status
channelTypeUID: mqtt:switch
label: State
description: null
configuration:
retained: false
postCommand: false
formatBeforePublish: '{"state": "%s"}'
commandTopic: zigbee2mqtt/LED SaM/set
stateTopic: zigbee2mqtt/LED SaM
transformationPattern: JSONPATH:$.state
off: OFF
on: ON
- id: brightness
channelTypeUID: mqtt:dimmer
label: Brightness
description: null
configuration:
retained: false
postCommand: false
min: 0
formatBeforePublish: '{"brightness": %s}'
max: 254
commandTopic: zigbee2mqtt/LED SaM/set
step: 1
stateTopic: zigbee2mqtt/LED SaM
transformationPattern: JSONPATH:$.brightness
off: "0"
on: "1"
- id: link_quality
channelTypeUID: mqtt:number
label: Link Quality
description: null
configuration:
retained: false
postCommand: false
min: 0
formatBeforePublish: "%s"
max: 255
step: 1
stateTopic: zigbee2mqtt/LED SaM
transformationPattern: JSONPATH:$.linkquality
Now my bulb works in openhab and I was able to add the items into the model …
Now for my concern: Looking at other reports I wonder if there not something more general broken with the discovery of certain zigbee bulbs connected over zigbee2mqtt and how widespread the issue is. My main concern is that the user experience would be better with auto-discovery.
One of the article above refers to the documentation on the MQTT HomeAssistant Binding which indeed states that the binding has some limitations - but I’d expect that the supported interfaces on/off & brightness work in my case (The bulb also has effects which are mentioned as not fully supported - but which are anyhow more exotic)
I really wonder what could be done to track this down (maybe a github ticket on the homeassistant integration) ? I am quite new to openhab and this is also my first zigbee bulb so that I do not know for sure if it is a known limitation, a bug or user-mistake on my end (I played already with the zigbee2mqtt config but without success). Adding manually common things as bulbs is for sure not the best user experience, so that I consider the proposals for manual configuration or to purchase a dedicated hub for Philips bulbs more as a workaround than a solution.