Hi, thanks for sharing this discovery.
I made it works with an Aqara white bulb (ZNLDP12LM) and a Mijia switch (WXKG01LM), here is my config files and a simple rule if it can help.
test.things :
Bridge mqtt:broker:broker "MQTT Broker" [ host="127.0.0.1", clientid="OpenHab" ]
{
Thing topic 0x00158d0002c67ab4 "Bulb_aquara"
{
Channels:
Type switch : state "state" [ stateTopic = "zigbee2mqtt/0x00158d0002c67ab4/state", commandTopic = "zigbee2mqtt/0x00158d0002c67ab4/set/state", on="ON", off="OFF" ]
Type dimmer : brightness "brightness" [ stateTopic = "zigbee2mqtt/0x00158d0002c67ab4/brightness", commandTopic = "zigbee2mqtt/0x00158d0002c67ab4/set/brightness", min=0, max=255, step=1 ]
Type dimmer : color_temp "color_temp" [ stateTopic = "zigbee2mqtt/0x00158d0002c67ab4/color_temp", commandTopic = "zigbee2mqtt/0x00158d0002c67ab4/set/color_temp", min=150, max=500, step=1 ]
Type number : linkquality "linkquality" [ stateTopic = "zigbee2mqtt/0x00158d0002c67ab4/linkquality" ]
}
Thing topic 0x00158d00015aa9b5 "Switch_mijia"
{
Channels:
Type string : click "click" [ stateTopic = "zigbee2mqtt/0x00158d00015aa9b5/click" ]
Type number : voltage "voltage" [ stateTopic = "zigbee2mqtt/0x00158d00015aa9b5/voltage" ]
Type number : battery "battery" [ stateTopic = "zigbee2mqtt/0x00158d00015aa9b5/battery" ]
Type number : linkquality "linkquality" [ stateTopic = "zigbee2mqtt/0x00158d00015aa9b5/linkquality" ]
}
}
test.items :
Group gAll
Switch Bulb_aquara_state "Bulb [%s]" <light> (gAll) {channel="mqtt:topic:broker:0x00158d0002c67ab4:state"}
Dimmer Bulb_aquara_brightness "Bulb brightness [%d]" (gAll) {channel="mqtt:topic:broker:0x00158d0002c67ab4:brightness"}
Dimmer Bulb_aquara_color_temp "Bulb color_temp [%d]" (gAll) {channel="mqtt:topic:broker:0x00158d0002c67ab4:color_temp"}
Number Bulb_aquara_linkquality "Bulb linkquality [%d]" (gAll) {channel="mqtt:topic:broker:0x00158d0002c67ab4:linkquality"}
String Switch_mijia_click "Button [%s]" <button> (gAll) {channel="mqtt:topic:broker:0x00158d00015aa9b5:click"}
Number Switch_mijia_voltage "Button Volt [%d mV]" (gAll) {channel="mqtt:topic:broker:0x00158d00015aa9b5:voltage"}
Number Switch_mijia_battery "Button bat [%.1f %%]" <battery> (gAll) {channel="mqtt:topic:broker:0x00158d00015aa9b5:battery"}
Number Switch_mijia_linkquality "Button linkquality [%d]" (gAll) {channel="mqtt:topic:broker:0x00158d00015aa9b5:linkquality"}
test.rules :
rule "Turn on light from button"
when
Item Switch_mijia_click received update single
then
logInfo("broker trigger debug", "triggered single clic")
sendCommand(Bulb_aquara_state, OFF)
end
rule "Turn off light from button"
when
Item Switch_mijia_click received update double
then
logInfo("broker trigger debug", "triggered double clic")
sendCommand(Bulb_aquara_state, ON)
end
I’m not satisfied with the way I managed brightness
and color_temp
, if someone has a better way…
@the.neon I’ll try with a colored bulb soon (I have a spare Hue), but reading the code, it looks like the payload is only RGB value subPayload = [subPayload.r, subPayload.g, subPayload.b];
so you should send something like 100,0,102
and not 255,0,0,255
?
Not sure but in doubt I will also try something like this zigbee2mqtt/0x00124b001ba703f8/set/state/color/hex #547CFF
An other question is how can we change the transition time (see transition
here https://github.com/Koenkk/zigbee2mqtt.io/blob/351f24ce4a77ceae7a0fc22c436fa710a64e4b1e/docs/information/mqtt_topics_and_message_structure.md#zigbee2mqttfriendly_nameset) as the payload is not a JSON anymore…