Mqtt updates the basic UI but my gateway brightness doesn't change

I want to change the brightness of my gateway with an mosquitto_pub command like this:
mosquitto_pub -u mqtt_user -P password -t xiaomi/brightness -m 60
This is the rule that I defined for my gateway brightness:

Group gXiaomi
Group gMiCube
Dimmer Xiaomi_Brightness "Brightness" (gXiaomi, gMiCube) {channel="mihome:gateway:34ce00907400:brightness", mqtt=">[mosquitto:xiaomi/brightness:command:*:default],<[mosquitto:xiaomi/brightness:state:default]"}

This is my sitemap:

sitemap xiaomi label="Xiaomi" {
    Frame label="Gateway" {
        Group item=gXiaomi
    Frame label="Cube" {
        Group item=gMiCube

When I use the mosquitto command mentioned above, the dimmer change its value in simple UI, but my gateway brightness doesn’t change in real world.

First question:
When you do:
mosquitto_pub -u mqtt_user -P password -t xiaomi/brightness -m 60
Does the gateway brightness change?

There are two bindings on the same item and they may conflict.
Second question:
What happens when you remove the channel="mihome:gateway:34ce00907400:brightness", part fron the binding config?

The answer to your first question is: No. My Xiaomi Aqara gateway’s brightness doesn’t change. However, the dimmer’s slider changes in Basic UI ( this shows that the mqtt command is received by openHAB but it has no effect on the gateway)

The answer to your second question is: If I remove the channel section, how does openHAB know that this item is bound to the gateway’s brightness? - I separate them like this but nothing changes:

Dimmer Xiaomi_Brightness "Brightness" (gXiaomi, gMiCube) {channel="mihome:gateway:34ce00907400:brightness"
Dimmer Xiaomi_Brightness "Brightness" (gXiaomi, gMiCube) {mqtt=">[mosquitto:xiaomi/brightness:command:*:default],<[mosquitto:xiaomi/brightness:state:default]"}

I get duplicate key warning in the logs

I think I know what you want to do, you want to use the xiaomi binding the change the brightness on the gateway.
What is the MQTT used for?

1 Like

I use MQTT so that I can control my xiaomi devices via my web-based nodeJS app. In addition, I can receive data generated by the xiaomi sensors in my application via MQTT. This is why I’m trying to configure MQTT binding.

OK test something.
Remove the mqtt binding from the item config.
Can you change the brightness.
We may have to split the binding to two items and use a rule to make it all work together. But I have limited info. What does your nodejs app do?