Connecting devices through mqtt

Okay now I got some logs:

Jan 03 18:56:52 openhab npm[24178]: zigbee2mqtt:info  2020-01-03 18:56:52: MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"type":"device_connected","message":{"friendly_name":"0x0017880104566645"}}'
Jan 03 18:56:52 openhab npm[24178]: zigbee2mqtt:info  2020-01-03 18:56:52: Starting interview of '0x0017880104566645'
Jan 03 18:56:52 openhab npm[24178]: zigbee2mqtt:info  2020-01-03 18:56:52: MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"type":"pairing","message":"interview_started","meta":{"friendly_name":"0x0017880104566645"}}'
Jan 03 18:56:54 openhab npm[24178]: zigbee2mqtt:info  2020-01-03 18:56:54: Successfully interviewed '0x0017880104566645', device has successfully been paired
Jan 03 18:56:54 openhab npm[24178]: zigbee2mqtt:info  2020-01-03 18:56:54: Device '0x0017880104566645' is supported, identified as: Philips Hue white ambiance E26/E27 (8718696548738)
Jan 03 18:56:54 openhab npm[24178]: zigbee2mqtt:info  2020-01-03 18:56:54: MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"type":"pairing","message":"interview_successful","meta":{"friendly_name":"0x0017880104566645","model":"8718696548738","vendor":"Philips","description":"Hue white ambiance E26/E27","supported":true}}'

It it still doesn’t give me the answer for my question.

Sorry about delay.

In your things file add the hue bulb switch like below using your device ID and names. Just the switch for now will do dimmer after ON/OFF is working.

Thing topic zigbee2mqtt "Bedroom Light" @ "Bedroom" {
    Channels:
        Type switch : power  "Power"               [ stateTopic="zigbee/0xb0ce1814030ac279/state",
                                                    commandTopic="zigbee/0xb0ce1814030ac279/set/state", on="ON", off="OFF" ]
        Type dimmer : dimmer "Dimmer"              [ stateTopic="zigbee/0xb0ce1814030ac279",
                                                    commandTopic="zigbee/0xb0ce1814030ac279/set", transformationPattern="JSONPATH:$.brightness", formatBeforePublish="{\"brightness\":%s}" ]
    }

Also make sure to add this to bottom of ymal file:

experimental:
 output: attribute

I already know what I have to put in my .things file. This is still not my question.
How does the person know, that brightness is a function/parameter? What are others? How can I discover them by myself?

I tried this, the output on reset is equal.

Subscribe to the topic with a wildcard.

From the command line use: mosquitto_sub -h Your IP -p your port -u username -P password -t*

You may find this link helpful for topics as well http://mqtt-explorer.com/

1 Like

This helps a bit. * works for bulbs, but my bulb can change the color temperature like white light or warm light. I don’t get the key for that.
Is there another way to get all this information e.g. for Xiaomi devices?

Is both brightness and color_temp : true in ymal file?

Which ymal file? And how do you know that it is called color_temp?

I don’t b/c I’m not sure what Xiaomi bulb you have. I just picked one on the list from github docs. but most are the same.

You miss understand me. My hue bulb can change the brightness and color temperature.
The Xiaomi questions is just besides the bulbs.

You get the info from the device page for zigbee2mqtt. If the device is not supported then you need to use a wild card publish command, use a mqqt tool, contact the manufacture, etc…

Do you have a specific device or just asking in general?

I have this: https://www.amazon.de/gp/product/B0748MZ3Y6 and this https://www.amazon.de/gp/product/B074PWJ61J

Both supports color temperature. Here is the zigbee2mqtt documentation for the second bulb innr: https://www.zigbee2mqtt.io/devices/RS_128_T.html
It says, that it supports brightness and color temperature, but there is no documentation for how to call the functions.

For the second bulb if you stop zigbee2mqtt and add

brightness: true
    color_temp: true

to the ymal file (for this bulb), restart zigbee2mqtt and then use the wildcard (*) like above it does not give you all the topics like color and brightness?

right at the bottom? it looks like there is a main group over it.
Also the configuration says nothing about it: https://www.zigbee2mqtt.io/information/configuration.html

For a wildcard use # instead of * at the end and see what you get.

I mean this, where in the yaml file I have to put them?

Above the device friendly name.

If you can post your ymal file to view it may be easier.

permit_join: true
mqtt:
  base_topic: zigbee2mqtt
  server: 'mqtt://localhost:1883'
  user: user
  password: password
  client_id: Zigbee
  reject_unauthorized: false
  include_device_information: true
serial:
  port: /dev/ttyACM0
  disable_led: false
experimental:
  output: attribute
  brightness: true
  color_temp: true
devices:
  '0x00158d00045065dd':
    friendly_name: '0x00158d00045065dd'

now they are unter experimental. Or should I remove the spaces?

#edit
just tried both, didn’t work. still doesn’t geht color_temp

Place it under include_device_information: true

Then use this topic:

mosquitto_sub -h Your IP -p your port -u username -P password -t zigbee/0x00158d00045065dd/#

or

mosquitto_sub -h Your IP -p your port -u username -P password -t zigbee/0x00158d00045065dd/*

EDIT:
Use sub not pub, I changed it above.

Okay I put it under include_device_information, but I still get brightness but not color_temp

Can you post the output of mosquitto_sub -h Your IP -p your port -u username -P password -t zigbee/0x00158d00045065dd/#