How to use homeassistant discovery to control a dimmer?

  • Platform information:
    • Hardware: Intel(R) Core™ i5-7300U CPU @ 2.60GHz/16GB/1T EXT4
    • OS: Ubuntu server 22.04.2 LTS
    • Java Runtime Environment: openjdk version “11.0.17” 2022-10-18
    • openHAB version: 3.4.2
  • Issue of the topic:
    I am trying to operate a zigbee dimmer using zigbee2mqtt > mosquitto > openhab mqtt binding with homeassistant autodiscovery

From zigbee2mqtt I can read and operate the device as expected.
From Mosquitto I can read the topics for this device including the light topic:

{“availability”:[{“topic”:“zigbee2mqtt/bridge/state”,“value_template”:“{{ value_json.state }}”},
{“topic”:“zigbee2mqtt/sw.dimm1/availability”,“value_template”:“{{ value_json.state }}”}],
“model”:“1 channel dimmer (TS110E_1gang_1)”,

From openhab I can see the thing and config topics:


but the light topic channels are not coming through (Sensor and select do).

To me it seems the Zigbee2mqtt is publishing the correct data (though I am not familiar enough with the syntax to exclude possible config errors here). Mosquitto seems to be passing the date as expected and openhab receives the data.

Why could it be unable to identify the channels and how can I debug this issue. I tried cranking up the logging but so far I have not found an error which would explain the missing channels to me.
My config is running around 50 sensors and switches without (big) issues, but this is the first with a light topic; so possibly I am just forgetting some installation setting or plugin, however from the documentation I should expect it to run “out of the box”

This assumption might be incorrect, considering this open issue:

Anyone who can gives me some guides on how to solve this issue? Or should I change the setup for this thing to a manual config?

Apparently the home-assistant JSON implementation is not yet implemented (Openhab 3.4), so a manual thing definition is for now the way to go.

I added a new “Generic MQTT-Thing” from the Things tab, bound it to the my MQTT-broker and used the code field to define the channels:

UID: mqtt:topic:5a3240f665:51b7eb5bf4
label: sw.dimm1.dimmer
thingTypeUID: mqtt:topic
  topics: null
  basetopic: homeassistant
bridgeUID: mqtt:broker:5a3240f665
  - id: switch
    channelTypeUID: mqtt:switch
    label: Light Switch
    description: null
      commandTopic: zigbee2mqtt/sw.dimm1/set
      retained: false
      postCommand: false
      formatBeforePublish: "%s"
      stateTopic: zigbee2mqtt/sw.dimm1
  - id: brightness
    channelTypeUID: mqtt:dimmer
    label: Light Brightness
    description: null
      retained: false
      postCommand: false
      min: 40
      formatBeforePublish: "%s"
      max: 254
      commandTopic: zigbee2mqtt/sw.dimm1/set/brightness
      step: 1
      stateTopic: zigbee2mqtt/sw.dimm1

Now the brightness and on/off channels showed up and could be linked to items. So I can enjoy my home-made wake-up light :sweat_smile:

1 Like