OpenHAB3 with Zigbee2MQTT

Hi!

I am trying to set up my first hue light bulb in OpenHAB3 via Zigbee2MQTT. I am able to read values from the bulb, but I cannot figure out how to send commands back to the bulb via MQTT. Should the state and command topic be different or what am I doing wrong?

Thanks in advance

UID: mqtt:topic:cb609d2f95
label: Hue White Ambiance 1
thingTypeUID: mqtt:topic
configuration: {}
bridgeUID: mqtt:broker:e90f42a7f8
location: Kitchen Island
channels:
  - id: state
    channelTypeUID: mqtt:string
    label: state
    description: null
    configuration:
      commandTopic: zigbee2mqtt/0x001788010830795c
      allowedStates: ON,OFF
      postCommand: true
      transformationPatternOut: JSONPATH:$.state
      stateTopic: zigbee2mqtt/0x001788010830795c
      transformationPattern: JSONPATH:$.state

There are a number of threads on zigbee2mqtt to OH integration here on the forum, a couple of which are tutorials. For example openHAB and zigbee2mqtt Tutorial for Beginners.

Yes, absolutely. The state and command topics are indeed different.

I just realized :wink:

Does this look any better?

commandTopic: zigbee2mqtt/0x001788010830795c/set/state
stateTopic: zigbee2mqtt/0x001788010830795c/state

This works. Thanks for your help! :slight_smile:

   configuration:
      commandTopic: zigbee2mqtt/0x001788010830795c/set/state
      allowedStates: ON,OFF
      postCommand: true
      stateTopic: zigbee2mqtt/0x001788010830795c/state

Thought I needed to use the transformationpath to make this work. Thanks again

Try to use friendly names with zigbee2mqtt. Not essential, but it’s nicer to work with.

To make things easier I would recommend using the “output: attribute” setting in zigbee2mqtt. With that option each attribute will get it’s own message so you don’t need json transformations anymore.
And the web-GUI is another essential feature of zigbee2mqtt if you haven’t discovered it yet.
You can find many examples in the discussions here:

I don’t know exactly what I did wrong, but now my scale on the dimmer works as I was hoping for. I deleted the channel and recreated it.

I will give your suggestion a try another time. Thanks.

channels:
  - id: state
    channelTypeUID: mqtt:switch
    label: state
    description: null
    configuration:
      commandTopic: zigbee2mqtt/0x0017880104aa924f/set/state
      stateTopic: zigbee2mqtt/0x0017880104aa924f/state
      off: OFF
      on: ON
  - id: brightness
    channelTypeUID: mqtt:dimmer
    label: brightness
    description: null
    configuration:
      commandTopic: zigbee2mqtt/0x0017880104aa924f/set/brightness
      min: 0
      stateTopic: zigbee2mqtt/0x0017880104aa924f/brightness
      max: 254
      off: OFF
      on: ON

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.