I’m having some Ikea Tradfri Bulbs connected via the Tradfri Gateway. To get rid of all the gateways I added zigbee2mqtt with a zigbee stick to the pi openhab is running on. Sensors like motion sensor are connected already.
So now I switched to zigbee2mqtt with my first bulb but I see a different behaviour when sending an “ON” to the brightness dimmer.
When sending an ON to the dimmer connected via tradfri binding, the bulb is switched on a it’s previously set brightness. The dimmers connected via mqtt binding directly receive a 100% which makes the bulb turn on also with 100%
I made some experiments and it seems that the dimmer directly receives a 100% for the mqtt binding, so probably it’s not the bridge that encapsulates this logic.
Here is my setup:
mqtt.things
Bridge mqtt:broker:mosquitto "Mosquitto" @ "System" [ host="mosquitto", port="1883", secure="false", lwtMessage="I'm offline", lwtTopic="lwt/openhab", lwtRetain="true" ]
{
Thing topic zigbee2mqtt "Zigbee2Mqtt Bridge" {
Channels:
Type switch : permitJoin [ commandTopic="zigbee2mqtt/bridge/config/permit_join", on="true", off="false" ]
Type string : state [ stateTopic="zigbee2mqtt/bridge/state" ]
Type string : logType [ stateTopic="zigbee2mqtt/bridge/log", transformationPattern="JSONPATH:$.type" ]
Type string : logMessage [ stateTopic="zigbee2mqtt/bridge/log", transformationPattern="JSONPATH:$.message" ]
}
Thing topic bulbIkeaSchlafzimmer "Schlafzimmer Licht" {
Channels:
Type dimmer : brightness "Schlafzimmer Bulb Dimmer" [ stateTopic="zigbee2mqtt/bulb-tradfri-schlafzimmer", commandTopic="zigbee2mqtt/bulb-tradfri-schlafzimmer/set", min=0, max=100, step=1, transformationPatternOut="JS:openhabdimmer2zigbeebridge.js", transformationPattern="JS:tradfri2openhab.js" ]
Type dimmer : color_temperature "Schlafzimmer Bulb ColorTemperature" [ stateTopic="zigbee2mqtt/bulb-tradfri-schlafzimmer", commandTopic="zigbee2mqtt/bulb-tradfri-schlafzimmer/set", min=50, max=100, step=1, transformationPatternOut="JS:openhabColorTemp2zigbeebridge.js", transformationPattern="JS:tradfriColorTemp2openhab.js" ]
}
}
ikeabridge.things:
Bridge tradfri:gateway:mygateway [ host="192.168.134.29", code="3a3W9e1LmXW9oEzB" ] {
0220 THING_LIGHT_ESSTISCH "Esstisch" [ id=65537 ]
}
my items:
Dimmer LIGHT_WOHNZIMMER_ESSTISCH "Esstisch" <slider> (gWohnzimmer) {channel=" tradfri:0220:mygateway:THING_LIGHT_ESSTISCH:brightness"}
Dimmer LIGHT_SCHLAFZIMMER "Schlafzimmer" <slider> (gSchlafzimmer) {channel="mqtt:topic:mosquitto:bulbIkeaSchlafzimmer:brightness"}
Switch SWITCH_DUMMY_TEST "DimmerTest" (gSchlafzimmer)
Now I created this rule for testing:
rule "TEstRule ON"
when
Item SWITCH_DUMMY_TEST received update ON
then
LIGHT_SCHLAFZIMMER.sendCommand(20)
LIGHT_WOHNZIMMER_ESSTISCH.sendCommand(20)
Thread::sleep(5000)
LIGHT_SCHLAFZIMMER.sendCommand(OFF)
LIGHT_WOHNZIMMER_ESSTISCH.sendCommand(OFF)
Thread::sleep(5000)
LIGHT_SCHLAFZIMMER.sendCommand(ON)
LIGHT_WOHNZIMMER_ESSTISCH.sendCommand(ON)
end
rule "TestRule OFF"
when
Item SWITCH_DUMMY_TEST received update OFF
then
LIGHT_SCHLAFZIMMER.sendCommand(OFF)
LIGHT_KUECHE.sendCommand(OFF)
end
It sets both bulbs (the tradfri and mqtt) to 20%, then sends OFF and afterwards an ON. The tradfri bulb then turns on with the previously set 20%, the mqtt bulb turns on at 100%.
Looking to the mqtt broker the mqtt bulb really gets 100% brightness instead of only “ON” from openhab.
What might I be missing?