Connecting devices through mqtt

Hello,

I can’t find any tutorial how to connect devices likes hue bulbs through mqtt to openHAB.
I already successfully added Xiaomi devices, just because I receive Information. I used for that MQTT.fx. But now I’m struggling with the bulbs, because I don’t know what I can send/publish to the bulb. How can I discover the functions of it?

Thank you for your help :slight_smile:

HUE bulbs are zigbee, not mqtt.
You first need to connect your bulbs to a mqtt broker, for example through zigbee2mqtt.

If you already have them connected to mqtt, check this page for the channels:

1 Like

What binding are you using? I use zigbee2mqtt and mqtt but I think you may can use the zigbee binding?

@sihui beat me to it. :smile:

Also, if you have an Echo Plus you can use that to control the hue lights as it has a zigbee hub inside it.

1 Like

Only for 10 seconds :grinning:

I’m sorry, I’m using zigbee2mqtt already.

I’m interested where do I found the documentation or another way to find this command e.g. { "brightness" : 50 }

See above:

Have you read this topic Zigbee2mqtt revisited: No more ugly transformations

1 Like

I’m using this for a couple of days now, makes it really easy to connect the channels :+1:

I’m interested in figuring out the channels by myself.

The Supported devices page I already discovered. Lets look at e.g.: https://www.zigbee2mqtt.io/devices/9290012573A.html

No where is documented this: { "brightness" : 50 }

Where are you seeing this?

Well from the beginners tutorial for zigbee2mqtt

Then it means you are either sending a brightness command or getting a brightness state that is 50.

For the hue bulb a transformation may be needed but just for brightness.

I’m not asking what is does, it is obviously.
I want to know how the person figured out that the bulb accepts that command

@baum1234 You will see it (all topics) in the zigbee2mqtt log when the bulb is paired.

From command line use the first for the zigbee2mqtt status and the second command to show topics when light is paired. To exit the log use Ctrl C

systemctl status zigbee2mqtt.service
sudo journalctl -u zigbee2mqtt.service -f

Then it is not supported.

The link posted above shows brightness as being supported. That why I was confused about { "brightness" : 50 } comment. :crazy_face:

Why does it say, that it supports brightness?

@H102
do it doesn’t. my log don’t even tell me that a new bulb connected (I just reset one)

Is permit to join set to true in the ymal file?

Can you post the output from this command.

systemctl status zigbee2mqtt.service

yes, permit join is true

[18:46:23] openhabian@openhab:~$ systemctl status zigbee2mqtt.service
● zigbee2mqtt.service - zigbee2mqtt
   Loaded: loaded (/etc/systemd/system/zigbee2mqtt.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2019-12-31 16:09:55 CET; 3 days ago
 Main PID: 24178 (npm)
    Tasks: 23 (limit: 2319)
   Memory: 37.3M
   CGroup: /system.slice/zigbee2mqtt.service
           ├─24178 npm
           ├─24193 sh -c node index.js
           └─24194 node index.js

Jan 03 18:37:53 openhab npm[24178]: zigbee2mqtt:info  2020-01-03 18:37:53: MQTT publish: topic 'zigbee2mqtt/0x00158d00045065dd', payload '{"battery":9
Jan 03 18:37:53 openhab npm[24178]: zigbee2mqtt:info  2020-01-03 18:37:53: MQTT publish: topic 'zigbee2mqtt/0x00158d00045065dd', payload '{"battery":9
Jan 03 18:37:53 openhab npm[24178]: zigbee2mqtt:info  2020-01-03 18:37:53: MQTT publish: topic 'zigbee2mqtt/0x00158d00045065dd', payload '{"battery":9
Jan 03 18:40:27 openhab npm[24178]: zigbee2mqtt:info  2020-01-03 18:40:27: MQTT publish: topic 'zigbee2mqtt/0x00158d0004247535', payload '{"battery":1
Jan 03 18:40:28 openhab npm[24178]: zigbee2mqtt:info  2020-01-03 18:40:28: MQTT publish: topic 'zigbee2mqtt/0x00158d0004247535', payload '{"battery":1
Jan 03 18:42:58 openhab npm[24178]: zigbee2mqtt:info  2020-01-03 18:42:58: MQTT publish: topic 'zigbee2mqtt/0x00158d00040aaefd', payload '{"battery":1
Jan 03 18:43:24 openhab npm[24178]: zigbee2mqtt:info  2020-01-03 18:43:24: MQTT publish: topic 'zigbee2mqtt/0x00158d00045065dd', payload '{"battery":9
Jan 03 18:43:24 openhab npm[24178]: zigbee2mqtt:info  2020-01-03 18:43:24: MQTT publish: topic 'zigbee2mqtt/0x00158d00045065dd', payload '{"battery":9
Jan 03 18:43:24 openhab npm[24178]: zigbee2mqtt:info  2020-01-03 18:43:24: MQTT publish: topic 'zigbee2mqtt/0x00158d00045065dd', payload '{"battery":9
Jan 03 18:44:01 openhab npm[24178]: zigbee2mqtt:info  2020-01-03 18:44:01: MQTT publish: topic 'zigbee2mqtt/0x00158d000444633a', payload '{"battery":1

Just checking, I made that mistake once before. :smile:

The status looks ok, what about output of
sudo journalctl -u zigbee2mqtt.service -f

Would be good to have two windos open and running both commands while you reset the bulb. Also, check that there is not a hue app running somewhere that’s causing the bulb to connect to hue first. And make sure the bulb is removed from the hue app/bridge.